Skip to main content

IAR Embedded Workbench for RL78 5.20

Summary of pragma directives

In this section:

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 #pragmapreprocessor directive or the _Pragma() preprocessor operator:

Pragma directive

Description

bank

Specifies the register bank number of the immediately following interrupt function.

basic_template_matching

Makes a template function fully memory-attribute aware.

bitfields

Controls the order of bitfield members.

calls

Lists possible called functions for indirect calls.

call_graph_root

Specifies that the function is a call graph root.

constseg

Places constant variables in a named section.

cstat_disable

See the C-STAT® Static Analysis Guide.

cstat_enable

See the C-STAT® Static Analysis Guide.

cstat_restore

See the C-STAT® Static Analysis Guide.

cstat_suppress

See the C-STAT® Static Analysis Guide.

data_alignment

Gives a variable a higher (more strict) alignment.

dataseg

Places variables in a named section.

default_function_attributes

Sets default type and object attributes for declarations and definitions of functions.

default_variable_attributes

Sets default type and object attributes for declarations and definitions of variables.

deprecated

Marks an entity as deprecated.

diag_default

Changes the severity level of diagnostic messages.

diag_error

Changes the severity level of diagnostic messages.

diag_remark

Changes the severity level of diagnostic messages.

diag_suppress

Suppresses diagnostic messages.

diag_warning

Changes the severity level of diagnostic messages.

error

Signals an error while parsing.

function_category

Declares function categories for stack usage analysis.

include_alias

Specifies an alias for an include file.

inline

Controls inlining of a function.

language

Controls the IAR language extensions.

location

Specifies the absolute address of a variable, or places groups of functions or variables in named sections.

message

Prints a message.

no_stack_protect

Disables stack protection for the following function.

no_workseg

Specifies that the immediately following function does not use the workseg area.

object_attribute

Adds object attributes to the declaration or definition of a variable or function.

once

Prevents a header file from being processed more than once.

optimize

Specifies the type and level of an optimization.

pack

Specifies the alignment of structures and union members.

__printf_args

Verifies that a function with a printf-style format string is called with the correct arguments.

public_equ

Defines a public assembler label and gives it a value.

required

Ensures that a symbol that is needed by another symbol is included in the linked output.

rtmodel

Adds a runtime model attribute to the module.

__scanf_args

Verifies that a function with a scanf-style format string is called with the correct arguments.

section

Declares a section name to be used by intrinsic functions.

segment

This directive is an alias for #pragma section.

stack_protect

Forces stack protection for the function that follows.

STDC CX_LIMITED_RANGE

Specifies whether the compiler can use normal complex mathematical formulas or not.

STDC FENV_ACCESS

Specifies whether your source code accesses the floating-point environment or not.

STDC FP_CONTRACT

Specifies whether the compiler is allowed to contract floating-point expressions or not.

type_attribute

Adds type attributes to a declaration or to definitions.

unroll

Unrolls loops.

vector

Specifies the vector of an interrupt or trap function.

weak

Makes a definition a weak definition, or creates a weak alias for a function or a variable.

Table 81. Pragma directives summary 


Note

For portability reasons, see also Recognized pragma directives (6.10.6).