From 212285639d748c7def8648f89b8c1c21c5f481e6 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 15 Jan 2015 15:16:53 -0800 Subject: Add missing fetchAndXxx methods to atomic classes based on std::atomic And add tests for the GCC intrinsics and for std::atomic. Task-number: QTBUG-43794 Change-Id: Ic5d393bfd36e48a193fcffff13b9b2dbaee80469 Reviewed-by: Olivier Goffart (Woboq GmbH) --- .../corelib/thread/qatomicinteger/char/char.pro | 1 - .../thread/qatomicinteger/char16_t/char16_t.pro | 1 - .../thread/qatomicinteger/char32_t/char32_t.pro | 1 - .../thread/qatomicinteger/cxx11/char/char.pro | 1 + .../qatomicinteger/cxx11/char16_t/char16_t.pro | 1 + .../qatomicinteger/cxx11/char32_t/char32_t.pro | 1 + .../thread/qatomicinteger/cxx11/int/int.pro | 1 + .../thread/qatomicinteger/cxx11/long/long.pro | 1 + .../qatomicinteger/cxx11/qlonglong/qlonglong.pro | 1 + .../qatomicinteger/cxx11/qptrdiff/qptrdiff.pro | 1 + .../qatomicinteger/cxx11/quintptr/quintptr.pro | 1 + .../qatomicinteger/cxx11/qulonglong/qulonglong.pro | 1 + .../thread/qatomicinteger/cxx11/schar/schar.pro | 1 + .../thread/qatomicinteger/cxx11/short/short.pro | 1 + .../thread/qatomicinteger/cxx11/uchar/uchar.pro | 1 + .../thread/qatomicinteger/cxx11/uint/uint.pro | 1 + .../thread/qatomicinteger/cxx11/ulong/ulong.pro | 1 + .../thread/qatomicinteger/cxx11/ushort/ushort.pro | 1 + .../qatomicinteger/cxx11/wchar_t/wchar_t.pro | 1 + .../thread/qatomicinteger/gcc/char/char.pro | 1 + .../qatomicinteger/gcc/char16_t/char16_t.pro | 1 + .../qatomicinteger/gcc/char32_t/char32_t.pro | 1 + .../corelib/thread/qatomicinteger/gcc/int/int.pro | 1 + .../thread/qatomicinteger/gcc/long/long.pro | 1 + .../qatomicinteger/gcc/qlonglong/qlonglong.pro | 1 + .../qatomicinteger/gcc/qptrdiff/qptrdiff.pro | 1 + .../qatomicinteger/gcc/quintptr/quintptr.pro | 1 + .../qatomicinteger/gcc/qulonglong/qulonglong.pro | 1 + .../thread/qatomicinteger/gcc/schar/schar.pro | 1 + .../thread/qatomicinteger/gcc/short/short.pro | 1 + .../thread/qatomicinteger/gcc/uchar/uchar.pro | 1 + .../thread/qatomicinteger/gcc/uint/uint.pro | 1 + .../thread/qatomicinteger/gcc/ulong/ulong.pro | 1 + .../thread/qatomicinteger/gcc/ushort/ushort.pro | 1 + .../thread/qatomicinteger/gcc/wchar_t/wchar_t.pro | 1 + .../auto/corelib/thread/qatomicinteger/int/int.pro | 1 - .../corelib/thread/qatomicinteger/long/long.pro | 1 - .../thread/qatomicinteger/qatomicinteger.pri | 19 +++++++++-- .../thread/qatomicinteger/qatomicinteger.pro | 39 ++++++++++++++++++++++ .../thread/qatomicinteger/qlonglong/qlonglong.pro | 1 - .../thread/qatomicinteger/qptrdiff/qptrdiff.pro | 1 - .../thread/qatomicinteger/quintptr/quintptr.pro | 1 - .../qatomicinteger/qulonglong/qulonglong.pro | 1 - .../corelib/thread/qatomicinteger/schar/schar.pro | 1 - .../corelib/thread/qatomicinteger/short/short.pro | 1 - .../thread/qatomicinteger/tst_qatomicinteger.cpp | 24 +++++++++++++ .../corelib/thread/qatomicinteger/uchar/uchar.pro | 1 - .../corelib/thread/qatomicinteger/uint/uint.pro | 1 - .../corelib/thread/qatomicinteger/ulong/ulong.pro | 1 - .../thread/qatomicinteger/ushort/ushort.pro | 1 - .../thread/qatomicinteger/wchar_t/wchar_t.pro | 1 - 51 files changed, 111 insertions(+), 19 deletions(-) create mode 100644 tests/auto/corelib/thread/qatomicinteger/cxx11/char/char.pro create mode 100644 tests/auto/corelib/thread/qatomicinteger/cxx11/char16_t/char16_t.pro create mode 100644 tests/auto/corelib/thread/qatomicinteger/cxx11/char32_t/char32_t.pro create mode 100644 tests/auto/corelib/thread/qatomicinteger/cxx11/int/int.pro create mode 100644 tests/auto/corelib/thread/qatomicinteger/cxx11/long/long.pro create mode 100644 tests/auto/corelib/thread/qatomicinteger/cxx11/qlonglong/qlonglong.pro create mode 100644 tests/auto/corelib/thread/qatomicinteger/cxx11/qptrdiff/qptrdiff.pro create mode 100644 tests/auto/corelib/thread/qatomicinteger/cxx11/quintptr/quintptr.pro create mode 100644 tests/auto/corelib/thread/qatomicinteger/cxx11/qulonglong/qulonglong.pro create mode 100644 tests/auto/corelib/thread/qatomicinteger/cxx11/schar/schar.pro create mode 100644 tests/auto/corelib/thread/qatomicinteger/cxx11/short/short.pro create mode 100644 tests/auto/corelib/thread/qatomicinteger/cxx11/uchar/uchar.pro create mode 100644 tests/auto/corelib/thread/qatomicinteger/cxx11/uint/uint.pro create mode 100644 tests/auto/corelib/thread/qatomicinteger/cxx11/ulong/ulong.pro create mode 100644 tests/auto/corelib/thread/qatomicinteger/cxx11/ushort/ushort.pro create mode 100644 tests/auto/corelib/thread/qatomicinteger/cxx11/wchar_t/wchar_t.pro create mode 100644 tests/auto/corelib/thread/qatomicinteger/gcc/char/char.pro create mode 100644 tests/auto/corelib/thread/qatomicinteger/gcc/char16_t/char16_t.pro create mode 100644 tests/auto/corelib/thread/qatomicinteger/gcc/char32_t/char32_t.pro create mode 100644 tests/auto/corelib/thread/qatomicinteger/gcc/int/int.pro create mode 100644 tests/auto/corelib/thread/qatomicinteger/gcc/long/long.pro create mode 100644 tests/auto/corelib/thread/qatomicinteger/gcc/qlonglong/qlonglong.pro create mode 100644 tests/auto/corelib/thread/qatomicinteger/gcc/qptrdiff/qptrdiff.pro create mode 100644 tests/auto/corelib/thread/qatomicinteger/gcc/quintptr/quintptr.pro create mode 100644 tests/auto/corelib/thread/qatomicinteger/gcc/qulonglong/qulonglong.pro create mode 100644 tests/auto/corelib/thread/qatomicinteger/gcc/schar/schar.pro create mode 100644 tests/auto/corelib/thread/qatomicinteger/gcc/short/short.pro create mode 100644 tests/auto/corelib/thread/qatomicinteger/gcc/uchar/uchar.pro create mode 100644 tests/auto/corelib/thread/qatomicinteger/gcc/uint/uint.pro create mode 100644 tests/auto/corelib/thread/qatomicinteger/gcc/ulong/ulong.pro create mode 100644 tests/auto/corelib/thread/qatomicinteger/gcc/ushort/ushort.pro create mode 100644 tests/auto/corelib/thread/qatomicinteger/gcc/wchar_t/wchar_t.pro (limited to 'tests/auto/corelib/thread') diff --git a/tests/auto/corelib/thread/qatomicinteger/char/char.pro b/tests/auto/corelib/thread/qatomicinteger/char/char.pro index 51ef1add8f..1e97d5cbae 100644 --- a/tests/auto/corelib/thread/qatomicinteger/char/char.pro +++ b/tests/auto/corelib/thread/qatomicinteger/char/char.pro @@ -1,2 +1 @@ -TYPE = $$basename(PWD) include(../qatomicinteger.pri) diff --git a/tests/auto/corelib/thread/qatomicinteger/char16_t/char16_t.pro b/tests/auto/corelib/thread/qatomicinteger/char16_t/char16_t.pro index 51ef1add8f..1e97d5cbae 100644 --- a/tests/auto/corelib/thread/qatomicinteger/char16_t/char16_t.pro +++ b/tests/auto/corelib/thread/qatomicinteger/char16_t/char16_t.pro @@ -1,2 +1 @@ -TYPE = $$basename(PWD) include(../qatomicinteger.pri) diff --git a/tests/auto/corelib/thread/qatomicinteger/char32_t/char32_t.pro b/tests/auto/corelib/thread/qatomicinteger/char32_t/char32_t.pro index 51ef1add8f..1e97d5cbae 100644 --- a/tests/auto/corelib/thread/qatomicinteger/char32_t/char32_t.pro +++ b/tests/auto/corelib/thread/qatomicinteger/char32_t/char32_t.pro @@ -1,2 +1 @@ -TYPE = $$basename(PWD) include(../qatomicinteger.pri) diff --git a/tests/auto/corelib/thread/qatomicinteger/cxx11/char/char.pro b/tests/auto/corelib/thread/qatomicinteger/cxx11/char/char.pro new file mode 100644 index 0000000000..64401f0229 --- /dev/null +++ b/tests/auto/corelib/thread/qatomicinteger/cxx11/char/char.pro @@ -0,0 +1 @@ +include(../../qatomicinteger.pri) diff --git a/tests/auto/corelib/thread/qatomicinteger/cxx11/char16_t/char16_t.pro b/tests/auto/corelib/thread/qatomicinteger/cxx11/char16_t/char16_t.pro new file mode 100644 index 0000000000..64401f0229 --- /dev/null +++ b/tests/auto/corelib/thread/qatomicinteger/cxx11/char16_t/char16_t.pro @@ -0,0 +1 @@ +include(../../qatomicinteger.pri) diff --git a/tests/auto/corelib/thread/qatomicinteger/cxx11/char32_t/char32_t.pro b/tests/auto/corelib/thread/qatomicinteger/cxx11/char32_t/char32_t.pro new file mode 100644 index 0000000000..64401f0229 --- /dev/null +++ b/tests/auto/corelib/thread/qatomicinteger/cxx11/char32_t/char32_t.pro @@ -0,0 +1 @@ +include(../../qatomicinteger.pri) diff --git a/tests/auto/corelib/thread/qatomicinteger/cxx11/int/int.pro b/tests/auto/corelib/thread/qatomicinteger/cxx11/int/int.pro new file mode 100644 index 0000000000..64401f0229 --- /dev/null +++ b/tests/auto/corelib/thread/qatomicinteger/cxx11/int/int.pro @@ -0,0 +1 @@ +include(../../qatomicinteger.pri) diff --git a/tests/auto/corelib/thread/qatomicinteger/cxx11/long/long.pro b/tests/auto/corelib/thread/qatomicinteger/cxx11/long/long.pro new file mode 100644 index 0000000000..64401f0229 --- /dev/null +++ b/tests/auto/corelib/thread/qatomicinteger/cxx11/long/long.pro @@ -0,0 +1 @@ +include(../../qatomicinteger.pri) diff --git a/tests/auto/corelib/thread/qatomicinteger/cxx11/qlonglong/qlonglong.pro b/tests/auto/corelib/thread/qatomicinteger/cxx11/qlonglong/qlonglong.pro new file mode 100644 index 0000000000..64401f0229 --- /dev/null +++ b/tests/auto/corelib/thread/qatomicinteger/cxx11/qlonglong/qlonglong.pro @@ -0,0 +1 @@ +include(../../qatomicinteger.pri) diff --git a/tests/auto/corelib/thread/qatomicinteger/cxx11/qptrdiff/qptrdiff.pro b/tests/auto/corelib/thread/qatomicinteger/cxx11/qptrdiff/qptrdiff.pro new file mode 100644 index 0000000000..64401f0229 --- /dev/null +++ b/tests/auto/corelib/thread/qatomicinteger/cxx11/qptrdiff/qptrdiff.pro @@ -0,0 +1 @@ +include(../../qatomicinteger.pri) diff --git a/tests/auto/corelib/thread/qatomicinteger/cxx11/quintptr/quintptr.pro b/tests/auto/corelib/thread/qatomicinteger/cxx11/quintptr/quintptr.pro new file mode 100644 index 0000000000..64401f0229 --- /dev/null +++ b/tests/auto/corelib/thread/qatomicinteger/cxx11/quintptr/quintptr.pro @@ -0,0 +1 @@ +include(../../qatomicinteger.pri) diff --git a/tests/auto/corelib/thread/qatomicinteger/cxx11/qulonglong/qulonglong.pro b/tests/auto/corelib/thread/qatomicinteger/cxx11/qulonglong/qulonglong.pro new file mode 100644 index 0000000000..64401f0229 --- /dev/null +++ b/tests/auto/corelib/thread/qatomicinteger/cxx11/qulonglong/qulonglong.pro @@ -0,0 +1 @@ +include(../../qatomicinteger.pri) diff --git a/tests/auto/corelib/thread/qatomicinteger/cxx11/schar/schar.pro b/tests/auto/corelib/thread/qatomicinteger/cxx11/schar/schar.pro new file mode 100644 index 0000000000..64401f0229 --- /dev/null +++ b/tests/auto/corelib/thread/qatomicinteger/cxx11/schar/schar.pro @@ -0,0 +1 @@ +include(../../qatomicinteger.pri) diff --git a/tests/auto/corelib/thread/qatomicinteger/cxx11/short/short.pro b/tests/auto/corelib/thread/qatomicinteger/cxx11/short/short.pro new file mode 100644 index 0000000000..64401f0229 --- /dev/null +++ b/tests/auto/corelib/thread/qatomicinteger/cxx11/short/short.pro @@ -0,0 +1 @@ +include(../../qatomicinteger.pri) diff --git a/tests/auto/corelib/thread/qatomicinteger/cxx11/uchar/uchar.pro b/tests/auto/corelib/thread/qatomicinteger/cxx11/uchar/uchar.pro new file mode 100644 index 0000000000..64401f0229 --- /dev/null +++ b/tests/auto/corelib/thread/qatomicinteger/cxx11/uchar/uchar.pro @@ -0,0 +1 @@ +include(../../qatomicinteger.pri) diff --git a/tests/auto/corelib/thread/qatomicinteger/cxx11/uint/uint.pro b/tests/auto/corelib/thread/qatomicinteger/cxx11/uint/uint.pro new file mode 100644 index 0000000000..64401f0229 --- /dev/null +++ b/tests/auto/corelib/thread/qatomicinteger/cxx11/uint/uint.pro @@ -0,0 +1 @@ +include(../../qatomicinteger.pri) diff --git a/tests/auto/corelib/thread/qatomicinteger/cxx11/ulong/ulong.pro b/tests/auto/corelib/thread/qatomicinteger/cxx11/ulong/ulong.pro new file mode 100644 index 0000000000..64401f0229 --- /dev/null +++ b/tests/auto/corelib/thread/qatomicinteger/cxx11/ulong/ulong.pro @@ -0,0 +1 @@ +include(../../qatomicinteger.pri) diff --git a/tests/auto/corelib/thread/qatomicinteger/cxx11/ushort/ushort.pro b/tests/auto/corelib/thread/qatomicinteger/cxx11/ushort/ushort.pro new file mode 100644 index 0000000000..64401f0229 --- /dev/null +++ b/tests/auto/corelib/thread/qatomicinteger/cxx11/ushort/ushort.pro @@ -0,0 +1 @@ +include(../../qatomicinteger.pri) diff --git a/tests/auto/corelib/thread/qatomicinteger/cxx11/wchar_t/wchar_t.pro b/tests/auto/corelib/thread/qatomicinteger/cxx11/wchar_t/wchar_t.pro new file mode 100644 index 0000000000..64401f0229 --- /dev/null +++ b/tests/auto/corelib/thread/qatomicinteger/cxx11/wchar_t/wchar_t.pro @@ -0,0 +1 @@ +include(../../qatomicinteger.pri) diff --git a/tests/auto/corelib/thread/qatomicinteger/gcc/char/char.pro b/tests/auto/corelib/thread/qatomicinteger/gcc/char/char.pro new file mode 100644 index 0000000000..64401f0229 --- /dev/null +++ b/tests/auto/corelib/thread/qatomicinteger/gcc/char/char.pro @@ -0,0 +1 @@ +include(../../qatomicinteger.pri) diff --git a/tests/auto/corelib/thread/qatomicinteger/gcc/char16_t/char16_t.pro b/tests/auto/corelib/thread/qatomicinteger/gcc/char16_t/char16_t.pro new file mode 100644 index 0000000000..64401f0229 --- /dev/null +++ b/tests/auto/corelib/thread/qatomicinteger/gcc/char16_t/char16_t.pro @@ -0,0 +1 @@ +include(../../qatomicinteger.pri) diff --git a/tests/auto/corelib/thread/qatomicinteger/gcc/char32_t/char32_t.pro b/tests/auto/corelib/thread/qatomicinteger/gcc/char32_t/char32_t.pro new file mode 100644 index 0000000000..64401f0229 --- /dev/null +++ b/tests/auto/corelib/thread/qatomicinteger/gcc/char32_t/char32_t.pro @@ -0,0 +1 @@ +include(../../qatomicinteger.pri) diff --git a/tests/auto/corelib/thread/qatomicinteger/gcc/int/int.pro b/tests/auto/corelib/thread/qatomicinteger/gcc/int/int.pro new file mode 100644 index 0000000000..64401f0229 --- /dev/null +++ b/tests/auto/corelib/thread/qatomicinteger/gcc/int/int.pro @@ -0,0 +1 @@ +include(../../qatomicinteger.pri) diff --git a/tests/auto/corelib/thread/qatomicinteger/gcc/long/long.pro b/tests/auto/corelib/thread/qatomicinteger/gcc/long/long.pro new file mode 100644 index 0000000000..64401f0229 --- /dev/null +++ b/tests/auto/corelib/thread/qatomicinteger/gcc/long/long.pro @@ -0,0 +1 @@ +include(../../qatomicinteger.pri) diff --git a/tests/auto/corelib/thread/qatomicinteger/gcc/qlonglong/qlonglong.pro b/tests/auto/corelib/thread/qatomicinteger/gcc/qlonglong/qlonglong.pro new file mode 100644 index 0000000000..64401f0229 --- /dev/null +++ b/tests/auto/corelib/thread/qatomicinteger/gcc/qlonglong/qlonglong.pro @@ -0,0 +1 @@ +include(../../qatomicinteger.pri) diff --git a/tests/auto/corelib/thread/qatomicinteger/gcc/qptrdiff/qptrdiff.pro b/tests/auto/corelib/thread/qatomicinteger/gcc/qptrdiff/qptrdiff.pro new file mode 100644 index 0000000000..64401f0229 --- /dev/null +++ b/tests/auto/corelib/thread/qatomicinteger/gcc/qptrdiff/qptrdiff.pro @@ -0,0 +1 @@ +include(../../qatomicinteger.pri) diff --git a/tests/auto/corelib/thread/qatomicinteger/gcc/quintptr/quintptr.pro b/tests/auto/corelib/thread/qatomicinteger/gcc/quintptr/quintptr.pro new file mode 100644 index 0000000000..64401f0229 --- /dev/null +++ b/tests/auto/corelib/thread/qatomicinteger/gcc/quintptr/quintptr.pro @@ -0,0 +1 @@ +include(../../qatomicinteger.pri) diff --git a/tests/auto/corelib/thread/qatomicinteger/gcc/qulonglong/qulonglong.pro b/tests/auto/corelib/thread/qatomicinteger/gcc/qulonglong/qulonglong.pro new file mode 100644 index 0000000000..64401f0229 --- /dev/null +++ b/tests/auto/corelib/thread/qatomicinteger/gcc/qulonglong/qulonglong.pro @@ -0,0 +1 @@ +include(../../qatomicinteger.pri) diff --git a/tests/auto/corelib/thread/qatomicinteger/gcc/schar/schar.pro b/tests/auto/corelib/thread/qatomicinteger/gcc/schar/schar.pro new file mode 100644 index 0000000000..64401f0229 --- /dev/null +++ b/tests/auto/corelib/thread/qatomicinteger/gcc/schar/schar.pro @@ -0,0 +1 @@ +include(../../qatomicinteger.pri) diff --git a/tests/auto/corelib/thread/qatomicinteger/gcc/short/short.pro b/tests/auto/corelib/thread/qatomicinteger/gcc/short/short.pro new file mode 100644 index 0000000000..64401f0229 --- /dev/null +++ b/tests/auto/corelib/thread/qatomicinteger/gcc/short/short.pro @@ -0,0 +1 @@ +include(../../qatomicinteger.pri) diff --git a/tests/auto/corelib/thread/qatomicinteger/gcc/uchar/uchar.pro b/tests/auto/corelib/thread/qatomicinteger/gcc/uchar/uchar.pro new file mode 100644 index 0000000000..64401f0229 --- /dev/null +++ b/tests/auto/corelib/thread/qatomicinteger/gcc/uchar/uchar.pro @@ -0,0 +1 @@ +include(../../qatomicinteger.pri) diff --git a/tests/auto/corelib/thread/qatomicinteger/gcc/uint/uint.pro b/tests/auto/corelib/thread/qatomicinteger/gcc/uint/uint.pro new file mode 100644 index 0000000000..64401f0229 --- /dev/null +++ b/tests/auto/corelib/thread/qatomicinteger/gcc/uint/uint.pro @@ -0,0 +1 @@ +include(../../qatomicinteger.pri) diff --git a/tests/auto/corelib/thread/qatomicinteger/gcc/ulong/ulong.pro b/tests/auto/corelib/thread/qatomicinteger/gcc/ulong/ulong.pro new file mode 100644 index 0000000000..64401f0229 --- /dev/null +++ b/tests/auto/corelib/thread/qatomicinteger/gcc/ulong/ulong.pro @@ -0,0 +1 @@ +include(../../qatomicinteger.pri) diff --git a/tests/auto/corelib/thread/qatomicinteger/gcc/ushort/ushort.pro b/tests/auto/corelib/thread/qatomicinteger/gcc/ushort/ushort.pro new file mode 100644 index 0000000000..64401f0229 --- /dev/null +++ b/tests/auto/corelib/thread/qatomicinteger/gcc/ushort/ushort.pro @@ -0,0 +1 @@ +include(../../qatomicinteger.pri) diff --git a/tests/auto/corelib/thread/qatomicinteger/gcc/wchar_t/wchar_t.pro b/tests/auto/corelib/thread/qatomicinteger/gcc/wchar_t/wchar_t.pro new file mode 100644 index 0000000000..64401f0229 --- /dev/null +++ b/tests/auto/corelib/thread/qatomicinteger/gcc/wchar_t/wchar_t.pro @@ -0,0 +1 @@ +include(../../qatomicinteger.pri) diff --git a/tests/auto/corelib/thread/qatomicinteger/int/int.pro b/tests/auto/corelib/thread/qatomicinteger/int/int.pro index 51ef1add8f..1e97d5cbae 100644 --- a/tests/auto/corelib/thread/qatomicinteger/int/int.pro +++ b/tests/auto/corelib/thread/qatomicinteger/int/int.pro @@ -1,2 +1 @@ -TYPE = $$basename(PWD) include(../qatomicinteger.pri) diff --git a/tests/auto/corelib/thread/qatomicinteger/long/long.pro b/tests/auto/corelib/thread/qatomicinteger/long/long.pro index 51ef1add8f..1e97d5cbae 100644 --- a/tests/auto/corelib/thread/qatomicinteger/long/long.pro +++ b/tests/auto/corelib/thread/qatomicinteger/long/long.pro @@ -1,2 +1 @@ -TYPE = $$basename(PWD) include(../qatomicinteger.pri) diff --git a/tests/auto/corelib/thread/qatomicinteger/qatomicinteger.pri b/tests/auto/corelib/thread/qatomicinteger/qatomicinteger.pri index dc7cc8bcec..d9ebe64d5b 100644 --- a/tests/auto/corelib/thread/qatomicinteger/qatomicinteger.pri +++ b/tests/auto/corelib/thread/qatomicinteger/qatomicinteger.pri @@ -1,7 +1,20 @@ -isEmpty(TYPE): error("Project must define TYPE variable") +# Get our build type from the directory name +TYPE = $$basename(_PRO_FILE_PWD_) +dn = $$dirname(_PRO_FILE_PWD_) +FORCE = $$basename(dn) + +equals(FORCE, cxx11) { + suffix = Cxx11_$$TYPE + DEFINES += QT_ATOMIC_FORCE_CXX11 +} else: equals(FORCE, gcc) { + suffix = Gcc_$$TYPE + DEFINES += QT_ATOMIC_FORCE_GCC +} else { + suffix = $$TYPE +} CONFIG += testcase parallel_test QT = core testlib -TARGET = tst_qatomicinteger_$$TYPE +TARGET = tst_qatomicinteger_$$lower($$suffix) SOURCES = $$PWD/tst_qatomicinteger.cpp -DEFINES += QATOMIC_TEST_TYPE=$$TYPE tst_QAtomicIntegerXX=tst_QAtomicInteger_$$TYPE +DEFINES += QATOMIC_TEST_TYPE=$$TYPE tst_QAtomicIntegerXX=tst_QAtomicInteger_$$suffix diff --git a/tests/auto/corelib/thread/qatomicinteger/qatomicinteger.pro b/tests/auto/corelib/thread/qatomicinteger/qatomicinteger.pro index 373e8801a4..58e5b157bd 100644 --- a/tests/auto/corelib/thread/qatomicinteger/qatomicinteger.pro +++ b/tests/auto/corelib/thread/qatomicinteger/qatomicinteger.pro @@ -17,3 +17,42 @@ SUBDIRS=\ ushort \ wchar_t \ + +contains(QT_CONFIG, c++11)|msvc: SUBDIRS +=\ + cxx11/char \ + cxx11/char16_t \ + cxx11/char32_t \ + cxx11/int \ + cxx11/long \ + cxx11/qlonglong \ + cxx11/qptrdiff \ + cxx11/quintptr \ + cxx11/qulonglong \ + cxx11/schar \ + cxx11/short \ + cxx11/uchar \ + cxx11/uint \ + cxx11/ulong \ + cxx11/ushort \ + cxx11/wchar_t \ + + +# The GCC-style atomics only support 32-bit and pointer-sized but add +# them all anyway so we ensure the macros are properly defined +gcc: SUBDIRS +=\ + gcc/char \ + gcc/char16_t \ + gcc/char32_t \ + gcc/int \ + gcc/long \ + gcc/qlonglong \ + gcc/qptrdiff \ + gcc/quintptr \ + gcc/qulonglong \ + gcc/schar \ + gcc/short \ + gcc/uchar \ + gcc/uint \ + gcc/ulong \ + gcc/ushort \ + gcc/wchar_t \ diff --git a/tests/auto/corelib/thread/qatomicinteger/qlonglong/qlonglong.pro b/tests/auto/corelib/thread/qatomicinteger/qlonglong/qlonglong.pro index 51ef1add8f..1e97d5cbae 100644 --- a/tests/auto/corelib/thread/qatomicinteger/qlonglong/qlonglong.pro +++ b/tests/auto/corelib/thread/qatomicinteger/qlonglong/qlonglong.pro @@ -1,2 +1 @@ -TYPE = $$basename(PWD) include(../qatomicinteger.pri) diff --git a/tests/auto/corelib/thread/qatomicinteger/qptrdiff/qptrdiff.pro b/tests/auto/corelib/thread/qatomicinteger/qptrdiff/qptrdiff.pro index 51ef1add8f..1e97d5cbae 100644 --- a/tests/auto/corelib/thread/qatomicinteger/qptrdiff/qptrdiff.pro +++ b/tests/auto/corelib/thread/qatomicinteger/qptrdiff/qptrdiff.pro @@ -1,2 +1 @@ -TYPE = $$basename(PWD) include(../qatomicinteger.pri) diff --git a/tests/auto/corelib/thread/qatomicinteger/quintptr/quintptr.pro b/tests/auto/corelib/thread/qatomicinteger/quintptr/quintptr.pro index 51ef1add8f..1e97d5cbae 100644 --- a/tests/auto/corelib/thread/qatomicinteger/quintptr/quintptr.pro +++ b/tests/auto/corelib/thread/qatomicinteger/quintptr/quintptr.pro @@ -1,2 +1 @@ -TYPE = $$basename(PWD) include(../qatomicinteger.pri) diff --git a/tests/auto/corelib/thread/qatomicinteger/qulonglong/qulonglong.pro b/tests/auto/corelib/thread/qatomicinteger/qulonglong/qulonglong.pro index 51ef1add8f..1e97d5cbae 100644 --- a/tests/auto/corelib/thread/qatomicinteger/qulonglong/qulonglong.pro +++ b/tests/auto/corelib/thread/qatomicinteger/qulonglong/qulonglong.pro @@ -1,2 +1 @@ -TYPE = $$basename(PWD) include(../qatomicinteger.pri) diff --git a/tests/auto/corelib/thread/qatomicinteger/schar/schar.pro b/tests/auto/corelib/thread/qatomicinteger/schar/schar.pro index 51ef1add8f..1e97d5cbae 100644 --- a/tests/auto/corelib/thread/qatomicinteger/schar/schar.pro +++ b/tests/auto/corelib/thread/qatomicinteger/schar/schar.pro @@ -1,2 +1 @@ -TYPE = $$basename(PWD) include(../qatomicinteger.pri) diff --git a/tests/auto/corelib/thread/qatomicinteger/short/short.pro b/tests/auto/corelib/thread/qatomicinteger/short/short.pro index 51ef1add8f..1e97d5cbae 100644 --- a/tests/auto/corelib/thread/qatomicinteger/short/short.pro +++ b/tests/auto/corelib/thread/qatomicinteger/short/short.pro @@ -1,2 +1 @@ -TYPE = $$basename(PWD) include(../qatomicinteger.pri) diff --git a/tests/auto/corelib/thread/qatomicinteger/tst_qatomicinteger.cpp b/tests/auto/corelib/thread/qatomicinteger/tst_qatomicinteger.cpp index cb01237b85..d3c85c54a7 100644 --- a/tests/auto/corelib/thread/qatomicinteger/tst_qatomicinteger.cpp +++ b/tests/auto/corelib/thread/qatomicinteger/tst_qatomicinteger.cpp @@ -31,6 +31,30 @@ ** ****************************************************************************/ +#ifdef QT_ATOMIC_FORCE_CXX11 +// We need to check if this compiler has C++11 atomics and constexpr support. +// We can't rely on qcompilerdetection.h because it forces all of qglobal.h to +// be included, which causes qbasicatomic.h to be included too. +// Incomplete, but ok +# if defined(__INTEL_COMPILER) && __INTEL_COMPILER >= 1500 && (__cplusplus >= 201103L || defined(__INTEL_CXX11_MODE__)) +# elif defined(__clang__) && (__cplusplus >= 201103L || defined(__GXX_EXPERIMENTAL_CXX0X__)) +# if !__has_feature(cxx_constexpr) || !__has_feature(cxx_atomic) || !__has_include() +# undef QT_ATOMIC_FORCE_CXX11 +# endif +# elif defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) >= 407 && (__cplusplus >= 201103L || defined(__GXX_EXPERIMENTAL_CXX0X__)) +# elif defined(_MSC_VER) && _MSC_VER >= 1900 + // We need MSVC 2015 because of: atomics (2012), constexpr (2015), and unrestricted unions (2015). + // Support for constexpr is not working completely on MSVC 2015 but it's enough for the test. +# else +# undef QT_ATOMIC_FORCE_CXX11 +# endif + +# ifndef QT_ATOMIC_FORCE_CXX11 +# undef QATOMIC_TEST_TYPE +# define QATOMIC_TEST_TYPE unsupported +# endif +#endif + #include #include diff --git a/tests/auto/corelib/thread/qatomicinteger/uchar/uchar.pro b/tests/auto/corelib/thread/qatomicinteger/uchar/uchar.pro index 51ef1add8f..1e97d5cbae 100644 --- a/tests/auto/corelib/thread/qatomicinteger/uchar/uchar.pro +++ b/tests/auto/corelib/thread/qatomicinteger/uchar/uchar.pro @@ -1,2 +1 @@ -TYPE = $$basename(PWD) include(../qatomicinteger.pri) diff --git a/tests/auto/corelib/thread/qatomicinteger/uint/uint.pro b/tests/auto/corelib/thread/qatomicinteger/uint/uint.pro index 51ef1add8f..1e97d5cbae 100644 --- a/tests/auto/corelib/thread/qatomicinteger/uint/uint.pro +++ b/tests/auto/corelib/thread/qatomicinteger/uint/uint.pro @@ -1,2 +1 @@ -TYPE = $$basename(PWD) include(../qatomicinteger.pri) diff --git a/tests/auto/corelib/thread/qatomicinteger/ulong/ulong.pro b/tests/auto/corelib/thread/qatomicinteger/ulong/ulong.pro index 51ef1add8f..1e97d5cbae 100644 --- a/tests/auto/corelib/thread/qatomicinteger/ulong/ulong.pro +++ b/tests/auto/corelib/thread/qatomicinteger/ulong/ulong.pro @@ -1,2 +1 @@ -TYPE = $$basename(PWD) include(../qatomicinteger.pri) diff --git a/tests/auto/corelib/thread/qatomicinteger/ushort/ushort.pro b/tests/auto/corelib/thread/qatomicinteger/ushort/ushort.pro index 51ef1add8f..1e97d5cbae 100644 --- a/tests/auto/corelib/thread/qatomicinteger/ushort/ushort.pro +++ b/tests/auto/corelib/thread/qatomicinteger/ushort/ushort.pro @@ -1,2 +1 @@ -TYPE = $$basename(PWD) include(../qatomicinteger.pri) diff --git a/tests/auto/corelib/thread/qatomicinteger/wchar_t/wchar_t.pro b/tests/auto/corelib/thread/qatomicinteger/wchar_t/wchar_t.pro index 51ef1add8f..1e97d5cbae 100644 --- a/tests/auto/corelib/thread/qatomicinteger/wchar_t/wchar_t.pro +++ b/tests/auto/corelib/thread/qatomicinteger/wchar_t/wchar_t.pro @@ -1,2 +1 @@ -TYPE = $$basename(PWD) include(../qatomicinteger.pri) -- cgit v1.2.3