Fix symbol visibility issue for REGISTER_CONFIG_FRAGMENT().

This commit is contained in:
Gunnar Beutner 2013-03-15 12:27:03 +01:00
parent 4d5e924bc6
commit fae83d2ef6
6 changed files with 7 additions and 17 deletions

View File

@ -103,7 +103,7 @@ shared_ptr<T> DynamicObjectFactory(const Dictionary::Ptr& serializedUpdate)
} }
#define REGISTER_TYPE_ALIAS(type, alias) \ #define REGISTER_TYPE_ALIAS(type, alias) \
static icinga::RegisterTypeHelper g_RegisterDT_ ## type(alias, DynamicObjectFactory<type>); I2_EXPORT icinga::RegisterTypeHelper g_RegisterDT_ ## type(alias, DynamicObjectFactory<type>);
#define REGISTER_TYPE(type) \ #define REGISTER_TYPE(type) \
REGISTER_TYPE_ALIAS(type, #type) REGISTER_TYPE_ALIAS(type, #type)

View File

@ -72,9 +72,7 @@ public:
}; };
#define REGISTER_SCRIPTFUNCTION(name, callback) \ #define REGISTER_SCRIPTFUNCTION(name, callback) \
static icinga::RegisterFunctionHelper g_RegisterSF_ ## name(#name, callback) I2_EXPORT icinga::RegisterFunctionHelper g_RegisterSF_ ## name(#name, callback)
#undef MKSYMBOL
} }

View File

@ -49,12 +49,6 @@ typedef int SOCKET;
# define MAXPATHLEN PATH_MAX # define MAXPATHLEN PATH_MAX
#endif /* MAXPATHLEN */ #endif /* MAXPATHLEN */
#if HAVE___ATTRIBUTE__ #define I2_EXPORT
# define I2_EXPORT __attribute__ ((visibility ("default"))) #define I2_IMPORT
# 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__ */
#endif /* UNIX_H */ #endif /* UNIX_H */

View File

@ -90,6 +90,4 @@ private:
# define ASSERT(expr) # define ASSERT(expr)
#endif /* _DEBUG */ #endif /* _DEBUG */
#define CONCAT(a, b) a ## b
#endif /* UTILITY_H */ #endif /* UTILITY_H */

View File

@ -90,7 +90,7 @@ public:
}; };
#define REGISTER_CONFIG_FRAGMENT(id, name, fragment) \ #define REGISTER_CONFIG_FRAGMENT(id, name, fragment) \
static icinga::RegisterConfigFragmentHelper g_RegisterCF_ ## id(name, fragment) I2_EXPORT icinga::RegisterConfigFragmentHelper g_RegisterCF_ ## id(name, fragment)
} }

View File

@ -26,6 +26,7 @@ int main(int argc, char **argv)
int cols; int cols;
FILE *infp, *outfp; FILE *infp, *outfp;
int i; int i;
char id[32];
if (argc < 3) { if (argc < 3) {
fprintf(stderr, "Syntax: %s <in-file> <out-file>\n", argv[0]); fprintf(stderr, "Syntax: %s <in-file> <out-file>\n", argv[0]);
@ -67,11 +68,10 @@ int main(int argc, char **argv)
cols++; cols++;
} }
char id[32];
strncpy(id, argv[1], sizeof(id)); strncpy(id, argv[1], sizeof(id));
id[sizeof(id) - 1] = '\0'; 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')) if ((id[i] < 'a' || id[i] > 'z') && (id[i] < 'A' || id[i] > 'Z'))
id[i] = '_'; id[i] = '_';
} }