public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [WIP] Have -Wpointer-sign be enabled by -Wextra, too [PR109836]
@ 2023-05-30 21:42 Eric Gallager
  2023-08-09  0:17 ` [PATCH v2] " Eric Gallager
  0 siblings, 1 reply; 4+ messages in thread
From: Eric Gallager @ 2023-05-30 21:42 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 514 bytes --]

PR109836 is a request to have -Wpointer-sign enabled by default. There
were points of disagreement raised in the bug report, so I figured
that maybe as a compromise, the warning could just be enabled by
-Wextra, as well (I have in fact seen some projects that enable
-Wextra but not -Wall). This patch would implement my suggestion of
adding it to -Wextra, but it's not ready to commit yet, as it still
needs testing, documentation, and a ChangeLog entry. I'm just posting
it here as an RFC; what do people think?

[-- Attachment #2: patch-gcc_c-family_c.opt.diff --]
[-- Type: application/octet-stream, Size: 551 bytes --]

diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt
index 0d0ad0a6374..f046d91d03b 100644
--- a/gcc/c-family/c.opt
+++ b/gcc/c-family/c.opt
@@ -1178,7 +1178,7 @@ C ObjC C++ ObjC++ Var(warn_pointer_arith) Warning LangEnabledBy(C ObjC C++ ObjC+
 Warn about function pointer arithmetic.
 
 Wpointer-sign
-C ObjC Var(warn_pointer_sign) Warning LangEnabledBy(C ObjC,Wall || Wpedantic)
+C ObjC Var(warn_pointer_sign) Warning LangEnabledBy(C ObjC,Wall || Wpedantic || Wextra)
 Warn when a pointer differs in signedness in an assignment.
 
 Wpointer-compare

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v2] Re: [WIP] Have -Wpointer-sign be enabled by -Wextra, too [PR109836]
  2023-05-30 21:42 [WIP] Have -Wpointer-sign be enabled by -Wextra, too [PR109836] Eric Gallager
@ 2023-08-09  0:17 ` Eric Gallager
  2023-08-16 21:33   ` [PING] " Eric Gallager
  0 siblings, 1 reply; 4+ messages in thread
From: Eric Gallager @ 2023-08-09  0:17 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 1056 bytes --]

On Tue, May 30, 2023 at 5:42 PM Eric Gallager <egall@gwmail.gwu.edu> wrote:
>
> PR109836 is a request to have -Wpointer-sign enabled by default. There
> were points of disagreement raised in the bug report, so I figured
> that maybe as a compromise, the warning could just be enabled by
> -Wextra, as well (I have in fact seen some projects that enable
> -Wextra but not -Wall). This patch would implement my suggestion of
> adding it to -Wextra, but it's not ready to commit yet, as it still
> needs testing, documentation, and a ChangeLog entry. I'm just posting
> it here as an RFC; what do people think?

Here's the link for the previous message's spot in the archives:
https://gcc.gnu.org/pipermail/gcc-patches/2023-May/620137.html
Here's an updated (but still untested) version of the patch with an invoke.texi
update and a ChangeLog entry:

gcc/c-family/ChangeLog:

    * c.opt: Have -Wpointer-sign be enabled by -Wextra, too

gcc/ChangeLog:

    * doc/invoke.texi: Document -Wpointer-sign now being enabled by -Wextra, too

[-- Attachment #2: patch_Wpointer-sign_Wextra.diff --]
[-- Type: application/octet-stream, Size: 1236 bytes --]

diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt
index 0d0ad0a6374..f046d91d03b 100644
--- a/gcc/c-family/c.opt
+++ b/gcc/c-family/c.opt
@@ -1178,7 +1178,7 @@ C ObjC C++ ObjC++ Var(warn_pointer_arith) Warning LangEnabledBy(C ObjC C++ ObjC+
 Warn about function pointer arithmetic.
 
 Wpointer-sign
-C ObjC Var(warn_pointer_sign) Warning LangEnabledBy(C ObjC,Wall || Wpedantic)
+C ObjC Var(warn_pointer_sign) Warning LangEnabledBy(C ObjC,Wall || Wpedantic || Wextra)
 Warn when a pointer differs in signedness in an assignment.
 
 Wpointer-compare
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 277ac35ad16..23a51c6d266 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -9952,8 +9952,8 @@ itself is likely to take inordinate amounts of time.
 @opindex Wno-pointer-sign
 Warn for pointer argument passing or assignment with different signedness.
 This option is only supported for C and Objective-C@.  It is implied by
-@option{-Wall} and by @option{-Wpedantic}, which can be disabled with
-@option{-Wno-pointer-sign}.
+each of @option{-Wall}, @option{-Wextra}. and @option{-Wpedantic}, in
+which case it can be disabled with @option{-Wno-pointer-sign}.
 
 @item -Wstack-protector
 @opindex Wstack-protector

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PING] Re: [PATCH v2] Re: [WIP] Have -Wpointer-sign be enabled by -Wextra, too [PR109836]
  2023-08-09  0:17 ` [PATCH v2] " Eric Gallager
