summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2016-04-25 10:59:31 -0700
committerThiago Macieira <thiago.macieira@intel.com>2016-05-29 18:45:13 +0000
commit0f559a2d998d7ff5b7dec83a1c7e8a9996cbaa26 (patch)
treed4f954146ca4e945f7461fea94d97f39989da34f /src
parent9e9888f69aa0b78d10b16f85235918f9d41db152 (diff)
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) <ogoffart@woboq.com>
Diffstat (limited to 'src')
-rw-r--r--src/corelib/global/qcompilerdetection.h3
1 files changed, 2 insertions, 1 deletions
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