public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/89072] -Wall -Werror should be defaults
       [not found] <bug-89072-4@http.gcc.gnu.org/bugzilla/>
@ 2024-01-12 13:33 ` xry111 at gcc dot gnu.org
  2024-01-12 14:36 ` segher at gcc dot gnu.org
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 12+ messages in thread
From: xry111 at gcc dot gnu.org @ 2024-01-12 13:33 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89072

Xi Ruoyao <xry111 at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |xry111 at gcc dot gnu.org

--- Comment #3 from Xi Ruoyao <xry111 at gcc dot gnu.org> ---
In GCC 14 several warnings will be turned to errors by default with C99 or a
newer C standard.  But generally -Werror should *never* be the default. 
Besides the reasons Segher and Rich have already given, the standard also
disallows the compiler from randomly rejecting code just because it "looks
suspicious".

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

* [Bug c/89072] -Wall -Werror should be defaults
       [not found] <bug-89072-4@http.gcc.gnu.org/bugzilla/>
  2024-01-12 13:33 ` [Bug c/89072] -Wall -Werror should be defaults xry111 at gcc dot gnu.org
@ 2024-01-12 14:36 ` segher at gcc dot gnu.org
  2024-01-12 15:06 ` vincent-gcc at vinc17 dot net
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 12+ messages in thread
From: segher at gcc dot gnu.org @ 2024-01-12 14:36 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89072

--- Comment #4 from Segher Boessenkool <segher at gcc dot gnu.org> ---
(In reply to Xi Ruoyao from comment #3)
> In GCC 14 several warnings will be turned to errors by default with C99 or a
> newer C standard.  But generally -Werror should *never* be the default. 
> Besides the reasons Segher and Rich have already given, the standard also
> disallows the compiler from randomly rejecting code just because it "looks
> suspicious".

Huh?  Where does the standard require that?  The closest to it is 4/8: "An 
implementation shall be accompanied by a document that defines all
implementation-defined and locale-specific characteristics and all
extensions." which essentially *allows* such restrictions.  It just has to
be documented.

Of course a good implementation will not reject valid code without a very
good reason to do that.

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

* [Bug c/89072] -Wall -Werror should be defaults
       [not found] <bug-89072-4@http.gcc.gnu.org/bugzilla/>
  2024-01-12 13:33 ` [Bug c/89072] -Wall -Werror should be defaults xry111 at gcc dot gnu.org
  2024-01-12 14:36 ` segher at gcc dot gnu.org
@ 2024-01-12 15:06 ` vincent-gcc at vinc17 dot net
  2024-01-12 15:08 ` vincent-gcc at vinc17 dot net
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 12+ messages in thread
From: vincent-gcc at vinc17 dot net @ 2024-01-12 15:06 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89072

--- Comment #5 from Vincent Lefèvre <vincent-gcc at vinc17 dot net> ---
Note that -Wall -Werror seem to be fine in general when they are used alone,
but this combination can be very problematic when other options are used, such
as -std=c90 -pedantic, and other warnings. So default errors need to be
restricted, e.g. rather with something like -Werror=all. But in any case, there
are currently warnings in -Wall that should not be turned into errors by
default, e.g. those related to code style (such as -Wlogical-not-parentheses)
and heuristics (such as -Wmaybe-uninitialized).

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

* [Bug c/89072] -Wall -Werror should be defaults
       [not found] <bug-89072-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2024-01-12 15:06 ` vincent-gcc at vinc17 dot net
@ 2024-01-12 15:08 ` vincent-gcc at vinc17 dot net
  2024-01-12 15:18 ` segher at gcc dot gnu.org
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 12+ messages in thread
From: vincent-gcc at vinc17 dot net @ 2024-01-12 15:08 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89072

--- Comment #6 from Vincent Lefèvre <vincent-gcc at vinc17 dot net> ---
BTW, note that some code may be generated (instead of being written by a
human). So having some code style being an error by default would be very bad.

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

