diff --git a/content/post/20220301-gcc-flags/index.md b/content/post/20220301-gcc-flags/index.md index ca9bb63..7d592c0 100644 --- a/content/post/20220301-gcc-flags/index.md +++ b/content/post/20220301-gcc-flags/index.md @@ -40,7 +40,18 @@ categories = [] +++ -The summaries are taken from https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html +C++ is hard; make it a little bit easier. +The summaries are taken from https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html. + +The effectiveness of some of these options depends on various optmization passes. +You may also be able to selectively disable warnings for certain chunks of code (https://gcc.gnu.org/onlinedocs/gcc/Diagnostic-Pragmas.html) + +```c++ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wuninitialized" + foo(b); /* no diagnostic for this one */ +#pragma GCC diagnostic pop +``` * `-Wall`: turns on many warnings, but not "all." * `-Wextra`: turns on even more warnings, but still not all.