From 484817a95764dc7ba83b9f16c417bd727813043a Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Wed, 22 Feb 2017 09:00:06 -0700 Subject: [PATCH] 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 --- compiler/compiler.h | 8 +++++++- configure | 3 +++ 2 files changed, 10 insertions(+), 1 deletion(-) 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." -- 2.25.1