Developer Guide and Reference

Contents

Warnings, Errors, and Remarks

This topic describes compiler remarks, warnings, and errors. The compiler sends these messages, along with the erroneous source line, to stderr.

Warnings

Warning messages report legal but questionable use of C or C++. The compiler displays warnings by default. You can suppress warning messages by specifying an appropriate compiler option. Warnings do not stop translation or linking. Warnings do not interfere with any output files.
The following are some representative warning messages:
  • declaration does not declare anything
    .
  • pointless comparison of unsigned integer with zero
    .
  • possible use of = where == was intended
    .
Some warnings that start with
-W
can be disabled using the negative form of the option
-Wno-
; for example, option
-Wno-unknown-pragmas
disables option
-Wunknown-pragmas
.
Additional Warnings
The following Linux* and
macOS*
options produce additional warnings:
Option
Result
-W[no-]missing-prototypes
Warn for missing prototypes.
-W[no-]missing-declarations
Warn for missing declarations.
-W[no-]unused-variable
Warn for unused variable.
-W[no-]pointer-arith
Warn for questionable pointer arithmetic.