A.3. Preprocessor statements

This section describes the supported preprocessor statements and their LISA+ semantics. All statements have same syntax and semantics as the corresponding C preprocessor statements.

#define

Define a macro. Macros can have arguments. Converting to strings (# operator) and concatenating (## operator) is supported. The macro is defined in all LISA+ source in the same file that follows the #define statement unless it is explicitly #undefined.

Macros can be redefined several times without warning if the redefinition is identical. Macro expansion is disabled in LISA+ top-level code. See Scope. Macros defined on the LISA+ top-level do not affect conditional statements in the includes and resources section.

#undef

Undefine a macro. The macro is undefined in all LISA+ code in the same file that follows this statement. It is not an error if the macro was not defined before this statement.

#if #elif #else #endif

The code enclosed by #if, #elif, #else, or #endif blocks is enabled or disabled depending on the value of the expression following the #if and #elif statements. If the expression evaluates to 0 the code is disabled, for all other values the code is enabled.

Undefined identifiers in the expression have a numerical value of 0. The expression defined(SYM) evaluates to 1 if the preprocessor symbol SYM is defined or 0 if it is not defined.

#ifdef #ifndef

These statements are a shortcut for the #if defined(SYM) and #if !defined(SYM) statements respectively.

#include

Include statements are ignored by the preprocessor. See Scope. However, #include statements in the includes sections of components have the desired effect of making the declarations in the header files visible in the behavior code.

#error

The error message that follows the #error statement is printed. Processing of the LISA+ code by the tool is unsuccessful and the tool performs as if an error has occurred.

#warning

The warning message that follows the #warning statement is printed. Processing of the LISA+ code by the tool is successful and the tool performs as normal.

Copyright © 2007-2009 ARM Limited. All rights reserved.ARM DUI 0372H
Non-Confidential