C++ wxWidgets Linux Win32 OS X Autoconf Bakefile Boost GCC GNU IMAP MSVC Perl Python SMTP STL TCP/IP Threads Unix ZSH

GCC Warnings Tools

Overview

show-gcc-warnings is a script which can extract information about all warnings supported by gcc in a convenient form, in order to know when support for each warning has been added or whether the given warning is already enabled by some other option (such as -Wall or -Wextra) or needs to be explicitly enabled.

Here is an example of using it:

$ ./show-gcc-warnings --cpp /path/to/gcc/repository > warnings.cpp

Here are the results generated by this script:

Download

The script is available from gcc-warnings-tools GitHub repository and there is no installation required but you must have a working Raku installation, see the requirements section below.

Requirements

You need a working installation of Raku and a Git checkout of gcc repository (which takes ~5GiB as of time of this writing, i.e. gcc 11).

Usage Instructions

Run ./show-gcc-warnings $GCC_DIR > warnings.csv to generate the CSV file containing all warnings not enabled by default or by one of the common warning options and the minimum version in which they appeared (note that 4.6.0 means that the warning was already present in gcc 4.6.0, not necessarily that it was introduced in this version). With --all option, all warnings are included and the extra "Enabled by" column is added to show the condition enabling the warning.

If JSON::Fast Raku module is available, specify --json option to obtain output in JSON format.

Alternatively, use --cpp option to generate C++ fragment, which can be included in the source of a program that needs to do something (e.g. turn on) all the warnings.

Finally, --markdown option can be used to generate a Markdown table with the options.

If --dump-all-to option is given, output files named x.y.z for all gcc releases since 4.6.0 containing all (not enabled by default) warnings available in the given compiler version will be created under the specified output directory $OUT_DIR. The existing files in this directory will not be overwritten. Further specifying --only-version=x.y.z[,x2.y2.z2...] will restrict the output to the specified version(s) only. These files can be used on their own, and can also be reused by specifing --read-from option with the same directory later when running in the default mode.

The helper dump-gcc-warnings script can be used to produce more detailed output, including the warnings enabled by default, if --all option is specified, for a particular gcc version, by passing it common.opt and c-family/c.opt files from gcc source tree as command line parameters.

Note that, for convenience, output of the scripts for all gcc versions up to the latest tested one (currently 10.2) are provided directly in this repository, see warnings.{cpp,csv,json} files and gcc and gcc-all directories, containing per-directory warnings lists.

License

This script is Free Software released under BSD license.

July 7, 2022
wxWidgets 3.2, the latest stable release of wxWidgets, in development since several years, is finally available.
September 1, 2020
New gcc-warnings-tools script for C/C++ programmers for showing information about all the available warning options.
June 23, 2015
Release of where-included: a new tool for C/C++ programmers for finding the header file dependencies.
July 28, 2014
A new release of Bakefile, a makefile generator tool, is now available.
August 22, 2013
Added apache-splice-logs tool page.
March 31, 2013
Added new svn-to-git migration article.
August 6, 2012
Minor mladmin update: fix the script to work with recent Perl versions.
July 25, 2012
New diff-pdf tool description added.
April 27, 2012
wxWidgets training course proposed by TT-Solutions has been updated to cover version 3.0, please see training page for more information including the plan and some examples.
December 5, 2011
Another new script to help dealing with removing #pragma once from your code if needed.