summaryrefslogtreecommitdiff
path: root/src/common/sanity.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/common/sanity.hpp')
-rw-r--r--src/common/sanity.hpp61
1 files changed, 42 insertions, 19 deletions
diff --git a/src/common/sanity.hpp b/src/common/sanity.hpp
index 7ffd077..e54739f 100644
--- a/src/common/sanity.hpp
+++ b/src/common/sanity.hpp
@@ -1,31 +1,54 @@
/// return wrappers for unexpected NULL pointers
#ifndef SANITY_HPP
#define SANITY_HPP
+
# ifndef __cplusplus
# error "Please compile in C++ mode"
-# endif
-# if __GNUC__ < 3
-// I don't specifically know what version this requires,
-// but GCC 3 was the beginning of modern GCC
-# error "Please upgrade your compiler to at least GCC 3"
-# endif
-# ifndef __i386__
-// Known platform dependencies:
-// endianness for the [RW]FIFO.* macros
-// possibly, some signal-handling
-# error "Unsupported platform"
-# endif
-# ifdef __x86_64__
-// I'm working on it - I know there are some pointer-size assumptions.
-# error "Sorry, this code is believed not to be 64-bit safe"
-# error "please compile with -m32"
-# endif
+# endif // __cplusplus
+
+# if __GNUC__ < 4
+# error "Your compiler is absolutely ancient. You have no chance ..."
+# endif // __GNUC__ < 4
-/// A name for unused function arguments - can be repeated
-# define UNUSED /* empty works for C++ */
/// Convert type assumptions to use the standard types here
# include <cstdint>
/// size_t, NULL
# include <cstddef>
+# if __GNUC__ == 4
+// clang identifies as GCC 4.2, but is mostly okay.
+// Until a bug-free release of it happens, though, I won't recommend it.
+// (patched) clang 3.1 would be the requirement
+# if __GNUC_MINOR__ < 6 && !defined(__clang__)
+# error "Please upgrade to at least GCC 4.6"
+# endif // __GNUC_MINOR__ < 6 && !defined(__clang__)
+// temporary workaround for library issues
+// since __GLIBCXX__ is hard to use
+# if __GNUC_MINOR__ == 6
+# define WORKAROUND_GCC46_COMPILER
+# endif // __GNUC_MINOR__ == 6
+# ifdef __GLIBCXX__
+// versions of libstdc++ from gcc
+// 4.6.0, 4.6.1, 4.6.2, 4.6.3
+# if __GLIBCXX__ == 20110325 \
+ || __GLIBCXX__ == 20110627 \
+ || __GLIBCXX__ == 20111026 \
+ || __GLIBCXX__ == 20120301 \
+ || __GLIBCXX__ == 20121127 // prerelease in Debian wheezy
+# define WORKAROUND_GCC46_LIBRARY
+# endif // __GLIBCXX__ == ...
+# endif // defined __GLIBCXX__
+# if defined(WORKAROUND_GCC46_COMPILER) \
+ && !defined(WORKAROUND_GCC46_LIBRARY)
+# error "Unknown gcc 4.6.x release"
+# endif // compiler and not library
+# endif // __GNUC__ == 4
+
+# if not defined(__i386__) and not defined(__x86_64__)
+// Known platform dependencies:
+// endianness for the [RW]FIFO.* macros
+// possibly, some signal-handling
+# error "Unsupported platform use x86 / amd64 only"
+# endif // not __i386__
+
#endif // SANITY_HPP