This page was produced by an automated import process, and may have formatting errors; feel free to fix.
With few exceptions, developers should avoid the configuration option ‘--disable-werror’ when building GDB. The exceptions are listed in the file gdb/MAINTAINERS. The default, when building with GCC, is ‘--enable-werror’.
This option causes GDB (when built using GCC) to be compiled with a carefully selected list of compiler warning flags. Any warnings from those flags are treated as errors.
The current list of warning flags includes:
Recommended GCC warnings.
GCC 3.x (and later) and C99 allow declarations mixed with code, but GCC 2.x and C89 do not.
Non-literal format strings, with a few exceptions, are bugs - they might contain unintended user-supplied format specifiers. Since GDB uses the format printf attribute on all printf like functions this checks not just printf calls but also calls to functions such as fprintf_unfiltered.
This helps make sure GDB code uses gdb_byte which is really unsigned char for raw bytes instead of char, whose signedness is host-dependent. GCC enables this with -Wall since version 4.0. We enable it explicitly too to be decoupled from future GCC (or other compiler)’s defaults.
Due to the way that GDB is implemented many functions have unused parameters. Consequently this warning is avoided. The macro ATTRIBUTE_UNUSED is not used as it leads to false negatives — it is not an error to have ATTRIBUTE_UNUSED on a parameter that is being used.
-Wno-unused -Wno-switch -Wno-char-subscripts
These are warnings which might be useful for GDB, but are currently too noisy to enable with ‘-Werror’.