Microchip Technology SW006022-2N Data Sheet
MPLAB
®
XC16 C Compiler User’s Guide
DS52071B-page 70
2012 Microchip Technology Inc.
3.7.5
Options for Debugging
The following options are used for debugging.
-Wsign-compare
-Wno-sign-compare
Warn when a comparison between signed and unsigned
values could produce an incorrect result when the signed
value is converted to unsigned. This warning is also enabled
by -W; to get the other warnings of -W without this warning,
use -W -Wno-sign-compare.
values could produce an incorrect result when the signed
value is converted to unsigned. This warning is also enabled
by -W; to get the other warnings of -W without this warning,
use -W -Wno-sign-compare.
-Wstrict-prototypes
Warn if a function is declared or defined without specifying the
argument types. (An old-style function definition is permitted
without a warning if preceded by a declaration which specifies
the argument types.)
argument types. (An old-style function definition is permitted
without a warning if preceded by a declaration which specifies
the argument types.)
-Wtraditional
Warn about certain constructs that behave differently in
traditional and ANSI C.
• Macro arguments occurring within string constants in the
traditional and ANSI C.
• Macro arguments occurring within string constants in the
macro body. These would substitute the argument in
traditional C, but are part of the constant in ANSI C.
traditional C, but are part of the constant in ANSI C.
• A function declared external in one block and then used
after the end of the block.
• A switch statement has an operand of type long.
• A nonstatic function declaration follows a static one. This
• A nonstatic function declaration follows a static one. This
construct is not accepted by some traditional C compilers.
-Wundef
Warn if an undefined identifier is evaluated in an #if
directive.
directive.
-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 you can try to write into a string
constant, but only if you have been very careful about using
const
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 you 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, which is why -Wall does not request these
warnings.
warnings.
TABLE 3-10:
DEBUGGING OPTIONS
Option
Definition
-g
Produce debugging information.
The compiler supports the use of -g with -O making it possible to debug opti-
mized code. The shortcuts taken by optimized code may occasionally pro-
duce surprising results:
• Some declared variables may not exist at all;
• Flow of control may briefly move unexpectedly;
• Some statements may not be executed because they compute constant
The compiler supports the use of -g with -O making it possible to debug opti-
mized code. The shortcuts taken by optimized code may occasionally pro-
duce surprising results:
• Some declared variables may not exist at all;
• Flow of control may briefly move unexpectedly;
• Some statements may not be executed because they compute constant
results or their values were already at hand;
• Some statements may execute in different places because they were
moved out of loops.
Nevertheless it proves possible to debug optimized output. This makes it
reasonable to use the optimizer for programs that might have bugs.
reasonable to use the optimizer for programs that might have bugs.
-Q
Makes the compiler print out each function name as it is compiled, and print
some statistics about each pass when it finishes.
some statistics about each pass when it finishes.
TABLE 3-9:
WARNING/ERROR OPTIONS NOT IMPLIED BY -WALL
Option
Definition