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. | |
Sets default type and object attributes for declarations and definitions of variables. | |
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. | |
Controls the generation of prologue and epilogue code in functions. | |
Signals an error while parsing. | |
Declares function categories for stack usage analysis. | |
Specifies an alias for an include file. | |
Controls inlining of a function. | |
Controls the IAR language extensions. | |
Specifies the absolute address of a variable, or places groups of functions or variables in named sections. | |
Prints a message. | |
| This directive is an alias for |
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. | |
Saves additional CSR registers for | |
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. |
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. | |
Adds type attributes to a declaration or to definitions. | |
Unrolls loops. | |
Specifies the vector of an interrupt function. | |
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).