5.14.3 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 C Standard’s #pragma facility. The format of a pragma is:

#pragma directive options

where directive is one of a set of keywords, some of which are followed by options. A list of the keywords is given in the Table 5-17 table. Those keywords not discussed elsewhere are detailed below.

Table 5-17. 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-generated 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