We need to have a more principled method to detect the C++ ABI we are
targeting. Add a heuristic to determine that and pass it to the build.
Details
- Reviewers
mclow.lists EricWF kastiglione smeenai
Diff Detail
- Repository
- rL LLVM
Event Timeline
You can have scenarios where you're targeting the Itanium ABI but still have _MSC_VER defined, e.g.
% clang -target i686-windows-itanium -fmsc-version=1900 -E -dM - < /dev/null | grep _MSC_VER #define _MSC_VER 1900
It might also be nice for clang to define some macro to indicate which C++ ABI is in use.
All that said, I think it makes sense to encode this in libc++ include/__config_site because you don't want people to build libc++ for the MS ABI and then try to use it with a mingw triple. It'd be nice if we could diagnose that at compile time instead of link time.
@rnk happy to add such a macro. Would __cpp_abi_itanium and __cpp_abi_microsoft be palatable?
This actually does get encoded into __config albeit in a round-about way. The __config_site gets concatenated with __config into __generated_config which is installed as __config.
I would love these macros. I would prefer if the stock __config worked for all but the rarest of configurations.