From: Ivan Maidanski Date: Wed, 2 Sep 2015 08:52:30 +0000 (+0300) Subject: Fix 'visibility attribute not supported' GCC warning (IBM AIX) X-Git-Tag: gc7_6_0~150 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=60db5e97e8c61652f9b29b201832eaadd18f1dfc;p=gc Fix 'visibility attribute not supported' GCC warning (IBM AIX) * configure.ac (enable_shared): Add -D GC_NO_VISIBILITY to CFLAGS if not ac_cv_fvisibility_hidden. * include/cord.h (CORD_API): Do not use visibility attribute if GC_NO_VISIBILITY. * include/gc_config_macros.h (GC_API): Likewise. * include/private/gc_priv.h (GC_INNER, GC_API_OSCALL): Likewise. --- diff --git a/configure.ac b/configure.ac index 414edc7d..a72787a4 100644 --- a/configure.ac +++ b/configure.ac @@ -562,7 +562,8 @@ if test "${enable_shared}" = yes; then [ac_cv_fvisibility_hidden=no]) CFLAGS="$old_CFLAGS" AS_IF([test "$ac_cv_fvisibility_hidden" = yes], - [CFLAGS="-DGC_VISIBILITY_HIDDEN_SET -fvisibility=hidden $CFLAGS"]) + [CFLAGS="-DGC_VISIBILITY_HIDDEN_SET -fvisibility=hidden $CFLAGS"], + [CFLAGS="-DGC_NO_VISIBILITY $CFLAGS"]) AC_MSG_RESULT($ac_cv_fvisibility_hidden) fi fi diff --git a/include/cord.h b/include/cord.h index d3d555b6..f414a916 100644 --- a/include/cord.h +++ b/include/cord.h @@ -66,8 +66,8 @@ # elif defined(_MSC_VER) || defined(__DMC__) || defined(__BORLANDC__) \ || defined(__CYGWIN__) || defined(__WATCOMC__) # define CORD_API extern __declspec(dllexport) -# elif defined(__GNUC__) && (__GNUC__ >= 4 \ - || defined(GC_VISIBILITY_HIDDEN_SET)) +# elif defined(__GNUC__) && !defined(GC_NO_VISIBILITY) \ + && (__GNUC__ >= 4 || defined(GC_VISIBILITY_HIDDEN_SET)) /* Only matters if used in conjunction with -fvisibility=hidden option. */ # define CORD_API extern __attribute__((__visibility__("default"))) # endif diff --git a/include/gc_config_macros.h b/include/gc_config_macros.h index b5898cb4..e9671294 100644 --- a/include/gc_config_macros.h +++ b/include/gc_config_macros.h @@ -202,8 +202,8 @@ # elif defined(__GNUC__) /* Only matters if used in conjunction with -fvisibility=hidden option. */ -# if defined(GC_BUILD) && (__GNUC__ >= 4 \ - || defined(GC_VISIBILITY_HIDDEN_SET)) +# if defined(GC_BUILD) && !defined(GC_NO_VISIBILITY) \ + && (__GNUC__ >= 4 || defined(GC_VISIBILITY_HIDDEN_SET)) # define GC_API extern __attribute__((__visibility__("default"))) # endif # endif diff --git a/include/private/gc_priv.h b/include/private/gc_priv.h index ed9fc566..2102d627 100644 --- a/include/private/gc_priv.h +++ b/include/private/gc_priv.h @@ -109,7 +109,7 @@ typedef char * ptr_t; /* A generic pointer to which we can add */ /* located in the "extra" folder). */ # if defined(GC_DLL) && defined(__GNUC__) && !defined(MSWIN32) \ && !defined(MSWINCE) && !defined(CYGWIN32) -# if __GNUC__ >= 4 +# if (__GNUC__ >= 4) && !defined(GC_NO_VISIBILITY) /* See the corresponding GC_API definition. */ # define GC_INNER __attribute__((__visibility__("hidden"))) # else @@ -165,7 +165,7 @@ typedef char * ptr_t; /* A generic pointer to which we can add */ #ifndef GC_API_OSCALL /* This is used to identify GC routines called by name from OS. */ # if defined(__GNUC__) -# if __GNUC__ >= 4 +# if (__GNUC__ >= 4) && !defined(GC_NO_VISIBILITY) /* Same as GC_API if GC_DLL. */ # define GC_API_OSCALL extern __attribute__((__visibility__("default"))) # else