Remove dependency on cord in gc_config_macros.h (libcord visibility fix)
authorIvan Maidanski <ivmai@mail.ru>
Mon, 16 Jan 2012 04:55:33 +0000 (08:55 +0400)
committerIvan Maidanski <ivmai@mail.ru>
Mon, 16 Jan 2012 10:40:57 +0000 (14:40 +0400)
* include/cord.h: Do not include gc_config_macros.h.
* include/cord.h (CORD_API): Define similar to GC_API definition in
gc_config_macros.h.
* include/gc_config_macros.h: Revert changes done in
"libcord visibility fix" (do not test CORD_H, do not define
GC_API_EXPORT and GC_API_IMPORT).

include/cord.h
include/gc_config_macros.h

index 8d35c01..74b6c98 100644 (file)
 
 #include <stddef.h>
 #include <stdio.h>
-#include "gc_config_macros.h"
 
-#ifdef CORD_BUILD
-#  define CORD_API GC_API_EXPORT
-#else
-#  define CORD_API GC_API_IMPORT
+#ifdef GC_DLL
+  /* Same as for GC_API in gc_config_macros.h.  */
+# ifdef CORD_BUILD
+#   if defined(__MINGW32__) || defined(__CEGCC__)
+#     define CORD_API __declspec(dllexport)
+#   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))
+    /* Only matters if used in conjunction with -fvisibility=hidden option. */
+#     define CORD_API extern __attribute__((__visibility__("default")))
+#   endif
+# else
+#   if defined(__MINGW32__) || defined(__CEGCC__) || defined(_MSC_VER) \
+       || defined(__DMC__) || defined(__BORLANDC__) || defined(__CYGWIN__)
+#     define CORD_API __declspec(dllimport)
+#   elif defined(__WATCOMC__)
+#     define CORD_API extern __declspec(dllimport)
+#   endif
+# endif /* !CORD_BUILD */
+#endif /* GC_DLL */
+
+#ifndef CORD_API
+# define CORD_API extern
 #endif
 
 /* Cords have type const char *.  This is cheating quite a bit, and not */
index fd8bd2a..d3b5f6a 100644 (file)
@@ -17,7 +17,7 @@
 
 /* This should never be included directly; it is included only from gc.h. */
 /* We separate it only to make gc.h more suitable as documentation.       */
-#if defined(GC_H) || defined(CORD_H)
+#if defined(GC_H)
 
 /* Some tests for old macros.  These violate our namespace rules and    */
 /* will disappear shortly.  Use the GC_ names.                          */
 #if defined(GC_DLL) && !defined(GC_API)
 
 # if defined(__MINGW32__) || defined(__CEGCC__)
-#   define GC_API_EXPORT __declspec(dllexport)
-#   define GC_API_IMPORT __declspec(dllimport)
+#   ifdef GC_BUILD
+#     define GC_API __declspec(dllexport)
+#   else
+#     define GC_API __declspec(dllimport)
+#   endif
+
 # elif defined(_MSC_VER) || defined(__DMC__) || defined(__BORLANDC__) \
         || defined(__CYGWIN__)
-#   define GC_API_EXPORT extern __declspec(dllexport)
-#   define GC_API_IMPORT __declspec(dllimport)
+#   ifdef GC_BUILD
+#     define GC_API extern __declspec(dllexport)
+#   else
+#     define GC_API __declspec(dllimport)
+#   endif
+
 # elif defined(__WATCOMC__)
-#   define GC_API_EXPORT extern __declspec(dllexport)
-#   define GC_API_IMPORT extern __declspec(dllimport)
+#   ifdef GC_BUILD
+#     define GC_API extern __declspec(dllexport)
+#   else
+#     define GC_API extern __declspec(dllimport)
+#   endif
+
 # elif defined(__GNUC__)
     /* Only matters if used in conjunction with -fvisibility=hidden option. */
-#   if __GNUC__ >= 4 || defined(GC_VISIBILITY_HIDDEN_SET)
-#     define GC_API_EXPORT extern __attribute__((__visibility__("default")))
-#     define GC_API_IMPORT extern __attribute__((__visibility__("default")))
+#   if defined(GC_BUILD) && (__GNUC__ >= 4 \
+                             || defined(GC_VISIBILITY_HIDDEN_SET))
+#     define GC_API extern __attribute__((__visibility__("default")))
 #   endif
 # endif
 #endif /* GC_DLL */
-#ifndef GC_API_EXPORT
-# define GC_API_EXPORT extern
-# define GC_API_IMPORT extern
-#endif
 
-#ifdef GC_BUILD
-# define GC_API GC_API_EXPORT
-#else
-# define GC_API GC_API_IMPORT
+#ifndef GC_API
+# define GC_API extern
 #endif
 
 #ifndef GC_CALL