www.delorie.com/gnu/docs/gdb/gdbint_111.html   search  
 
Buy the book!


GDB Internals

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

13.4.3 Compiler Warnings

With few exceptions, developers should include the configuration option `--enable-gdb-build-warnings=,-Werror' when building GDB. The exceptions are listed in the file `gdb/MAINTAINERS'.

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 being treated as errors.

The current list of warning flags includes:

`-Wimplicit'
Since GDB coding standard requires all functions to be declared using a prototype, the flag has the side effect of ensuring that prototyped functions are always visible with out resorting to `-Wstrict-prototypes'.

`-Wreturn-type'
Such code often appears to work except on instruction set architectures that use register windows.

`-Wcomment'

`-Wtrigraphs'

`-Wformat'
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.

`-Wparentheses'
This warning includes uses of the assignment operator within an if statement.

`-Wpointer-arith'

`-Wuninitialized'

Pragmatics: Due to the way that GDB is implemented most functions have unused parameters. Consequently the warning `-Wunused-parameter' is precluded from the list. 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. The options `-Wall' and `-Wunused' are also precluded because they both include `-Wunused-parameter'.

Pragmatics: GDB has not simply accepted the warnings enabled by `-Wall -Werror -W...'. Instead it is selecting warnings when and where their benefits can be demonstrated.


  webmaster   donations   bookstore     delorie software   privacy  
  Copyright © 2003   by The Free Software Foundation     Updated Jun 2003