# 9.3. Compiler Warnungen

Im folgenden werden die möglichen Einstellungen für die Compiler-Warnungen des Projekt-Optionen Dialogs, Seite 3, erläutert. Die Erklärungen selbst sind der `man`-page des GCC, egcs Version 1.1.1 entnommen. Die Warnungen selbst sind diagnostische Meldungen, die anzeigen, das die entsprechenden Programmanweisungen möglicherweise Fehler verursachen.

-Wall

  Standard-Warnungen kombiniert

-W

  Compiliere mit -W. Diese Einstellung fügt Warnungen hinzu, die nicht in -Wall enthalten sind. Bitte lesen Sie die GCC-Info für weitere Informationen.

-Wtraditional

  Warnungen über bestimmte Konstruktionen ausgeben, die sich unter traditionellem und ANSI C verschieden verhalten.

-Wundef

  Warnung anzeigen, falls ein undefinierter Bezeichner in einer '#if' Direktive verwendet wird

-Wshadow

  Warnung anzeigen, falls eine lokale Variable eine andere lokale Variable überdeckt.

-Wid-clash-LEN

  Warnung anzeigen, falls zwei verschieden Bezeichner in den ersten LEN Buchstaben übereinstimmen. Dies kann bei der Übersetzung eines Programms mit einigen nicht mehr zu verwendenden Compilern helfen.

-Wlarger-then-LEN

  Warnung anzeigen, falls ein Objekt mit einer Größe über LEN Bytes definiert wird.

-Wpointer-arith

  Warn about anything that depends on the «size of» a function type or of void. GNU C assigns these types a size of 1, for convenience in calculations with void * pointers and pointers to functions.

-Wbad-function-cast

  Warn whenever a function call is cast to a non-matching type. Forexample, warn if `int malloc()` is cast to `anything *.`

-Wcast-equal

  Warn whenever a pointer is cast so as to remove a type qualifier from the target type. For example, warn if a const char * is cast to an ordinary char *.

-Wcast-align

  Warn whenever a pointer is cast such that the required alignment of the target is increased. For example, warn if a char * is cast to an int * on machines where integers can only be accessed at two- or four-byte boundaries.

-Wwrite-strings

  Give string constants the type const char[length] so that copying the address of one into a non-const char * pointer will get a warning. These warnings will help you find at compile time code that can try to write into a string constant, but only if you have been very careful about using const in declarations and prototypes. Otherwise, it will just be a nuisance; this is why we did not make `-Wall' request these warnings.

-Wconversion

  Warn if a prototype causes a type conversion that is different from what would happen to the same argument in the absence of a prototype. This includes conversions of fixed point to floating and vice versa, and conversions changing the width or signedness of a fixed point argument except when the same as the default promotion.

-Wsign-compare

  Warn when a comparison between signed and unsigned values could produce an incorrect result when the signed value is converted to unsigned.

-Waggregate-return

  Warn if any functions that return structures or unions are defined or called. (In languages where you can return an array, this also elicits a warning.)

-Wmissing-prototypes

  Warn if a global function is defined without a previous prototype declaration. This warning is issued even if the definition itself provides a prototype. The aim is to detect global functions that fail to be declared in header files.

-Wmissing-declarations

  Warn if a global function is defined without a previous declaration. Do so even if the definition itself provides a prototype. Use this option to detect global functions that are not declared in header files. -Wredundant-decls Warn if anything is declared more than once in the same scope, even in cases where multiple declaration is valid and changes nothing.

-Wredundant-decls

  Warn if anything is declared more than once in the same scope even in cases where multiple declaration is valid and changes nothing.

-Wnested-externs

  Warn if an extern declaration is encountered within an function.

-Winline

  Warn if a function can not be inlined, and either it was declared as inline, or else the -fin*line-functions option was given.

-Wold-style-cast

  Warn if an old-style (C-style) cast is used within a program

-Woverloaded-virtual

  (C++ only.) In a derived class, the definitions of virtual functions must match the type signature of a virtual function declared in the base class. Use this option to request warnings when a derived class declares a function that may be an erroneous attempt to define a virtual function: that is, warn when a function with the same name as a virtual function in the base class, but with a type signature that doesn't match any virtual functions from the base class.

-Wsynth

  Warn when g++'s synthesis behavoir does not match that of cfront.

make all warnings into errors

  (-Werror) Treat warnings as errors; abort compilation after any warning.

For a release of your project, it is recommended to enable -Wall.