public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug other/109475] New: How to check for default compiler warnings in g++ 8.4.0
@ 2023-04-11 18:34 jorge.pinto.sousa at proton dot me
  2023-04-11 18:37 ` [Bug other/109475] " pinskia at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: jorge.pinto.sousa at proton dot me @ 2023-04-11 18:34 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 109475
           Summary: How to check for default compiler warnings in g++
                    8.4.0
           Product: gcc
           Version: 8.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: other
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jorge.pinto.sousa at proton dot me
  Target Milestone: ---

Hello,

I was trying to get the list of warnings enabled by default from gcc and where
to get that info from. Looked in to the manual and found that we could get a
list of the warnings enabled by doing:

>  /usr/bin/gcc-8 -Q --help=warnings | grep enabled
but then some warnings despite being listed there were not triggered:
https://godbolt.org/z/GGnjcjxKh

Like -Wtrigraphs for example:
> gcc -Q --help=warning | grep trigraph 
>   -Wtrigraphs                           [enabled]

I then tried to compile that example locally by dumping all the flags:

>  gcc -Q -v foo.cpp
which (I think) dumps (all) the compilation and linking flags, and the only
warnings I got there are:

> options passed:  -v -imultiarch x86_64-linux-gnu -D_GNU_SOURCE foo.cpp
> -mtune=generic -march=x86-64 -Wctor-dtor-privacy
> -fasynchronous-unwind-tables -fstack-protector-strong -Wformat
> -Wformat-security -fstack-clash-protection -fcf-protection
> options enabled:  -fPIC -fPIE -faggressive-loop-optimizations
> (...)


That is :
> -Wformat 
> -Wformat-security 

So we can say that these are the only two that are default enabled?
(I also looked into
https://gcc.gnu.org/onlinedocs/gcc-8.4.0/gcc/Option-Summary.html but could not
find any pointers).

Would like to know where one can get the correct list for these. Note that I am
not talking about -Wall or anything. Just the list of warnings that is enabled
by default, without adding any other flags.

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

* [Bug other/109475] How to check for default compiler warnings in g++ 8.4.0
  2023-04-11 18:34 [Bug other/109475] New: How to check for default compiler warnings in g++ 8.4.0 jorge.pinto.sousa at proton dot me
@ 2023-04-11 18:37 ` pinskia at gcc dot gnu.org
  2023-04-11 18:41 ` jorge.pinto.sousa at proton dot me
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-04-11 18:37 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
>So we can say that these are the only two that are default enabled?


No in fact -Wformat-security is not enabled by default in the released version
of GCC from the FSF, the distro I know that enables it by default is both
Debian and Ubuntu.

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

* [Bug other/109475] How to check for default compiler warnings in g++ 8.4.0
  2023-04-11 18:34 [Bug other/109475] New: How to check for default compiler warnings in g++ 8.4.0 jorge.pinto.sousa at proton dot me
  2023-04-11 18:37 ` [Bug other/109475] " pinskia at gcc dot gnu.org
@ 2023-04-11 18:41 ` jorge.pinto.sousa at proton dot me
  2023-04-11 18:41 ` pinskia at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: jorge.pinto.sousa at proton dot me @ 2023-04-11 18:41 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Jorge Pinto Sousa <jorge.pinto.sousa at proton dot me> ---
> No in fact -Wformat-security is not enabled by default in the released version of GCC from the FSF, the distro I know that enables it by default is both Debian and Ubuntu.

Ah so the ones that come enabled by default are distro dependent. Can you point
me where, or by what option, when building from source are those enabled?

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

* [Bug other/109475] How to check for default compiler warnings in g++ 8.4.0
  2023-04-11 18:34 [Bug other/109475] New: How to check for default compiler warnings in g++ 8.4.0 jorge.pinto.sousa at proton dot me
  2023-04-11 18:37 ` [Bug other/109475] " pinskia at gcc dot gnu.org
  2023-04-11 18:41 ` jorge.pinto.sousa at proton dot me
@ 2023-04-11 18:41 ` pinskia at gcc dot gnu.org
  2023-04-11 18:45 ` pinskia at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-04-11 18:41 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
>but then some warnings despite being listed there were not triggered:
https://godbolt.org/z/GGnjcjxKh


You get the trigraph warning if you don't supply any options. -std=c++14 option
enables -trigraphs option

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

* [Bug other/109475] How to check for default compiler warnings in g++ 8.4.0
  2023-04-11 18:34 [Bug other/109475] New: How to check for default compiler warnings in g++ 8.4.0 jorge.pinto.sousa at proton dot me
                   ` (2 preceding siblings ...)
  2023-04-11 18:41 ` pinskia at gcc dot gnu.org
