diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2017-06-06 18:28:37 -0700 |
---|---|---|
committer | Thiago Macieira <thiago.macieira@intel.com> | 2017-06-20 16:37:35 +0000 |
commit | 0669f71b0c78c0d3374571d266004d7503ca8b12 (patch) | |
tree | 9c5ee9a5be7f02c2ca6c52a5987f0c406622694a /tests/auto/corelib/global | |
parent | 4de40514066e7e31fe02c87afaf0863d6928391f (diff) |
QRandomGenerator: don't internally rely on QT_HAS_INCLUDE
GCC didn't support it until version 5 or 6, so add configure tests for
both <random> and <sys/auxv.h>. Normally I'd say "upgrade", but this is
too low-level and important a feature.
There's a good chance that all our supported compilers have <random>
anyway. As for <sys/auxv.h>, it's present on Glibc, Bionic and MUSL, but
I don't see it in uClibc (AT_RANDOM is a Linux-specific feature).
Change-Id: Ia3e896da908f42939148fffd14c5b2af491f7a77
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'tests/auto/corelib/global')
-rw-r--r-- | tests/auto/corelib/global/qrandomgenerator/tst_qrandomgenerator.cpp | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/tests/auto/corelib/global/qrandomgenerator/tst_qrandomgenerator.cpp b/tests/auto/corelib/global/qrandomgenerator/tst_qrandomgenerator.cpp index 1909f4879f..83bee29d1a 100644 --- a/tests/auto/corelib/global/qrandomgenerator/tst_qrandomgenerator.cpp +++ b/tests/auto/corelib/global/qrandomgenerator/tst_qrandomgenerator.cpp @@ -34,11 +34,11 @@ #include <private/qrandom_p.h> #include <algorithm> -#if QT_HAS_INCLUDE(<random>) +#if QT_CONFIG(cxx11_random) # include <random> #endif -#if QT_HAS_INCLUDE(<random>) || defined(Q_OS_WIN) +#if QT_CONFIG(cxx11_random) || defined(Q_OS_BSD4) || defined(Q_OS_WIN) # define HAVE_FALLBACK_ENGINE #endif @@ -468,7 +468,7 @@ template <typename Engine> void seedStdRandomEngine() void tst_QRandomGenerator::seedStdRandomEngines() { -#if !QT_HAS_INCLUDE(<random>) +#if !QT_CONFIG(cxx11_random) QSKIP("<random> not found"); #else seedStdRandomEngine<std::default_random_engine>(); @@ -511,7 +511,7 @@ void tst_QRandomGenerator::stdUniformIntDistribution_data() void tst_QRandomGenerator::stdUniformIntDistribution() { -#if !QT_HAS_INCLUDE(<random>) +#if !QT_CONFIG(cxx11_random) QSKIP("<random> not found"); #else QFETCH(uint, control); @@ -580,8 +580,11 @@ void tst_QRandomGenerator::stdUniformIntDistribution() void tst_QRandomGenerator::stdGenerateCanonical() { -#if !QT_HAS_INCLUDE(<random>) +#if !QT_CONFIG(cxx11_random) QSKIP("<random> not found"); +#elif defined(Q_CC_MSVC) && Q_CC_MSVC < 1900 + // see https://connect.microsoft.com/VisualStudio/feedback/details/811611 + QSKIP("MSVC 2013's std::generate_canonical is broken"); #else QFETCH(uint, control); setRNGControl(control); @@ -631,7 +634,7 @@ void tst_QRandomGenerator::stdUniformRealDistribution_data() void tst_QRandomGenerator::stdUniformRealDistribution() { -#if !QT_HAS_INCLUDE(<random>) +#if !QT_CONFIG(cxx11_random) QSKIP("<random> not found"); #else QFETCH(uint, control); @@ -665,7 +668,7 @@ void tst_QRandomGenerator::stdUniformRealDistribution() void tst_QRandomGenerator::stdRandomDistributions() { -#if !QT_HAS_INCLUDE(<random>) +#if !QT_CONFIG(cxx11_random) QSKIP("<random> not found"); #else // just a compile check for some of the distributions, besides |