From 0f559a2d998d7ff5b7dec83a1c7e8a9996cbaa26 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Mon, 25 Apr 2016 10:59:31 -0700 Subject: Force the use of the C++11 alignof keyword instead of an extension If the compiler supports C++11 alignof, let's use it. No point in perpetuating the use of __alignof__ or __alignof. There's a fallback implementation in qglobal.h that works even without compiler extensions. We can't drop it just yet (alignas is not a required C++11 feature), but at this point I doubt that fallback is used anywhere anymore. The tst_compiler test was wrong to use alignof(variable). That's not permitted by the standard nor would it work with our fallback implementation. MSVC 2015 enforces this, but ICC, GCC and Clang don't. Change-Id: Ifea6e497f11a461db432ffff1448abfa86672c63 Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/corelib/global/qcompilerdetection.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h index ad881ef4c9..01b3a298af 100644 --- a/src/corelib/global/qcompilerdetection.h +++ b/src/corelib/global/qcompilerdetection.h @@ -1053,7 +1053,8 @@ # define Q_DECL_NOTHROW Q_DECL_NOEXCEPT #endif -#if defined(Q_COMPILER_ALIGNOF) && !defined(Q_ALIGNOF) +#if defined(Q_COMPILER_ALIGNOF) +# undef Q_ALIGNOF # define Q_ALIGNOF(x) alignof(x) #endif -- cgit v1.2.3