@ 2023-04-11 18:45 ` pinskia at gcc dot gnu.org
  2023-04-11 18:47 ` jorge.pinto.sousa at proton dot me
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-04-11 18:45 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |INVALID
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Jorge Pinto Sousa from comment #2)
> Can you point me where, or by what option, when building from source are those
> enabled?

You should ask the distro for that support.


Also -Wctor-dtor-privacy is not enabled by default either.


apinski@xeond:~/src/upstream-gcc/gcc/gcc$ ~/upstream-gcc/bin/gcc -Q
--help=warning | grep ctor-dtor-privacy
  -Wctor-dtor-privacy                   [available in C++, ObjC++]




https://gcc.gnu.org/onlinedocs/gcc-12.2.0/gcc/Warning-Options.html#index-Wtrigraphs
Says:
If -Wall is not given, this option is still enabled unless trigraphs are
enabled. 

Which exactly what -std=c++14 does, it enables them.

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

* [Bug other/109475] How to check for default compiler warnings in g++ 8.4.0
  2023-04-11 18:34 [Bug other/109475] New: How to check for default compiler warnings in g++ 8.4.0 jorge.pinto.sousa at proton dot me
                   ` (3 preceding siblings ...)
  2023-04-11 18:45 ` pinskia at gcc dot gnu.org
@ 2023-04-11 18:47 ` jorge.pinto.sousa at proton dot me
  2023-04-11 18:49 ` jorge.pinto.sousa at proton dot me
  2023-04-12  9:41 ` redi at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: jorge.pinto.sousa at proton dot me @ 2023-04-11 18:47 UTC (permalink / raw)
  To: gcc-bugs

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

Jorge Pinto Sousa <jorge.pinto.sousa at proton dot me> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |UNCONFIRMED
         Resolution|INVALID                     |---

--- Comment #5 from Jorge Pinto Sousa <jorge.pinto.sousa at proton dot me> ---
> You get the trigraph warning if you don't supply any options. -std=c++14 option > enables -trigraphs option

Ok so to have it enabled again I need to -Wtrigraphs after.

So:
>  /usr/bin/gcc-8 -Q --help=warnings | grep enabled

This should give the list of warnings enabled for that specific gcc binary?

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

* [Bug other/109475] How to check for default compiler warnings in g++ 8.4.0
  2023-04-11 18:34 [Bug other/109475] New: How to check for default compiler warnings in g++ 8.4.0 jorge.pinto.sousa at proton dot me
                   ` (4 preceding siblings ...)
  2023-04-11 18:47 ` jorge.pinto.sousa at proton dot me
@ 2023-04-11 18:49 ` jorge.pinto.sousa at proton dot me
  2023-04-12  9:41 ` redi at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: jorge.pinto.sousa at proton dot me @ 2023-04-11 18:49 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Jorge Pinto Sousa <jorge.pinto.sousa at proton dot me> ---
Let me rephrase, Im sorry maybe I was too broad. For any specific gcc binary,

> /usr/bin/gcc-8 -Q --help=warnings | grep enabled

Will give me the list of warnings enabled by default?

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

* [Bug other/109475] How to check for default compiler warnings in g++ 8.4.0
  2023-04-11 18:34 [Bug other/109475] New: How to check for default compiler warnings in g++ 8.4.0 jorge.pinto.sousa at proton dot me
                   ` (5 preceding siblings ...)
  2023-04-11 18:49 ` jorge.pinto.sousa at proton dot me
@ 2023-04-12  9:41 ` redi at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: redi at gcc dot gnu.org @ 2023-04-12  9:41 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |INVALID
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #7 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Yes.

This is not a bug, questions like this belong on the gcc-help mailing list
instead.

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

end of thread, other threads:[~2023-04-12  9:41 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-11 18:34 [Bug other/109475] New: How to check for default compiler warnings in g++ 8.4.0 jorge.pinto.sousa at proton dot me
2023-04-11 18:37 ` [Bug other/109475] " pinskia at gcc dot gnu.org
2023-04-11 18:41 ` jorge.pinto.sousa at proton dot me
2023-04-11 18:41 ` pinskia at gcc dot gnu.org
2023-04-11 18:45 ` pinskia at gcc dot gnu.org
2023-04-11 18:47 ` jorge.pinto.sousa at proton dot me
2023-04-11 18:49 ` jorge.pinto.sousa at proton dot me
2023-04-12  9:41 ` redi 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).