
CAVR-4
Part 2. Compiler reference
215
Pragma directives
This chapter describes the pragma directives of the AVR IAR C/C++ Compiler.
The pragma directives control the behavior of the compiler, for example how
it allocates memory, whether it allows extended keywords, and whether it
outputs warning messages. The pragma directives are preprocessed, which
means that macros are substituted in a pragma directive.
The pragma directives are always enabled in the compiler. They are consistent
with ISO/ANSI C and are very useful when you want to make sure that the
source code is portable.
Summary of pragma directives
The following table shows the pragma directives of the compiler:
Pragma directive Description
#pragma
basic_template_matching
Makes a template function fully memory-aware
#pragma bitfields Controls the order of bitfield members
#pragma constseg Places constant variables in a named segment
#pragma data_alignment Gives a variable a higher (more strict) alignment
#pragma dataseg Places variables in a named segment
#pragma diag_default Changes the severity level of diagnostic messages
#pragma diag_error Changes the severity level of diagnostic messages
#pragma diag_remark Changes the severity level of diagnostic messages
#pragma diag_suppress Suppresses diagnostic messages
#pragma diag_warning Changes the severity level of diagnostic messages
#pragma include_alias Specifies an alias for an include file
#pragma inline Inlines a function
#pragma language Controls the IAR language extensions
#pragma location Specifies the absolute address of a variable
#pragma message Prints a message
Table 69: Pragma directives summary