07.04.2013 Views

MPLAB C Compiler for PIC24 MCUs and dsPIC DSCs ... - Microchip

MPLAB C Compiler for PIC24 MCUs and dsPIC DSCs ... - Microchip

MPLAB C Compiler for PIC24 MCUs and dsPIC DSCs ... - Microchip

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Using the <strong>Compiler</strong> on the Comm<strong>and</strong> Line<br />

TABLE 3-6: WARNING/ERROR OPTIONS NOT IMPLIED BY -WALL<br />

Option Definition<br />

-Wsign-compare<br />

-Wno-sign-compare<br />

Warn when a comparison between signed <strong>and</strong> unsigned<br />

values could produce an incorrect result when the signed<br />

value is converted to unsigned. This warning is also enabled<br />

by -W; to get the other warnings of -W without this warning,<br />

use -W -Wno-sign-compare.<br />

-Wstrict-prototypes Warn if a function is declared or defined without specifying the<br />

argument types. (An old-style function definition is permitted<br />

without a warning if preceded by a declaration which specifies<br />

the argument types.)<br />

-Wtraditional Warn about certain constructs that behave differently in<br />

traditional <strong>and</strong> ANSI C.<br />

• Macro arguments occurring within string constants in the<br />

macro body. These would substitute the argument in<br />

traditional C, but are part of the constant in ANSI C.<br />

• A function declared external in one block <strong>and</strong> then used<br />

after the end of the block.<br />

• A switch statement has an oper<strong>and</strong> of type long.<br />

• A nonstatic function declaration follows a static one. This<br />

construct is not accepted by some traditional C compilers.<br />

-Wundef Warn if an undefined identifier is evaluated in an #if<br />

directive.<br />

-Wunreachable-code Warn if the compiler detects that code will never be executed.<br />

It is possible <strong>for</strong> this option to produce a warning even though<br />

there are circumstances under which part of the affected line<br />

can be executed, so care should be taken when removing<br />

apparently-unreachable code. For instance, when a function is<br />

inlined, a warning may mean that the line is unreachable in<br />

only one inlined copy of the function.<br />

-Wwrite-strings Give string constants the type const char[length] so that<br />

copying the address of one into a non-const char * pointer<br />

will get a warning. These warnings will help you find at<br />

compile time code that you can try to write into a string<br />

constant, but only if you have been very careful about using<br />

const in declarations <strong>and</strong> prototypes. Otherwise, it will just be<br />

a nuisance, which is why -Wall does not request these<br />

warnings.<br />

© 2008 <strong>Microchip</strong> Technology Inc. DS51284H-page 45

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!