]> granicus.if.org Git - gc/commitdiff
Fix 'visibility attribute not supported' GCC warning (IBM AIX)
authorIvan Maidanski <ivmai@mail.ru>
Wed, 2 Sep 2015 08:52:30 +0000 (11:52 +0300)
committerIvan Maidanski <ivmai@mail.ru>
Wed, 2 Sep 2015 08:52:30 +0000 (11:52 +0300)
* 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.

configure.ac
include/cord.h
include/gc_config_macros.h
include/private/gc_priv.h

index 414edc7d6b021c033d1e2374368a0e20b7e9a9a9..a72787a47d6479a0deab772a4a7ad1bf19a0c4da 100644 (file)
@@ -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
index d3d555b6b970c72acab5d87366db22c04eb385c0..f414a916fa84fb18b5eb33cd95e93358ffc6b79d 100644 (file)
@@ -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
index b5898cb492e033e0d01ced193531673d3cdf9ebe..e9671294d98f4dd2ef1458c41f37ef4f7b8d30ce 100644 (file)
 
 # 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
index ed9fc566084953d5445aa5f140cb12dd873d458c..2102d6273bb093bdaca39220776ba8d121bef861 100644 (file)
@@ -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