Mesa (master): mesa: consolidate PUBLIC macro definition

Brian Paul brianp at kemper.freedesktop.org
Wed Mar 4 16:23:56 UTC 2015


Module: Mesa
Branch: master
Commit: 5bebd7099ab22c6f1498cd928170561718d6ff36
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=5bebd7099ab22c6f1498cd928170561718d6ff36

Author: Brian Paul <brianp at vmware.com>
Date:   Tue Mar  3 09:01:03 2015 -0700

mesa: consolidate PUBLIC macro definition

Define the macro in src/util/macros.h rather than in two different
places.  Note that USED isn't actually used anywhere at this time.

Reviewed-by: Jose Fonseca <jfonseca at vmware.com>

---

 src/gallium/include/pipe/p_compiler.h |   12 ------------
 src/mesa/main/compiler.h              |   20 --------------------
 src/util/macros.h                     |   23 +++++++++++++++++++++++
 3 files changed, 23 insertions(+), 32 deletions(-)

diff --git a/src/gallium/include/pipe/p_compiler.h b/src/gallium/include/pipe/p_compiler.h
index cc4f444..0e95369 100644
--- a/src/gallium/include/pipe/p_compiler.h
+++ b/src/gallium/include/pipe/p_compiler.h
@@ -111,18 +111,6 @@ typedef unsigned char boolean;
 #endif
 
 
-/* Function visibility */
-#ifndef PUBLIC
-#  if defined(__GNUC__) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590))
-#    define PUBLIC __attribute__((visibility("default")))
-#  elif defined(_MSC_VER)
-#    define PUBLIC __declspec(dllexport)
-#  else
-#    define PUBLIC
-#  endif
-#endif
-
-
 /* XXX: Use standard `__func__` instead */
 #ifndef __FUNCTION__
 #  define __FUNCTION__ __func__
diff --git a/src/mesa/main/compiler.h b/src/mesa/main/compiler.h
index 7f2d732..95581fb 100644
--- a/src/mesa/main/compiler.h
+++ b/src/mesa/main/compiler.h
@@ -83,26 +83,6 @@ extern "C" {
 #endif
 
 
-/**
- * PUBLIC/USED macros
- *
- * If we build the library with gcc's -fvisibility=hidden flag, we'll
- * use the PUBLIC macro to mark functions that are to be exported.
- *
- * We also need to define a USED attribute, so the optimizer doesn't 
- * inline a static function that we later use in an alias. - ajax
- */
-#ifndef PUBLIC
-#  if defined(__GNUC__) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590))
-#    define PUBLIC __attribute__((visibility("default")))
-#    define USED __attribute__((used))
-#  else
-#    define PUBLIC
-#    define USED
-#  endif
-#endif
-
-
 /* XXX: Use standard `__func__` instead */
 #ifndef __FUNCTION__
 #  define __FUNCTION__ __func__
diff --git a/src/util/macros.h b/src/util/macros.h
index eec8b93..b862bfd 100644
--- a/src/util/macros.h
+++ b/src/util/macros.h
@@ -156,4 +156,27 @@ do {                       \
 #   endif
 #endif
 
+/**
+ * PUBLIC/USED macros
+ *
+ * If we build the library with gcc's -fvisibility=hidden flag, we'll
+ * use the PUBLIC macro to mark functions that are to be exported.
+ *
+ * We also need to define a USED attribute, so the optimizer doesn't
+ * inline a static function that we later use in an alias. - ajax
+ */
+#ifndef PUBLIC
+#  if defined(__GNUC__) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590))
+#    define PUBLIC __attribute__((visibility("default")))
+#    define USED __attribute__((used))
+#  elif defined(_MSC_VER)
+#    define PUBLIC __declspec(dllexport)
+#    define USED
+#  else
+#    define PUBLIC
+#    define USED
+#  endif
+#endif
+
+
 #endif /* UTIL_MACROS_H */




More information about the mesa-commit mailing list