summaryrefslogtreecommitdiff
path: root/src/common/sanity.h
diff options
context:
space:
mode:
authorBen Longbons <b.r.longbons@gmail.com>2011-09-10 16:12:07 -0700
committerBen Longbons <b.r.longbons@gmail.com>2011-09-10 16:12:07 -0700
commitf841b6fdcc802e73d52da0e67ee192c0c2c1c7e1 (patch)
treed9b013ab252968ec1e90e721f7b2ab819af0acb0 /src/common/sanity.h
parent5939e1bec75f2550d3ce109b9cd9a5d22c0626c2 (diff)
parent723fb5d3431b847526c433a13aa74485cfb564a3 (diff)
downloadtmwa-f841b6fdcc802e73d52da0e67ee192c0c2c1c7e1.tar.gz
tmwa-f841b6fdcc802e73d52da0e67ee192c0c2c1c7e1.tar.bz2
tmwa-f841b6fdcc802e73d52da0e67ee192c0c2c1c7e1.tar.xz
tmwa-f841b6fdcc802e73d52da0e67ee192c0c2c1c7e1.zip
Merge commit '723fb5d3431b847526c433a13aa74485cfb564a3'
Diffstat (limited to 'src/common/sanity.h')
-rw-r--r--src/common/sanity.h36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/common/sanity.h b/src/common/sanity.h
new file mode 100644
index 0000000..168671f
--- /dev/null
+++ b/src/common/sanity.h
@@ -0,0 +1,36 @@
+/// return wrappers for unexpected NULL pointers
+#ifndef SANITY_H
+#define SANITY_H
+# if __STDC_VERSION__ < 199901L
+# error "Please compile in C99 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
+
+/// A name for unused function arguments - can be repeated
+# define UNUSED UNUSED_IMPL(__COUNTER__)
+// Don't you just love the hoops the preprocessor makes you go through?
+# define UNUSED_IMPL(arg) UNUSED_IMPL2(arg)
+# define UNUSED_IMPL2(suffix) unused_ ## suffix __attribute__((unused))
+/// Convert conditions to use the bool type
+# include <stdbool.h>
+/// Convert type assumptions to use the standard types here
+# include <stdint.h>
+/// size_t, NULL
+# include <stddef.h>
+
+#endif // SANITY_H