I'd like to know if it's possible to get a list of warnings that are enabled in GCC when no -Wx or -W-no-x flags are specified? I need this because I've got 2 different GCC versions (namely 3.3 and 4.3) which react differently on the same code with the same compilation flags.
For example, 4.3 with no additional warning options throws a warning when signed-to-unsigned comparison occurs while 3.3 does only if -Wsign-compare flag. So, I'd like to figure out, which flags should I add to gcc-3.3 to force it to detect the same warnings 4.3 does by default.
For 4.3 I'd managed to get such list of warnings using gcc -Q --help=warnings | grep enabled
, but 3.3 doesn't seems to provide such function. Does anybody know, how it can be done in any other way? Maybe the source file that defines warning states?
Regards, Marvin
You can't. Turning on everything would include -Wdouble-promotion which is only relevant on CPUs with a 32-bit single-precision floating-point unit which implements float in hardware, but emulates double in software. Doing calculations as double would use the software emulation and be slower.
-Werror= Make the specified warning into an error. The specifier for a warning is appended; for example -Werror=switch turns the warnings controlled by -Wswitch into errors.
You can use a #pragma warning directive to control the level of warning that's reported at compile time in specific source files. Warning pragma directives in source code are unaffected by the /w option.
The "-Werror" compiler flag treats all warnings as build errors. By promoting all warnings to errors, it enforces the developers to ensure such build warnings that may otherwise go unnoticed or only loosely concerned about by developers to now treat it with priority given that it will interrupt the build process.
GCC command line options are usually defined in gcc/common.opt file. Try searching for `Warning' keyword in this file.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With