Microchip Technology XC8 Standard Compiler (Workstation) SW006021-1 SW006021-1 User Manual

Product codes
SW006021-1
Page of 518
MPLAB
®
 XC8 C Compiler User’s Guide
DS52053B-page 214
 2012 Microchip Technology Inc.
Each symbol, if defined, is equated to 1 unless otherwise stated.
5.14.4
Pragma Directives
There are certain compile-time directives that can be used to modify the behavior of the 
compiler. These are implemented through the use of the ANSI standard #pragma 
facility. The format of a pragma is:
#pragma keyword options
where keyword is one of a set of keywords, some of which are followed by certain 
options
. A list of the keywords is given in Table 5-13. Those keywords not discussed 
elsewhere are detailed below.
HI_TECH_C
Always
To indicate that the C language 
variety is HI-TECH C compatible.
MPLAB_ICD
If compiling for MPLAB
®
 ICD or 
MPLAB ICD 2/3 debugger
 Assigned 1 to indicate that the 
code is generated for use with the 
Microchip MPLAB ICD 1. 
Assigned 2 for MPLAB ICD 2; 3 
for MPLAB ICD 3.
TABLE 5-13:
PRAGMA DIRECTIVES
Directive
 Meaning
 Example
addrqual
Specify action of qualifiers
#pragma addrqual=require
config
Specify configuration bits
#pragma config WDT=ON
inline
Inline function if possible
#pragma inline(getPort)
intrinsic
Specify function is inline
#pragma intrinsic(_delay)
interrupt_level
Allow call from interrupt 
and main-line code
#pragma interrupt_level 1
pack
Specify structure packing
#pragma pack 1
printf_check
Enable printf-style format 
string checking
#pragma 
printf_check(printf) const
psect
Rename compiler-gener-
ated psect
#pragma psect 
nvBANK0=my_nvram
regsused
Specify registers used by 
function
#pragma regsused myFunc 
wreg,fsr
switch
Specify code generation for 
switch statements
#pragma switch direct
warning
Control messaging 
parameters
#pragma warning disable 
299,407
TABLE 5-12:
PREDEFINED MACROS (CONTINUED)
Symbol
 When set
 Usage