Summary of pragma directives
The #pragma directive is defined by Standard C and is a mechanism for using vendor-specific extensions in a controlled way to make sure that the source code is still portable.
The pragma directives control the behavior of the compiler, for example, how it allocates memory for variables and functions, whether it allows extended keywords, and whether it outputs warning messages.
The pragma directives are always enabled in the compiler.
This table lists the pragma directives of the compiler that can be used either with the #pragma preprocessor directive or the _Pragma() preprocessor operator:
Pragma directive | Description |
|---|---|
Controls the order of bitfield members. | |
Lists possible called functions for indirect calls. | |
Specifies that the function is a call graph root. | |
| See the C-STAT® Static Analysis Guide. |
| See the C-STAT® Static Analysis Guide. |
| See the C-STAT® Static Analysis Guide. |
| See the C-STAT® Static Analysis Guide. |
Gives a variable a higher (more strict) alignment. | |
Sets default type and object attributes for declarations and definitions of functions. | |
| Applies |
Sets default type and object attributes for declarations and definitions of variables. | |
| Instruments a function to track pointer bounds. See #pragma define_with_bounds. |
| Defines the version of a function that does not have extra bounds information. See #pragma define_without_bounds. |
Marks an entity as deprecated. | |
Changes the severity level of diagnostic messages. | |
Changes the severity level of diagnostic messages. | |
Changes the severity level of diagnostic messages. | |
Suppresses diagnostic messages. | |
Changes the severity level of diagnostic messages. | |
| Specifies that the immediately following function does not check accesses against bounds. See #pragma disable_check. |
Signals an error while parsing. | |
Declares function categories for stack usage analysis. | |
| Enables generation of an extra entry without bounds for the immediately following function. See #pragma generate_entry_without_bounds. |
Specifies an alias for an include file. | |
Controls inlining of a function. | |
Controls the IAR language extensions. | |
Specifies the absolute address of a variable, places a variable in a register, or places groups of functions or variables in named sections. | |
Prints a message. | |
| Specifies that no C-RUN arithmetic checks will be performed in the following function. See #pragma no_arith_checks. |
| Specifies that the immediately following function or variable is not instrumented for bounds checking. See #pragma no_bounds. |
Disables stack protection for the following function. | |
Adds object attributes to the declaration or definition of a variable or function. | |
Prevents a header file from being processed more than once. | |
Specifies the type and level of an optimization. | |
Specifies the alignment of structures and union members. | |
Verifies that a function with a printf-style format string is called with the correct arguments. | |
Defines a public assembler label and gives it a value. | |
Ensures that a symbol that is needed by another symbol is included in the linked output. | |
Adds a runtime model attribute to the module. | |
Verifies that a function with a scanf-style format string is called with the correct arguments. | |
Declares a section name to be used by intrinsic functions. | |
| This directive is an alias for #pragma section. |
Adds a prefix to the names of sections. | |
Forces stack protection for the function that follows. | |
Specifies whether the compiler can use normal complex mathematical formulas or not. | |
Specifies whether your source code accesses the floating-point environment or not. | |
Specifies whether the compiler is allowed to contract floating-point expressions or not. | |
Sets the interrupt number of a software interrupt (32-bit mode) or exception (64-bit mode). | |
Adds type attributes to a declaration or to definitions. | |
Unrolls loops. | |
Enables or disables generation of NEON vector instructions for a loop. | |
Makes a definition a weak definition, or creates a weak alias for a function or a variable. |
Note
For portability reasons, see also Recognized pragma directives (6.10.6).