From a2306446c86b3333e69b082e41ae76ba71a42d9d Mon Sep 17 00:00:00 2001 From: Ben Longbons Date: Thu, 24 Mar 2011 13:57:13 -0700 Subject: Optimize common objects, and adjust other objects accordingly. Major changes still need to be made to each of the servers. --- src/common/sanity.h | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 src/common/sanity.h (limited to 'src/common/sanity.h') 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 +/// Convert type assumptions to use the standard types here +# include +/// size_t, NULL +# include + +#endif // SANITY_H -- cgit v1.2.3-60-g2f50