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.

Reply via email to