From: Ivan Maidanski Date: Mon, 16 Jan 2012 04:55:33 +0000 (+0400) Subject: Remove dependency on cord in gc_config_macros.h (libcord visibility fix) X-Git-Tag: gc7_3alpha2~218^2~1 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=faaa1cd10f9f5b2f2b0ff50a77e8694b90701864;p=gc Remove dependency on cord in gc_config_macros.h (libcord visibility fix) * 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). --- diff --git a/include/cord.h b/include/cord.h index 8d35c011..74b6c986 100644 --- a/include/cord.h +++ b/include/cord.h @@ -57,12 +57,32 @@ #include #include -#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 */ diff --git a/include/gc_config_macros.h b/include/gc_config_macros.h index fd8bd2a1..d3b5f6a6 100644 --- a/include/gc_config_macros.h +++ b/include/gc_config_macros.h @@ -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. */ @@ -172,32 +172,38 @@ #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