Microchip Technology SW006022-2N Data Sheet

Page of 338
MPLAB
®
 XC16 C Compiler User’s Guide
DS52071B-page 64
 2012 Microchip Technology Inc.
3.7.4
Options for Controlling Warnings and Errors
Warnings are diagnostic messages that report constructions that are not inherently 
erroneous but that are risky or suggest there may have been an error. 
You can request many specific warnings with options beginning -W, for example, 
-Wimplicit,
 to request warnings on implicit declarations. Each of these specific 
warning options also has a negative form beginning -Wno- to turn off warnings, for 
example, -Wno-implicit. This manual lists only one of the two forms, whichever is 
not the default.
The following options control the amount and kinds of warnings produced by the 
compiler. 
-fsigned-bitfields
-funsigned-bitfields
-fno-signed-bitfields
-fno-unsigned-bitfields
These options control whether a bit field is signed or 
unsigned, when the declaration does not use either signed 
or unsigned. By default, such a bit field is signed, unless 
-traditional
 is used, in which case bit fields are always 
unsigned.
-funsigned-char
Let the type char be unsigned, like unsigned char.
TABLE 3-8:
WARNING/ERROR OPTIONS IMPLIED BY -WALL
Option
Definition
-fsyntax-only
Check the code for syntax, but don’t do anything beyond that.
-pedantic
Issue all the warnings demanded by strict ANSI C; reject all 
programs that use forbidden extensions.
-pedantic-errors
Like -pedantic, except that errors are produced rather than 
warnings.
-w
Inhibit all warning messages.
-Wall
All of the -W options listed in this table combined. This enables 
all the warnings about constructions that some users consider 
questionable, and that are easy to avoid (or modify to prevent 
the warning), even in conjunction with macros.
-Wchar-subscripts
Warn if an array subscript has type char.
-Wcomment
-Wcomments
Warn whenever a comment-start sequence /* appears in a /* 
comment, or whenever a Backslash-Newline appears in a // 
comment.
-Wdiv-by-zero
Warn about compile-time integer division by zero. To inhibit the 
warning messages, use -Wno-div-by-zero. Floating point 
division by zero is not warned about, as it can be a legitimate 
way of obtaining infinities and NaNs.
(This is the default.)
-Werror-implicit-
 function-declaration
Give an error whenever a function is used before being 
declared.
-Wformat
Check calls to printf and scanf, etc., to make sure that the 
arguments supplied have types appropriate to the format string 
specified.
-Wimplicit
Equivalent to specifying both -Wimplicit-int and 
-Wimplicit-function-declaration
.
-Wimplicit-function-
 declaration
Give a warning whenever a function is used before being 
declared.
-Wimplicit-int
Warn when a declaration does not specify a type.
TABLE 3-7:
C DIALECT CONTROL OPTIONS (CONTINUED)
Option
Definition