From 95da2fd337b164139bba4ad178f263aad831a010 Mon Sep 17 00:00:00 2001 From: Casey Carter Date: Sun, 11 Feb 2018 12:16:39 -0800 Subject: [PATCH] Don't use clang's __builtin_assume as an optimizer hint (#608) Fixes #607. Drive-by: use '?:' to contextually convert to bool in the fallback definition of `GSL_ASSUME` --- include/gsl/gsl_assert | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/include/gsl/gsl_assert b/include/gsl/gsl_assert index 468d4a0..eeb3473 100644 --- a/include/gsl/gsl_assert +++ b/include/gsl/gsl_assert @@ -52,12 +52,10 @@ // #ifdef _MSC_VER #define GSL_ASSUME(cond) __assume(cond) -#elif defined(__clang__) -#define GSL_ASSUME(cond) __builtin_assume(cond) #elif defined(__GNUC__) #define GSL_ASSUME(cond) ((cond) ? static_cast(0) : __builtin_unreachable()) #else -#define GSL_ASSUME(cond) static_cast(!!(cond)) +#define GSL_ASSUME(cond) static_cast((cond) ? 0 : 0) #endif //