This page was produced by an automated import process, and may have formatting errors; feel free to fix.

Compiler Warnings

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.

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.

-Wpointer-sign

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.

-Wno-unused-parameter

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’.