* [Bug c/89072] -Wall -Werror should be defaults
       [not found] <bug-89072-4@http.gcc.gnu.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2024-01-12 15:08 ` vincent-gcc at vinc17 dot net
@ 2024-01-12 15:18 ` segher at gcc dot gnu.org
  2024-01-12 15:44 ` xry111 at gcc dot gnu.org
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 12+ messages in thread
From: segher at gcc dot gnu.org @ 2024-01-12 15:18 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89072

--- Comment #7 from Segher Boessenkool <segher at gcc dot gnu.org> ---
-Werror always is wrong, for any sane users.  Always.  Not just "in general".

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

* [Bug c/89072] -Wall -Werror should be defaults
       [not found] <bug-89072-4@http.gcc.gnu.org/bugzilla/>
                   ` (4 preceding siblings ...)
  2024-01-12 15:18 ` segher at gcc dot gnu.org
@ 2024-01-12 15:44 ` xry111 at gcc dot gnu.org
  2024-01-12 15:51 ` jakub at gcc dot gnu.org
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 12+ messages in thread
From: xry111 at gcc dot gnu.org @ 2024-01-12 15:44 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89072

--- Comment #8 from Xi Ruoyao <xry111 at gcc dot gnu.org> ---
(In reply to Segher Boessenkool from comment #7)
> -Werror always is wrong, for any sane users.  Always.  Not just "in general".

-Werror={something you really understand} may be OK.  A -Werror without = is
always wrong.

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

* [Bug c/89072] -Wall -Werror should be defaults
       [not found] <bug-89072-4@http.gcc.gnu.org/bugzilla/>
                   ` (5 preceding siblings ...)
  2024-01-12 15:44 ` xry111 at gcc dot gnu.org
@ 2024-01-12 15:51 ` jakub at gcc dot gnu.org
  2024-01-12 15:58 ` mpolacek at gcc dot gnu.org
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu.org @ 2024-01-12 15:51 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89072

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #9 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
It is not always wrong, it is a reasonable choice for some projects during
their development, if they are willing to fix or work around all new warnings,
even if they are false positives.
But enabling any kind of -Werror by default is always wrong.

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

* [Bug c/89072] -Wall -Werror should be defaults
       [not found] <bug-89072-4@http.gcc.gnu.org/bugzilla/>
                   ` (6 preceding siblings ...)
  2024-01-12 15:51 ` jakub at gcc dot gnu.org
@ 2024-01-12 15:58 ` mpolacek at gcc dot gnu.org
  2024-01-12 19:51 ` segher at gcc dot gnu.org
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 12+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2024-01-12 15:58 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89072

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mpolacek at gcc dot gnu.org
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |INVALID

--- Comment #10 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
I think we have a strong consensus here.

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

* [Bug c/89072] -Wall -Werror should be defaults
       [not found] <bug-89072-4@http.gcc.gnu.org/bugzilla/>
                   ` (7 preceding siblings ...)
  2024-01-12 15:58 ` mpolacek at gcc dot gnu.org
@ 2024-01-12 19:51 ` segher at gcc dot gnu.org
  2024-01-12 22:38 ` vincent-gcc at vinc17 dot net
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 12+ messages in thread
From: segher at gcc dot gnu.org @ 2024-01-12 19:51 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89072

--- Comment #11 from Segher Boessenkool <segher at gcc dot gnu.org> ---
(In reply to Jakub Jelinek from comment #9)
> It is not always wrong, it is a reasonable choice for some projects during
> their development, if they are willing to fix or work around all new
> warnings, even if they are false positives.

Sure.  If people want the pain, they can have it.  But it is never okay to
cause other people to have -Werror -- they may have a different compiler
(version) that no one else has tested with, they may have different warnings
enabled, etc.

> But enabling any kind of -Werror by default is always wrong.

Yup.

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

* [Bug c/89072] -Wall -Werror should be defaults
       [not found] <bug-89072-4@http.gcc.gnu.org/bugzilla/>
                   ` (8 preceding siblings ...)
  2024-01-12 19:51 ` segher at gcc dot gnu.org
@ 2024-01-12 22:38 ` vincent-gcc at vinc17 dot net
  2024-01-13 18:57 ` segher at gcc dot gnu.org
  2024-01-15  4:03 ` egallager at gcc dot gnu.org
  11 siblings, 0 replies; 12+ messages in thread
