Pragma
Function: tpp.c: TPPLexer_ParsePragma
The c11 standard describes a directive #pragma and builtin macro _Pragma, that can be used to perform compiler-specific function.
TPP Implements both the directive and the builtin macro, while also providing a set of builtin pragmas commonly seens in other preprocessors.
Unknown pragmas are re-emitted by TPPLexer_Next:
Config: TPP_CONFIG_REEMIT_UNKNOWN_PRAGMAS
Check: #if __has_feature(tpp_reemit_unknown_pragmas) || __has_extension(tpp_reemit_unknown_pragmas)
Every pragma can be written with the #pragma directive of the _Pragma macro:
// The following 2 lines will be processed as identical.
_Pragma("once")
#pragma once
The following example shows the push_macro pragma:
#define foobar 42
#pragma push_macro("foobar")
#undef foobar
foobar // Expands to [foobar]
#pragma pop_macro("foobar")
foobar // Expands to [42]
Supported pragmas:
#pragma once#pragma warning#pragma message#pragma push_macro#pragma region#pragma deprecated#pragma error#pragma tpp_exec