From e07cadecc22b668b13e52ac85a4fddb4631aebb5 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 12 Apr 2012 15:40:00 -0300 Subject: [PATCH] __builtin_unreachable was added to GCC in version 4.5, so fix macros Change-Id: Ida63bb46f696ae9d60331d863bf1478415a08ff2 Reviewed-by: Olivier Goffart --- src/corelib/global/qcompilerdetection.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h index a043e5e072..94befa9ab8 100644 --- a/src/corelib/global/qcompilerdetection.h +++ b/src/corelib/global/qcompilerdetection.h @@ -153,8 +153,10 @@ # define Q_UNREACHABLE() __builtin_unreachable() # else /* Plain GCC */ -# define Q_ASSUME(expr) if (expr){} else __builtin_unreachable() -# define Q_UNREACHABLE() __builtin_unreachable() +# if (__GNUC__ * 100 + __GNUC_MINOR__) >= 405 +# define Q_ASSUME(expr) if (expr){} else __builtin_unreachable() +# define Q_UNREACHABLE() __builtin_unreachable() +# endif # endif # define Q_ALIGNOF(type) __alignof__(type)