From fae83d2ef6fa193cc901a1c792a8271ee496e7de Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Fri, 15 Mar 2013 12:27:03 +0100 Subject: [PATCH] Fix symbol visibility issue for REGISTER_CONFIG_FRAGMENT(). --- lib/base/dynamictype.h | 2 +- lib/base/scriptfunction.h | 4 +--- lib/base/unix.h | 10 ++-------- lib/base/utility.h | 2 -- lib/config/configcompiler.h | 2 +- tools/mkembedconfig.c | 4 ++-- 6 files changed, 7 insertions(+), 17 deletions(-) diff --git a/lib/base/dynamictype.h b/lib/base/dynamictype.h index e1a427082..712c83d58 100644 --- a/lib/base/dynamictype.h +++ b/lib/base/dynamictype.h @@ -103,7 +103,7 @@ shared_ptr DynamicObjectFactory(const Dictionary::Ptr& serializedUpdate) } #define REGISTER_TYPE_ALIAS(type, alias) \ - static icinga::RegisterTypeHelper g_RegisterDT_ ## type(alias, DynamicObjectFactory); + I2_EXPORT icinga::RegisterTypeHelper g_RegisterDT_ ## type(alias, DynamicObjectFactory); #define REGISTER_TYPE(type) \ REGISTER_TYPE_ALIAS(type, #type) diff --git a/lib/base/scriptfunction.h b/lib/base/scriptfunction.h index 511415aee..4ef411836 100644 --- a/lib/base/scriptfunction.h +++ b/lib/base/scriptfunction.h @@ -72,9 +72,7 @@ public: }; #define REGISTER_SCRIPTFUNCTION(name, callback) \ - static icinga::RegisterFunctionHelper g_RegisterSF_ ## name(#name, callback) - -#undef MKSYMBOL + I2_EXPORT icinga::RegisterFunctionHelper g_RegisterSF_ ## name(#name, callback) } diff --git a/lib/base/unix.h b/lib/base/unix.h index c58da417e..48713a7f2 100644 --- a/lib/base/unix.h +++ b/lib/base/unix.h @@ -49,12 +49,6 @@ typedef int SOCKET; # define MAXPATHLEN PATH_MAX #endif /* MAXPATHLEN */ -#if HAVE___ATTRIBUTE__ -# define I2_EXPORT __attribute__ ((visibility ("default"))) -# define I2_IMPORT __attribute__ ((visibility ("default"))) -#else /* HAVE___ATTRIBUTE__ */ -/* default visibility takes care of exported symbols if we don't have __attribute__ */ -# define I2_EXPORT -# define I2_IMPORT -#endif /* HAVE___ATTRIBUTE__ */ +#define I2_EXPORT +#define I2_IMPORT #endif /* UNIX_H */ diff --git a/lib/base/utility.h b/lib/base/utility.h index b8bafbb06..37827f065 100644 --- a/lib/base/utility.h +++ b/lib/base/utility.h @@ -90,6 +90,4 @@ private: # define ASSERT(expr) #endif /* _DEBUG */ -#define CONCAT(a, b) a ## b - #endif /* UTILITY_H */ diff --git a/lib/config/configcompiler.h b/lib/config/configcompiler.h index e38bc2737..557dd9d26 100644 --- a/lib/config/configcompiler.h +++ b/lib/config/configcompiler.h @@ -90,7 +90,7 @@ public: }; #define REGISTER_CONFIG_FRAGMENT(id, name, fragment) \ - static icinga::RegisterConfigFragmentHelper g_RegisterCF_ ## id(name, fragment) + I2_EXPORT icinga::RegisterConfigFragmentHelper g_RegisterCF_ ## id(name, fragment) } diff --git a/tools/mkembedconfig.c b/tools/mkembedconfig.c index e4f43c022..1e1e00c2d 100644 --- a/tools/mkembedconfig.c +++ b/tools/mkembedconfig.c @@ -26,6 +26,7 @@ int main(int argc, char **argv) int cols; FILE *infp, *outfp; int i; + char id[32]; if (argc < 3) { fprintf(stderr, "Syntax: %s \n", argv[0]); @@ -67,11 +68,10 @@ int main(int argc, char **argv) cols++; } - char id[32]; strncpy(id, argv[1], sizeof(id)); id[sizeof(id) - 1] = '\0'; - for (i = 0; i < sizeof(id) - 1; i++) { + for (i = 0; id[i]; i++) { if ((id[i] < 'a' || id[i] > 'z') && (id[i] < 'A' || id[i] > 'Z')) id[i] = '_'; } -- 2.40.0