From: vincent-gcc at vinc17 dot net @ 2024-01-12 22:38 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89072

--- Comment #12 from Vincent Lefèvre <vincent-gcc at vinc17 dot net> ---
(In reply to Segher Boessenkool from comment #11)
> Sure.  If people want the pain, they can have it.  But it is never okay to
> cause other people to have -Werror -- they may have a different compiler
> (version) that no one else has tested with, they may have different warnings
> enabled, etc.

For MPFR automated tests (and sometimes during my usual development too), I use
-Werror in combination with -Wall plus some other useful warnings
(-Wold-style-declaration -Wold-style-definition -Wmissing-parameter-type
-Wmissing-prototypes -Wmissing-declarations -Wmissing-field-initializers
-Wc++-compat -Wwrite-strings -Wcast-function-type -Wcast-align=strict
-Wimplicit-fallthrough), and this is very useful, though this sometimes
triggers GCC bugs. But of course, it's for internal use only. And the use of
-Werror without "=" is valid only because I make sure that no other -W...
options are used.

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

* [Bug c/89072] -Wall -Werror should be defaults
       [not found] <bug-89072-4@http.gcc.gnu.org/bugzilla/>
                   ` (9 preceding siblings ...)
  2024-01-12 22:38 ` vincent-gcc at vinc17 dot net
@ 2024-01-13 18:57 ` segher at gcc dot gnu.org
  2024-01-15  4:03 ` egallager at gcc dot gnu.org
  11 siblings, 0 replies; 12+ messages in thread
From: segher at gcc dot gnu.org @ 2024-01-13 18:57 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89072

--- Comment #13 from Segher Boessenkool <segher at gcc dot gnu.org> ---
I always have -Wmissing-declarations -Wformat=2 , for some reason those aren't
in
-Wall, not even in -W .  Crazy if you ask me :-)

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

* [Bug c/89072] -Wall -Werror should be defaults
       [not found] <bug-89072-4@http.gcc.gnu.org/bugzilla/>
                   ` (10 preceding siblings ...)
  2024-01-13 18:57 ` segher at gcc dot gnu.org
@ 2024-01-15  4:03 ` egallager at gcc dot gnu.org
  11 siblings, 0 replies; 12+ messages in thread
From: egallager at gcc dot gnu.org @ 2024-01-15  4:03 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89072

Eric Gallager <egallager at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |egallager at gcc dot gnu.org
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=87656

--- Comment #14 from Eric Gallager <egallager at gcc dot gnu.org> ---
Now we're straying into bug 87656...

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

end of thread, other threads:[~2024-01-15  4:03 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-89072-4@http.gcc.gnu.org/bugzilla/>
2024-01-12 13:33 ` [Bug c/89072] -Wall -Werror should be defaults xry111 at gcc dot gnu.org
2024-01-12 14:36 ` segher at gcc dot gnu.org
2024-01-12 15:06 ` vincent-gcc at vinc17 dot net
2024-01-12 15:08 ` vincent-gcc at vinc17 dot net
2024-01-12 15:18 ` segher at gcc dot gnu.org
2024-01-12 15:44 ` xry111 at gcc dot gnu.org
2024-01-12 15:51 ` jakub at gcc dot gnu.org
2024-01-12 15:58 ` mpolacek at gcc dot gnu.org
2024-01-12 19:51 ` segher at gcc dot gnu.org
2024-01-12 22:38 ` vincent-gcc at vinc17 dot net
2024-01-13 18:57 ` segher at gcc dot gnu.org
2024-01-15  4:03 ` egallager at gcc dot gnu.org

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).