__GXX_ABI_VERSION

Hi,

GCC defines a macro __GXX_ABI_VERSION which, as was recently explained to me [1],
is governed by the flag -fabi-version [2].

The latest version of GCC defines the macro (without an explicit -fabi-version flag) as
1008, which corresponds to what is described as "Version 8" on that page.

Clang defines the macro as 1002, and does not seem to support the -fabi-version
option (tested with clang 3.6).

Does this mean that clang currently implements the "Version 2" ABI described on
that page? If so, are there plans to implement the later versions?

I ask because some libraries, such as wxWidgets, check this macro to ensure that
a build of the library and an application using the library are ABI-compatible, and
right now that mechanism deems the latest versions of gcc and clang incompatible.

Thanks,
Nate

[1] https://gcc.gnu.org/ml/gcc-help/2015-06/msg00090.html
[2] https://gcc.gnu.org/onlinedocs/gcc/C_002b_002b-Dialect-Options.html

Clang doesn’t have a notion of any C++ ABI version. We make bugfixes all the time and mostly just pray it only affects non-extern template instantiations. =/

We can certainly wire up -fabi-version to control the __GXX_ABI_VERSION macro if you like, and then it will pass the compatibility test. At the end of the day, though, the only way to ensure that any version of clang and gcc are ABI compatible is to test it.