Default to use the visibility attribute, on gcc (is this okay?)
authorSam Lantinga <slouken@libsdl.org>
Wed, 22 Mar 2006 04:51:44 +0000
changeset 1574 0fd72308659e
parent 1573 2422ca15ba42
child 1575 3ba88cb7eb1b
Default to use the visibility attribute, on gcc (is this okay?)
configure.in
include/begin_code.h
--- a/configure.in	Wed Mar 22 01:28:36 2006 +0000
+++ b/configure.in	Wed Mar 22 04:51:44 2006 +0000
@@ -719,7 +719,7 @@
     CFLAGS="$save_CFLAGS"
 
     if test x$have_gcc_fvisibility = xyes; then
-        EXTRA_CFLAGS="$EXTRA_CFLAGS $visibility_CFLAGS -DDECLSPEC=SDL_GCC_ATTR_VIS_DEFAULT"
+        EXTRA_CFLAGS="$EXTRA_CFLAGS $visibility_CFLAGS"
     fi
 }
 
--- a/include/begin_code.h	Wed Mar 22 01:28:36 2006 +0000
+++ b/include/begin_code.h	Wed Mar 22 04:51:44 2006 +0000
@@ -31,44 +31,40 @@
 #endif
 #define _begin_code_h
 
-#ifdef __GNUC__
-#define SDL_GCC_ATTR_VIS_DEFAULT __attribute__((visibility("default")))
-#endif
-
 /* Some compilers use a special export keyword */
 #ifndef DECLSPEC
-# ifdef __BEOS__
+# if defined(__BEOS__)
 #  if defined(__GNUC__)
 #   define DECLSPEC	__declspec(dllexport)
 #  else
 #   define DECLSPEC	__declspec(export)
 #  endif
-# else
-# ifdef __WIN32__
+# elif defined(__WIN32__)
 #  ifdef __BORLANDC__
 #   ifdef BUILD_SDL
 #    define DECLSPEC 
 #   else
-#    define DECLSPEC __declspec(dllimport)
+#    define DECLSPEC	__declspec(dllimport)
 #   endif
 #  else
 #   define DECLSPEC	__declspec(dllexport)
 #  endif
-# else
-# ifdef __OS2__
+# elif defined(__OS2__)
 #  ifdef __WATCOMC__
 #   ifdef BUILD_SDL
-#    define DECLSPEC __declspec(dllexport)
+#    define DECLSPEC	__declspec(dllexport)
 #   else
-#  define DECLSPEC
-# endif
+#    define DECLSPEC
+#   endif
 #  else
 #   define DECLSPEC
 #  endif
 # else
-#  define DECLSPEC
-# endif
-# endif
+#  if defined(__GNUC__)
+#   define DECLSPEC	__attribute__ ((visibility("default")))
+#  else
+#   define DECLSPEC
+#  endif
 # endif
 #endif