_Pragma preprocessing operator in C99

C90 does not permit a #pragma directive to be produced as the result of a macro expansion. However, the C99 _Pragma operator enables you to embed a preprocessor macro in a pragma directive, and _Pragma is permitted in C90 if --strict is not specified. For example:

# define RWDATA(X) PRAGMA(arm section rwdata=#X)
# define PRAGMA(X) _Pragma(#X)
RWDATA(foo)  // same as #pragma arm section rwdata="foo"
int y = 1;   // y is placed in section "foo"

Show/hideSee also

Copyright © 2010-2013 ARM. All rights reserved.ARM DUI 0472I
Non-ConfidentialID012213