diff options
author | Liang Qi <liang.qi@qt.io> | 2016-05-12 07:31:50 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2016-05-12 08:33:08 +0200 |
commit | 990969655c5fb4d03682e96df9b12101f5ee9815 (patch) | |
tree | b8fb5c50285105c8bc5a938fb50f93ff9f24889d /tests/auto/other | |
parent | a213011a53f12f101d08a04afc8fdacd2d54a232 (diff) | |
parent | e64b2234e829cc47872225debcf80d6c06db18f0 (diff) |
Merge remote-tracking branch 'origin/5.7' into dev
Conflicts:
config_help.txt
configure
src/corelib/io/qprocess_wince.cpp
src/plugins/platforms/windows/qwindowstheme.cpp
src/plugins/platforms/xcb/qxcbbackingstore.cpp
tests/auto/corelib/tools/qtimezone/BLACKLIST
tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp
tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
Change-Id: I26644d1cb3b78412c8ff285e2a55bea1bd641c01
Diffstat (limited to 'tests/auto/other')
-rw-r--r-- | tests/auto/other/compiler/tst_compiler.cpp | 90 |
1 files changed, 85 insertions, 5 deletions
diff --git a/tests/auto/other/compiler/tst_compiler.cpp b/tests/auto/other/compiler/tst_compiler.cpp index d554a50c8d..50cfe48cdf 100644 --- a/tests/auto/other/compiler/tst_compiler.cpp +++ b/tests/auto/other/compiler/tst_compiler.cpp @@ -679,25 +679,105 @@ void tst_Compiler::cxx11_atomics() #endif } +QT_WARNING_PUSH +QT_WARNING_DISABLE_CLANG("-Wignored-attributes") +QT_WARNING_DISABLE_CLANG("-Wunused-local-typedefs") +QT_WARNING_DISABLE_GCC("-Wattributes") +QT_WARNING_DISABLE_GCC("-Wunused-local-typedefs") + +#ifndef __has_cpp_attribute +# define __has_cpp_attribute(x) 0 +#endif +#ifdef Q_COMPILER_ATTRIBUTES +[[noreturn]] void attribute_f1(); +void attribute_f2 [[noreturn]] (); +# if (defined(__cpp_namespace_attributes) && __cpp_namespace_attributes >= 201411) && __has_cpp_attribute(deprecated) +namespace NS [[deprecated]] { } +# endif +#endif + void tst_Compiler::cxx11_attributes() { #ifndef Q_COMPILER_ATTRIBUTES QSKIP("Compiler does not support C++11 feature"); #else - struct [[deprecated]] C {}; + // Attributes in function parameters and using clauses cause MSVC 2015 to crash + // https://connect.microsoft.com/VisualStudio/feedback/details/2011594 +# if (!defined(Q_CC_MSVC) || _MSC_FULL_VER >= 190023811) && !defined(Q_CC_INTEL) + void f([[ ]] int); + [[ ]] using namespace QtPrivate; + [[ ]] try { + } catch ([[]] int) { + } +# endif + + struct [[ ]] A { }; + struct B : A { + [[ ]] int m_i : 32; + [[noreturn]] void f() const { ::exit(0); } + +# ifdef Q_COMPILER_DEFAULT_DELETE_MEMBERS + [[ ]] ~B() = default; + [[ ]] B(const B &) = delete; +# endif + }; +# if __has_cpp_attribute(deprecated) + struct [[deprecated]] C { }; +# endif + enum [[ ]] E { }; + [[ ]] void [[ ]] * [[ ]] * [[ ]] ptr = 0; + int B::* [[ ]] pmm = 0; + +# if __has_cpp_attribute(deprecated) + enum [[deprecated]] E2 { +# if defined(__cpp_enumerator_attributes) && __cpp_enumerator_attributes >= 201411 + value [[deprecated]] = 0 +# endif + }; +# endif +# ifdef Q_COMPILER_LAMBDA + []()[[ ]] {}(); +# endif +# ifdef Q_COMPILER_TEMPLATE_ALIAS + using B2 [[ ]] = B; +# endif + + [[ ]] goto end; +# ifdef Q_CC_GNU + // Attributes in gnu:: namespace + [[gnu::unused]] end: + ; [[gnu::unused]] struct D {} d; - [[noreturn]] void f(); struct D e [[gnu::used, gnu::unused]]; - [[gnu::aligned(8)]] int i; + [[gnu::aligned(8)]] int i [[ ]]; + int array[][[]] = { 1 }; +# else + // Non GNU, so use an empty attribute + [[ ]] end: + ; + [[ ]] struct D {} d; + struct D e [[ ]]; + [[ ]] int i [[ ]]; + int array[][[]] = { 1 }; +# endif -[[gnu::unused]] end: - ; + int & [[ ]] lref = i; + int && [[ ]] rref = 1; + [[ ]] (void)1; + [[ ]] for (i = 0; i < 2; ++i) + ; + Q_UNUSED(ptr); + Q_UNUSED(pmm); Q_UNUSED(d); Q_UNUSED(e); Q_UNUSED(i); + Q_UNUSED(array); + Q_UNUSED(lref); + Q_UNUSED(rref); #endif } +QT_WARNING_POP #ifdef Q_COMPILER_AUTO_FUNCTION auto autoFunction() -> unsigned |