@ 2023-08-16 21:33   ` Eric Gallager
  2023-08-17 14:54     ` Joseph Myers
  0 siblings, 1 reply; 4+ messages in thread
From: Eric Gallager @ 2023-08-16 21:33 UTC (permalink / raw)
  To: gcc-patches

PING

On Tue, Aug 8, 2023 at 8:17 PM Eric Gallager <egall@gwmail.gwu.edu> wrote:
>
> On Tue, May 30, 2023 at 5:42 PM Eric Gallager <egall@gwmail.gwu.edu> wrote:
> >
> > PR109836 is a request to have -Wpointer-sign enabled by default. There
> > were points of disagreement raised in the bug report, so I figured
> > that maybe as a compromise, the warning could just be enabled by
> > -Wextra, as well (I have in fact seen some projects that enable
> > -Wextra but not -Wall). This patch would implement my suggestion of
> > adding it to -Wextra, but it's not ready to commit yet, as it still
> > needs testing, documentation, and a ChangeLog entry. I'm just posting
> > it here as an RFC; what do people think?
>
> Here's the link for the previous message's spot in the archives:
> https://gcc.gnu.org/pipermail/gcc-patches/2023-May/620137.html
> Here's an updated (but still untested) version of the patch with an invoke.texi
> update and a ChangeLog entry:
>
> gcc/c-family/ChangeLog:
>
>     * c.opt: Have -Wpointer-sign be enabled by -Wextra, too
>
> gcc/ChangeLog:
>
>     * doc/invoke.texi: Document -Wpointer-sign now being enabled by -Wextra, too

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PING] Re: [PATCH v2] Re: [WIP] Have -Wpointer-sign be enabled by -Wextra, too [PR109836]
  2023-08-16 21:33   ` [PING] " Eric Gallager
@ 2023-08-17 14:54     ` Joseph Myers
  0 siblings, 0 replies; 4+ messages in thread
From: Joseph Myers @ 2023-08-17 14:54 UTC (permalink / raw)
  To: Eric Gallager; +Cc: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 1250 bytes --]

On Wed, 16 Aug 2023, Eric Gallager via Gcc-patches wrote:

> PING
> 
> On Tue, Aug 8, 2023 at 8:17 PM Eric Gallager <egall@gwmail.gwu.edu> wrote:
> >
> > On Tue, May 30, 2023 at 5:42 PM Eric Gallager <egall@gwmail.gwu.edu> wrote:
> > >
> > > PR109836 is a request to have -Wpointer-sign enabled by default. There
> > > were points of disagreement raised in the bug report, so I figured
> > > that maybe as a compromise, the warning could just be enabled by
> > > -Wextra, as well (I have in fact seen some projects that enable
> > > -Wextra but not -Wall). This patch would implement my suggestion of
> > > adding it to -Wextra, but it's not ready to commit yet, as it still
> > > needs testing, documentation, and a ChangeLog entry. I'm just posting
> > > it here as an RFC; what do people think?

The documentation for -Wextra says "This enables some extra warning flags 
that are not enabled by @option{-Wall}." (and this patch doesn't change 
that documentation).  I don't see any coherent reason for changing that to 
add a single one of the -Wall warnings (but not any of the others).  (I'm 
*not* suggesting making -Wextra a superset of -Wall, but I don't think 
this change is a sensible one.)

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-08-17 14:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-30 21:42 [WIP] Have -Wpointer-sign be enabled by -Wextra, too [PR109836] Eric Gallager
2023-08-09  0:17 ` [PATCH v2] " Eric Gallager
2023-08-16 21:33   ` [PING] " Eric Gallager
2023-08-17 14:54     ` Joseph Myers

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).