Menu

Base file macro

Cyder

Base File Macro

Config: TPP_CONFIG_HAVE___BASE_FILE__
Check: #if defined(__BASE_FILE__)
Function: tpp.c: TPPLexer_Next
Known supporting compilers: vc, gcc, clang

A builtin macro, that expands to and integral constant similar to __FILE__, but instead of yielding the current file, it will yield the first file, that in some way included the current file.
Hint: __BASE_FILE__ is returned as a normal string token, thus allowing it to be used for string concantation.

// Print the first source file
printf("BaseFile = %s\n",__BASE_FILE__);

#undef __BASE_FILE__ // Can't undef __FILE__
#ifdef __BASE_FILE__
// This block will still be enabled
#endif

s.a. [File macro]
s.a. [Conditional directives]
s.a. [Macros]


Related

Wiki: Conditional directives
Wiki: File macro
Wiki: Macros