G ++ or gcc to receive a warning message with a warning identifier

By default, gcc / g ++ only prints a warning message with a line number. I am looking for an option whereby g ++ or gcc associates assembly warning messages with warning identifiers so that warning messages can be easily identified (indiscriminately). Is there also an opportunity to receive a more detailed warning? (Although I think that each of the warning messages is largely explainable in itself, it’s just curious)

Thanks.

+6
gcc compiler-construction warnings
source share
4 answers

GCC 4.x has the option "-fdiagnostics-show-option", which displays the option used to disable the warning:

$ gcc -fdiagnostics-show-option foo.c -Wall -o foo foo.c: In function 'main': foo.c:3: warning: unused variable 'x' [-Wunused-variable] foo.c:4: warning: control reaches end of non-void function 

If you need to parse a warning, this can simplify the situation (especially if there are localized error messages).

+6
source share

GCC does not provide the ability to modify / add warning message text. See β€œOptions for controlling the formatting of diagnostic messages” on the manual page.

GCC also does not provide more detailed warning messages.

Unfortunately.

+2
source share

AFAIK, there is no such option - messages are self-identified.

+1
source share

GCC does not have an identifier identifier display ↔. If you want to filter specific warning messages, use a CFLAG, such as -Wno-pragmas or -Wno-oveflow . A complete list of flags is documented on the manual page.

+1
source share

All Articles