Menu

Pragmas

Cyder

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:

  1. [Pragma once] #pragma once
  2. [Pragma warning] #pragma warning
  3. [Pragma message] #pragma message
  4. [Pragma push macro] #pragma push_macro
  5. [Pragma region] #pragma region
  6. [Pragma deprecated] #pragma deprecated
  7. [Pragma error] #pragma error
  8. [Pragma tpp_exec] #pragma tpp_exec

Related

Wiki: Pragma once

MongoDB Logo MongoDB