Re-enable symbols visibility support for the Clang compiler

Visibility support for Clang was disabled in 7198c33 because of linking
errors when building shared libraries, related to non-inline methods in
exported template classes.

The last Clang version to have these problems is version "4.1
(tags/Apple/clang-421.11.66)" as part of Xcode 4.5.2, and the next
release fixes them (version "4.2 (clang-425.0.24)", Xcode 4.6). Check
for the Clang version and only disable visibility support when compiling
with Apple Clang < 4.2.

Note that Apple Clang 4.2 is based on official Clang 3.2 so also check
for that version in case of non-Apple builds. The only official Clang
that has been tested successfully is 3.4 which worked fine with
visibility. Other versions that were tried (3.1 and 3.2) segfault while
compiling wx.
This commit is contained in:
Dimitri Schoolwerth
2015-05-31 03:08:17 +04:00
parent c76c79a238
commit 7cacde3b84
2 changed files with 32 additions and 6 deletions

View File

@@ -49,9 +49,22 @@ AC_DEFUN([WX_VISIBILITY],
error this platform has no visibility;
#endif
/* at the time of Xcode 4.1 / Clang 3, Clang++ still didn't have the bugs sorted out: */
#if defined(__clang__)
clang compiler is still broken w.r.t. visibility;
/* At the time of Xcode 4.1 / Clang 3, Clang++ still didn't
have the bugs sorted out. These were fixed starting with
Xcode 4.6.0 / Apple Clang 4.2 (which is based on Clang 3.2 so
check for that version too). */
#ifdef __clang__
#ifdef __APPLE__
#if __clang_major__ < 4 \
|| (__clang_major__ == 4 && __clang_minor__ < 2)
error Clang compiler version < 4.2 is broken w.r.t. visibility;
#endif
#else
#if __clang_major__ < 3 \
|| (__clang_major__ == 3 && __clang_minor__ < 2)
error Clang compiler version < 3.2 is broken w.r.t. visibility;
#endif
#endif
#endif
extern __attribute__((__visibility__("hidden"))) int hiddenvar;

19
configure vendored
View File

@@ -28921,9 +28921,22 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
error this platform has no visibility;
#endif
/* at the time of Xcode 4.1 / Clang 3, Clang++ still didn't have the bugs sorted out: */
#if defined(__clang__)
clang compiler is still broken w.r.t. visibility;
/* At the time of Xcode 4.1 / Clang 3, Clang++ still didn't
have the bugs sorted out. These were fixed starting with
Xcode 4.6.0 / Apple Clang 4.2 (which is based on Clang 3.2 so
check for that version too). */
#ifdef __clang__
#ifdef __APPLE__
#if __clang_major__ < 4 \
|| (__clang_major__ == 4 && __clang_minor__ < 2)
error Clang compiler version < 4.2 is broken w.r.t. visibility;
#endif
#else
#if __clang_major__ < 3 \
|| (__clang_major__ == 3 && __clang_minor__ < 2)
error Clang compiler version < 3.2 is broken w.r.t. visibility;
#endif
#endif
#endif
extern __attribute__((__visibility__("hidden"))) int hiddenvar;