The GNU Compiler Collection (GCC) is a compiler system produced by the GNU Project.
When you invoke GCC, it normally does preprocessing, compilation, assembly and linking. The “overall options” allow you to stop this process at an intermediate stage.
This post is about some handy GCC command line options, that you may find useful.
Look at the code after preprocessor. (The #defines relacements? 🙂 )
This makes all warnings into hard errors. Source code which triggers warnings will be rejected.
This checks the code for syntax errors, but don’t do anything beyond that.
This makes a specified warning into an error.
This option causes the compiler to abort compilation on the first error occurred rather than trying to keep going and printing further error messages.
This enables all the warnings about constructions that some users consider questionable, and that are easy to avoid (or modify to prevent the warning), even in conjunction with macros.
This enables some extra warning flags that are not enabled by -Wall.
This warns about passing a null pointer for arguments marked as requiring a non-null value by the nonnull function attribute.
This enables UndefinedBehaviorSanitizer, a fast undefined behavior detector.
This considers all functions for inlining, even if they are not declared inline. The compiler heuristically decides which functions are worth integrating in this way.
This is to, not predefine any system-specific or GCC-specific macros. The standard predefined macros remain defined.
Through this option, the char type is treated as unsigned type.
This is to provide verbose information on all the steps gcc takes while compiling a source file.
This is to use the same size for double and float.
I’ll add as I use more.
A big list is here.