From: Jens Axboe Date: Wed, 22 Feb 2017 16:00:06 +0000 (-0700) Subject: configure: disable compile time asserts for !opt and !static_assert X-Git-Tag: fio-2.18~1 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=484817a95764dc7ba83b9f16c417bd727813043a configure: disable compile time asserts for !opt and !static_assert If we don't have _Static_assert(), disable compile time assertion checks if optimizations are disabled. Signed-off-by: Jens Axboe --- diff --git a/compiler/compiler.h b/compiler/compiler.h index a6a74322..20df21d0 100644 --- a/compiler/compiler.h +++ b/compiler/compiler.h @@ -38,10 +38,12 @@ #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 @@ -61,6 +63,10 @@ #define compiletime_assert(condition, msg) \ _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__) +#else + +#define compiletime_assert(condition, msg) do { } while (0) + #endif #endif diff --git a/configure b/configure index 44d215f3..15b87fac 100755 --- 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."