With GCC one is able to print out the specific flags that -march=native
triggers. Is it possible to have Clang print similar information?
In the end, Apple chose to develop Clang, a new compiler front end that supports C, Objective-C and C++. In July 2007, the project received the approval for becoming open-source.
Clang supports use of either LLVM's libc++ or GCC's libstdc++ implementation of the C++ standard library.
When Clang compiles C++ code for Windows, it attempts to be compatible with MSVC. There are multiple dimensions to compatibility. First, Clang attempts to be ABI-compatible, meaning that Clang-compiled code should be able to link against MSVC-compiled code successfully.
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.
My vision is to demystify clang optimization flags so that you’ll be able to make best use of them and use different Clang optimization flags. The post would use Clang in Windows environment (yes, Clang supports Windows compilations as mentioned in my previous blogs mentioned above).
Clang’s implementation of this attribute is compatible with GCC’s, documented here. While it is possible to use this attribute to name a special symbol used internally by the compiler, such as an LLVM intrinsic, this is neither recommended nor supported and may cause the compiler to crash or miscompile.
When passing the -Wunused flag to Clang, entities that are unused by the program may be diagnosed. The [ [maybe_unused]] (or __attribute__ ( (unused))) attribute can be used to silence such diagnostics when the entity cannot be removed.
Clang supports several different calling conventions, depending on the target platform and architecture. The calling convention used for a function determines how parameters are passed, how results are returned to the caller, and other low-level details of calling a function.
Instead of using the (non-existent in clang) -help=target
flag, you can use echo | clang -E - -march=native -###
to print out the compilation command. While this doesn't list the non-triggered flags and it's not pretty, it does list all the enabled flags.
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