summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib
diff options
context:
space:
mode:
authorMårten Nordheim <marten.nordheim@qt.io>2022-08-29 14:58:50 +0200
committerMårten Nordheim <marten.nordheim@qt.io>2022-11-28 16:02:32 +0000
commit2b54eb699a8cee6b0e3ea0bce90cf61d1f5cb92b (patch)
tree439b6b858df67f904a7167bd3f309799c00b25af /tests/auto/corelib
parentabf6d810a6d7b864e62bbed3a4e00464e118fb08 (diff)
tst_qlocale: only restore the fp control masks we change
Certain masks are not supported outside 32-bit x86, and will assert on x64. Cherry-pick resolution: - Pick the modern 'portable' API instead of rewriting with x86-specific functions - Essentially means we also cherry-pick 67a563e5c55df8de595822880d92e297f580e053 Fixes: QTBUG-106000 Change-Id: Ic9f58e5a19c1db3309edeb5ec529e7a78c929665 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> (cherry picked from commit 070446d5ebf2a82531160268fbae0bb7c6730ecd) (cherry picked from commit 67a563e5c55df8de595822880d92e297f580e053) Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Diffstat (limited to 'tests/auto/corelib')
-rw-r--r--tests/auto/corelib/text/qlocale/tst_qlocale.cpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/tests/auto/corelib/text/qlocale/tst_qlocale.cpp b/tests/auto/corelib/text/qlocale/tst_qlocale.cpp
index 2dd4620718..7e2bd40628 100644
--- a/tests/auto/corelib/text/qlocale/tst_qlocale.cpp
+++ b/tests/auto/corelib/text/qlocale/tst_qlocale.cpp
@@ -1443,9 +1443,14 @@ void tst_QLocale::fpExceptions()
// check that double-to-string conversion doesn't throw floating point exceptions when they are
// enabled
#ifdef Q_OS_WIN
- _clear87();
- unsigned int oldbits = _control87(0, 0);
- _control87( 0 | _EM_INEXACT, _MCW_EM );
+# ifndef _MCW_EM
+# define _MCW_EM 0x0008001F
+# endif
+# ifndef _EM_INEXACT
+# define _EM_INEXACT 0x00000001
+# endif
+ _clearfp();
+ unsigned int oldbits = _controlfp(0 | _EM_INEXACT, _MCW_EM);
#endif
#ifdef QT_USE_FENV
@@ -1462,8 +1467,8 @@ void tst_QLocale::fpExceptions()
QVERIFY(true);
#ifdef Q_OS_WIN
- _clear87();
- _control87(oldbits, 0xFFFFF);
+ _clearfp();
+ _controlfp(oldbits, _MCW_EM);
#endif
#ifdef QT_USE_FENV