[Mesa-dev] [PATCH] mapi: Add better visibility checks

Alexander von Gluck IV kallisti5 at unixzen.com
Sun Nov 17 10:11:41 PST 2013


* gl.h ensures gcc is 4.x or later before using
  hidden visibility. This change matches that behaviour
  and ensures better compatibility for older gcc versions.
---
 src/mapi/glapi/glapi.h |    2 +-
 src/mapi/u_compiler.h  |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/mapi/glapi/glapi.h b/src/mapi/glapi/glapi.h
index c764271..8e17dc7 100644
--- a/src/mapi/glapi/glapi.h
+++ b/src/mapi/glapi/glapi.h
@@ -61,7 +61,7 @@ extern "C" {
 #    else
 #      define _GLAPI_EXPORT __declspec(dllimport)
 #    endif
-#  elif defined(__GNUC__) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590))
+#  elif (defined(__GNUC__) && __GNUC__ >= 4) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590))
 #    define _GLAPI_EXPORT __attribute__((visibility("default")))
 #  else
 #    define _GLAPI_EXPORT
diff --git a/src/mapi/u_compiler.h b/src/mapi/u_compiler.h
index f376e97..66c961e 100644
--- a/src/mapi/u_compiler.h
+++ b/src/mapi/u_compiler.h
@@ -11,7 +11,7 @@
 
 /* Function visibility */
 #ifndef PUBLIC
-#  if defined(__GNUC__) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590))
+#  if (defined(__GNUC__) && __GNUC__ >= 4) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590))
 #    define PUBLIC __attribute__((visibility("default")))
 #  elif defined(_MSC_VER)
 #    define PUBLIC __declspec(dllexport)
-- 
1.7.9.5



More information about the mesa-dev mailing list