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-18 table. Those keywords not discussed elsewhere are detailed below.

Table 5-18. Pragma Directives
DirectiveMeaningExample
addrqualSpecify action of qualifiers.#pragma addrqual require
configSpecify configuration bits.#pragma config WDT=ON
inlineInline function if possible.#pragma inline(getPort)
intrinsicSpecify function is inline.#pragma intrinsic(_delay)
interrupt_levelAllow call from interrupt and main-line code.#pragma interrupt_level 1
packSpecify structure packing.#pragma pack 1
printf_checkEnable printf-style format string checking.#pragma printf_check(printf) const
psectRename compiler-generated psect.#pragma psect nvBANK0=my_nvram
regsusedSpecify registers used by function.#pragma regsused myFunc wreg,fsr
switchSpecify code generation for switch statements.#pragma switch direct
warningControl messaging parameters.#pragma warning disable 299,407