summaryrefslogtreecommitdiff
path: root/src/libmowgli/platform/constructor.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/libmowgli/platform/constructor.h')
-rw-r--r--src/libmowgli/platform/constructor.h27
1 files changed, 14 insertions, 13 deletions
diff --git a/src/libmowgli/platform/constructor.h b/src/libmowgli/platform/constructor.h
index 8446f44..7675703 100644
--- a/src/libmowgli/platform/constructor.h
+++ b/src/libmowgli/platform/constructor.h
@@ -24,7 +24,7 @@
#ifndef __MOWGLI_PLATFORM_CONSTRUCTOR_H__
#define __MOWGLI_PLATFORM_CONSTRUCTOR_H__
-#ifdef _MSC_VER
+#if defined MOWGLI_COMPILER_MSVC
/*
* Automatic constructors are not yet officially supported in MSVC, however,
@@ -34,21 +34,22 @@
* See http://blogs.msdn.com/b/vcblog/archive/2006/10/20/crt-initialization.aspx
* for more information.
*/
-#define MOWGLI_BOOTSTRAP_FUNC(func) \
- static void __cdecl func(void); \
- __declspec(allocate(".CRT$XCU")) void (__cdecl *func##_)(void) = func; \
+# define MOWGLI_BOOTSTRAP_FUNC(func) \
+ static void __cdecl func(void); \
+ __declspec(allocate(".CRT$XCU")) void(__cdecl * func##_) (void) = func; \
static void __cdecl func(void)
-
-#elif defined(__GNUC__) || defined(__SUNPRO_C)
-
-#define MOWGLI_BOOTSTRAP_FUNC(func) \
- static void func(void) __attribute__((constructor)); \
+#elif defined MOWGLI_COMPILER_GCC_COMPAT
+# if MOWGLI_COMPILER_GCC_VERSION >= 403000
+# define MOWGLI_BOOTSTRAP_FUNC(func) \
+ static void func(void) __attribute__((cold, constructor, flatten)); \
static void func(void)
-
+# else
+# define MOWGLI_BOOTSTRAP_FUNC(func) \
+ static void func(void) __attribute__((constructor, flatten)); \
+ static void func(void)
+# endif
#else
-
-#error MOWGLI_BOOTSTRAP_FUNC not implemented for your platform :(
-
+# error MOWGLI_BOOTSTRAP_FUNC not implemented for your platform :(
#endif
#endif