Fix __must_check compile on older compilers

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
diff --git a/compiler-gcc3.h b/compiler-gcc3.h
new file mode 100644
index 0000000..ab8ccc4
--- /dev/null
+++ b/compiler-gcc3.h
@@ -0,0 +1,8 @@
+#ifndef FIO_COMPILER_GCC3_H
+#define FIO_COMPILER_GCC3_H
+
+#if __GNUC_MINOR__ >= 4
+#define __must_check		__attribute__((warn_unused_result))
+#endif
+
+#endif
diff --git a/compiler-gcc4.h b/compiler-gcc4.h
new file mode 100644
index 0000000..bb9cc7c
--- /dev/null
+++ b/compiler-gcc4.h
@@ -0,0 +1,6 @@
+#ifndef FIO_COMPILER_GCC4_H
+#define FIO_COMPILER_GCC4_H
+
+#define __must_check		__attribute__((warn_unused_result))
+
+#endif
diff --git a/compiler.h b/compiler.h
new file mode 100644
index 0000000..0d17ae1
--- /dev/null
+++ b/compiler.h
@@ -0,0 +1,12 @@
+#ifndef FIO_COMPILER_H
+#define FIO_COMPILER_H
+
+#if __GNUC__ >= 4
+#include "compiler-gcc4.h"
+#elif __GNUC == 3
+#include "compiler-gcc3.h"
+#else
+#error Compiler too old, need gcc at least gcc 3.x
+#endif
+
+#endif
diff --git a/fio.h b/fio.h
index d8911ef..92e6a88 100644
--- a/fio.h
+++ b/fio.h
@@ -13,6 +13,7 @@
 #include <string.h>
 #include <getopt.h>
 
+#include "compiler.h"
 #include "list.h"
 #include "rbtree.h"
 #include "md5.h"
diff --git a/os.h b/os.h
index 3f83905..823843a 100644
--- a/os.h
+++ b/os.h
@@ -56,10 +56,4 @@
 #endif
 #endif
 
-#if __GNUC__ < 3
-#define __must_check
-#else
-#define __must_check			__attribute__((warn_unused_result))
-#endif
-
 #endif