Gcc and clang warning / error flags

Where can I find a list of all available warning and error flags that I can set in clang and gcc? I have looked through all their respective documentation sites and I cannot find anything.

+4
source share
5 answers
gcc --help=warnings,seperate gcc --help=warnings,joined gcc --help=warnings,undocumented gcc --help=warnings 

individual flags are similar to booleans; they are either on or off.
-Wflag means on. -Wno-flag means off.

attached flags are flags that require a value.
-Wflag = value

by typing gcc --help = warnings , you will get all the warning options provided by your compiler.

EDIT:
looking at the GNU Documentation , these warning messages existed after GCC 4.3.6

+4
source

For Clang, there is -Weverything , which allows all warning flags to be used.

+2
source

Classic: man gcc . clang manpage is not yet full, but since it mimics gcc behavior anyway, many of the gcc -W options also work with clang.

+1
source

If the question is only to find a list of all possible GCC diagnostic messages (error, warning, ...), you can use the message catalog for localization utilities. Use the GCC source code ball to look inside gcc/po/ or libcpp/po/ or libstdc++-v3/po/ etc.

If you just ask about the options used to receive these messages, follow the link to Oli Charlworth's answer .

+1
source

Source: https://habr.com/ru/post/1385770/


All Articles