diff options
author | Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> | 2021-03-26 14:11:30 +0100 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2021-03-26 18:50:07 +0000 |
commit | 4e624996a777e9a509338ae25e8a30944fa3963e (patch) | |
tree | 89023de2241bd1ab6120c2b73fd17717ceeeee5b /tests | |
parent | 9c12d8e8f76446149ec0ac11da0d4ebf61a18cf4 (diff) |
tst_qobject: fix the detection for GCC
Q_CC_GNU is defined on compilers that masquerade as GCC (Clang, ICC),
so using it to work around GCC-specific bugs is wrong. Introduce a
local define for _only_ GCC and use it in place of Q_CC_GNU.
Drive by: version-fence a test we now know it's been fixed upstream,
and correct the link to the corresponding bug report.
Change-Id: I9059d6e6bf86157aca71590ac22afb1a1c114313
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 8b9c8d417b8ff2d4f60d83f9cc69c148632d1046)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/corelib/kernel/qobject/tst_qobject.cpp | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp index a7b47438e0..f2461da0f7 100644 --- a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp +++ b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp @@ -7050,6 +7050,12 @@ void tst_QObject::mutableFunctor() void tst_QObject::checkArgumentsForNarrowing() { + // Clang and ICC masquerade as GCC, so introduce a more strict define + // for exactly GCC (to exclude/include it from some tests). +#if defined(Q_CC_GNU) && !defined(Q_CC_CLANG) && !defined(Q_CC_INTEL) +#define Q_CC_EXACTLY_GCC Q_CC_GNU +#endif + enum UnscopedEnum { UnscopedEnumV1 = INT_MAX, UnscopedEnumV2 }; enum SignedUnscopedEnum { SignedUnscopedEnumV1 = INT_MIN, SignedUnscopedEnumV2 = INT_MAX }; @@ -7067,7 +7073,7 @@ void tst_QObject::checkArgumentsForNarrowing() // GCC < 9 does not consider floating point to bool to be narrowing, // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65043 -#if !defined(Q_CC_GNU) || Q_CC_GNU >= 900 +#if !defined(Q_CC_EXACTLY_GCC) || Q_CC_EXACTLY_GCC >= 900 NARROWS(float, bool); NARROWS(double, bool); NARROWS(long double, bool); @@ -7100,10 +7106,10 @@ void tst_QObject::checkArgumentsForNarrowing() FITS(float, double); FITS(float, long double); - // GCC thinks this is narrowing only on architectures where + // GCC < 11 thinks this is narrowing only on architectures where // sizeof(long double) > sizeof(double) - // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92856 -#if defined(Q_CC_GNU) + // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94590 +#if defined(Q_CC_EXACTLY_GCC) && (Q_CC_EXACTLY_GCC < 1100) NARROWS_IF(long double, double, sizeof(long double) > sizeof(double)); #else NARROWS(long double, double); @@ -7377,6 +7383,10 @@ void tst_QObject::checkArgumentsForNarrowing() #undef FITS_IF #undef NARROWS #undef FITS + +#ifdef Q_CC_EXACTLY_GCC +#undef Q_CC_EXACTLY_GCC +#endif } void tst_QObject::nullReceiver() |