From: redi Date: Fri, 4 Jan 2019 11:06:49 +0000 (+0000) Subject: Avoid spurious test failures when -fno-inline in test flags X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6b4a77f22e8d63755453bdae3ce1854fae2d2484;p=thirdparty%2Fgcc.git Avoid spurious test failures when -fno-inline in test flags These tests rely on inlining, so if -fno-inline is added to the compiler flags the tests fail. Use the predefined __NO_INLINE__ macro to detect that situation, and don't bother testing the move assignment. * testsuite/21_strings/basic_string/modifiers/assign/char/ move_assign_optim.cc: Avoid spurious failure when -fno-inline added to test flags. * testsuite/21_strings/basic_string/modifiers/assign/wchar_t/ move_assign_optim.cc: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@267573 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 76fc247ad1d4..e6a2dc2ba700 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,11 @@ +2019-01-04 Jonathan Wakely + + * testsuite/21_strings/basic_string/modifiers/assign/char/ + move_assign_optim.cc: Avoid spurious failure when -fno-inline added + to test flags. + * testsuite/21_strings/basic_string/modifiers/assign/wchar_t/ + move_assign_optim.cc: Likewise. + 2019-01-03 Jonathan Wakely Jakub Jelinek diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/modifiers/assign/char/move_assign_optim.cc b/libstdc++-v3/testsuite/21_strings/basic_string/modifiers/assign/char/move_assign_optim.cc index 6ac54b509df5..bbe60e578cae 100644 --- a/libstdc++-v3/testsuite/21_strings/basic_string/modifiers/assign/char/move_assign_optim.cc +++ b/libstdc++-v3/testsuite/21_strings/basic_string/modifiers/assign/char/move_assign_optim.cc @@ -30,6 +30,8 @@ test01(std::string& target, std::string&& source) // The move assignment operator should be simple enough that the compiler // can see that it never results in a length_error or bad_alloc exception // (which would be turned into std::terminate by the noexcept on the - // assignment operator). + // assignment operator). This is only true when inlining though. +#ifndef __NO_INLINE__ target = std::move(source); +#endif } diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/modifiers/assign/wchar_t/move_assign_optim.cc b/libstdc++-v3/testsuite/21_strings/basic_string/modifiers/assign/wchar_t/move_assign_optim.cc index 261c66410434..15f3a4bcbe17 100644 --- a/libstdc++-v3/testsuite/21_strings/basic_string/modifiers/assign/wchar_t/move_assign_optim.cc +++ b/libstdc++-v3/testsuite/21_strings/basic_string/modifiers/assign/wchar_t/move_assign_optim.cc @@ -30,6 +30,8 @@ test01(std::wstring& target, std::wstring&& source) // The move assignment operator should be simple enough that the compiler // can see that it never results in a length_error or bad_alloc exception // (which would be turned into std::terminate by the noexcept on the - // assignment operator). + // assignment operator). This is only true when inlining though. +#ifndef __NO_INLINE__ target = std::move(source); +#endif }