diff options
author | Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> | 2020-06-11 14:47:53 +0200 |
---|---|---|
committer | Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> | 2020-06-12 14:30:37 +0200 |
commit | a769ca1d91aaa7b4cb4f0f3b2fb00940c7e8b201 (patch) | |
tree | 228b5cab18e21f5e55a3275b777bdf803a1cc489 /src/corelib | |
parent | 1053e1f4a3cf681eadcf5a4774b18372738db2f5 (diff) |
Assume static_assert is available everywhere in C++
I'm not adding a static_assert(Q_COMPILER_STATIC_ASSERT),
as ironic as that might be; we have enough
static_asserts around already which will surely cause
errors, in case of a broken compiler.
The detection itself has to stay around for C support.
Change-Id: Id32f5c8e0ab2e461fba7b0525da5eeaaea77c68d
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'src/corelib')
-rw-r--r-- | src/corelib/global/qglobal.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index f2e8cae4ae..6bfb73eb5c 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -111,7 +111,9 @@ */ #define Q_UNUSED(x) (void)x; -#if defined(__cplusplus) && defined(Q_COMPILER_STATIC_ASSERT) +#if defined(__cplusplus) +// Don't use these in C++ mode, use static_assert directly. +// These are here only to keep old code compiling. # define Q_STATIC_ASSERT(Condition) static_assert(bool(Condition), #Condition) # define Q_STATIC_ASSERT_X(Condition, Message) static_assert(bool(Condition), Message) #elif defined(Q_COMPILER_STATIC_ASSERT) |