6

I can get list of Clang's compiler predefined macros with the following command in Terminal. (Reference)

clang -dM -E -x c /dev/null

However, this list doesn't contain Standard Predefined Macros, such as __FILE__, __LINE__, __FUNCTION__, etc. (GCC version's list)

  • Q1. Is it possible to get the list of standard predefined macros in Clang in Terminal?

  • Q2. If not, is there any complete list of standard predefined macros in Clang's documentation or something online?

My environment is macOS Sierra Version 10.12.1 (16B2555), Clang Apple LLVM version 8.0.0 (clang-800.0.42.1)

Keita
  • 1,478
  • 2
  • 14
  • 18
  • 2
    Maybe it is because those don't really have values until you're processing a non-empty file. That's speculation, but `__func__` isn't a preprocessor object, and I could believe the same of `__FUNCTION__` for the same reason — the preprocessor doesn't know what a function is. The value of `__LINE__` is undefined until the preprocessor is processing a line. The value of `__FILE__` might only be set when `__LINE__` is set. That said, it also misses out `__DATE__` and `__TIME__`. But that's mostly guesswork, which is a main reason it is a comment, not an answer. – Jonathan Leffler Dec 09 '16 at 06:09

0 Answers0