If I want to find out what implicit preprocessor defines gcc gives me, I can type echo "" | cpp -dD
. Does anyone know what the equivalent for clang is?
By default, Clang builds C++ code according to the C++14 standard. You can use Clang in C++14 mode with the -std=c++14 option (use -std=c++1y in Clang 3.4 and earlier).
clang is a C, C++, and Objective-C compiler which encompasses preprocessing, parsing, optimization, code generation, assembly, and linking. Depending on which high-level mode setting is passed, Clang will stop before doing a full link.
The only difference between the two is that clang links against only the C standard library if it performs a link, whereas clang++ links against both the C++ and C standard libraries.
Clang is much faster and uses far less memory than GCC. Clang aims to provide extremely clear and concise diagnostics (error and warning messages), and includes support for expressive diagnostics. GCC's warnings are sometimes acceptable, but are often confusing and it does not support expressive diagnostics.
clang -dM -E - < /dev/null
will list all the preprocessor definitions for clang.
clang "dumping processor state" options are defined here. The option you are looking for is -dM
, so you'll run:
clang -dM -E -
To trigger execution, you then need to terminate the manual input:
Otherwise, directly execute:
clang -dM -E - < NUL
clang -dM -E - < /dev/null
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With