Code Yarns ‍👨‍💻
Tech BlogPersonal Blog

Warning options of GCC

📅 2014-Oct-24 ⬩ ✍️ Ashwin Nanjappa ⬩ 🏷️ gcc, warning ⬩ 📚 Archive

The GCC and G++ compilers have many warning options that can be useful to improve the quality of your code. All the warning options are listed and described here.

Since the list of warnings is very long, GCC provides a few warning options that are a shortcut for enabling a larger bunch of warnings. These warning options are -Wall, -Wextra and -Wpedantic.

-Wall and -Wextra

The warnings enabled by -Wall and -Wextra is listed along with their description.


A list of warnings enabled by -Wpedantic is not provided in the documentation. I went through the individual warning descriptions and found the warning options enabled by -Wpedantic:

Warning options enabled by -Wpedantic:


Warnings not in -Wall, -Wextra or -Wpedantic

It can very useful to know which of the warning options are not enabled by -Wall, -Wextra and -Wpedantic. These are the options that might be useful for debugging or improving particular problems with your code. Again, I went through the individual warning descriptions and here they are:

Warning options not included by -Wall, -Wextra and -Wpedantic:


Note that I have not included the warning options that disable certain types of warning messages.

Warnings I use

Finally, here is the list of warnings that I like to compile with: