summaryrefslogtreecommitdiff
path: root/include/my_global.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/my_global.h')
-rw-r--r--include/my_global.h22
1 files changed, 21 insertions, 1 deletions
diff --git a/include/my_global.h b/include/my_global.h
index 4a9e1673de4..6363b5ac8d3 100644
--- a/include/my_global.h
+++ b/include/my_global.h
@@ -454,15 +454,35 @@ typedef unsigned short ushort;
#define function_volatile volatile
#define my_reinterpret_cast(A) reinterpret_cast<A>
#define my_const_cast(A) const_cast<A>
+# ifndef GCC_VERSION
+# define GCC_VERSION (__GNUC__ * 1000 + __GNUC_MINOR__)
+# endif
#elif !defined(my_reinterpret_cast)
#define my_reinterpret_cast(A) (A)
#define my_const_cast(A) (A)
#endif
-#if !defined(__attribute__) && (defined(__cplusplus) || !defined(__GNUC__) || __GNUC__ == 2 && __GNUC_MINOR__ < 8)
+
+/*
+ Disable __attribute__() on GCC < 2.7 and non-GCC compilers
+*/
+#if !defined(__attribute__) && (!defined(__GNUC__) || GCC_VERSION < 2007)
#define __attribute__(A)
#endif
/*
+ __attribute__((format(...))) is only supported in gcc >= 2.8 and g++ >= 3.4
+*/
+#ifndef ATTRIBUTE_FORMAT
+# if defined(__GNUC__) && \
+ ((!defined(__cplusplus__) && GCC_VERSION >= 2008) || \
+ GCC_VERSION >= 3004)
+# define ATTRIBUTE_FORMAT(style, m, n) __attribute__((format(style, m, n)))
+# else
+# define ATTRIBUTE_FORMAT(style, m, n)
+# endif
+#endif
+
+/*
Wen using the embedded library, users might run into link problems,
duplicate declaration of __cxa_pure_virtual, solved by declaring it a
weak symbol.