configure: disable compile time asserts for !opt and !static_assert
authorJens Axboe <axboe@fb.com>
Wed, 22 Feb 2017 16:00:06 +0000 (09:00 -0700)
committerJens Axboe <axboe@fb.com>
Wed, 22 Feb 2017 16:00:06 +0000 (09:00 -0700)
If we don't have _Static_assert(), disable compile time
assertion checks if optimizations are disabled.

Signed-off-by: Jens Axboe <axboe@fb.com>
compiler/compiler.h
configure

index a6a74322549fc66f3210dc9b52406d1fd43a5475..20df21d050c3ba7941e705bf51140430dd7b237a 100644 (file)
 #if defined(CONFIG_STATIC_ASSERT)
 #define compiletime_assert(condition, msg) _Static_assert(condition, msg)
 
-#else
+#elif !defined(CONFIG_DISABLE_OPTIMIZATIONS)
+
 #ifndef __compiletime_error
 #define __compiletime_error(message)
 #endif
+
 #ifndef __compiletime_error_fallback
 #define __compiletime_error_fallback(condition)        do { } while (0)
 #endif
 #define compiletime_assert(condition, msg) \
        _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
 
+#else
+
+#define compiletime_assert(condition, msg)     do { } while (0)
+
 #endif
 
 #endif
index 44d215f312cf2c18f7d28110f3ef234ea9807232..15b87fac0e4c1a12d7ab9300ddf4123d0c034ad6 100755 (executable)
--- a/configure
+++ b/configure
@@ -2041,6 +2041,9 @@ fi
 if test "$have_bool" = "yes" ; then
   output_sym "CONFIG_HAVE_BOOL"
 fi
+if test "$disable_opt" = "yes" ; then
+  output_sym "CONFIG_DISABLE_OPTIMIZATIONS"
+fi
 
 if test "$zlib" = "no" ; then
   echo "Consider installing zlib-dev (zlib-devel), some fio features depend on it."