public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Avoid spurious test failures when -fno-inline in test flags
@ 2019-01-04 11:38 Jonathan Wakely
  2019-01-04 18:56 ` Jonathan Wakely
  0 siblings, 1 reply; 2+ messages in thread
From: Jonathan Wakely @ 2019-01-04 11:38 UTC (permalink / raw)
  To: libstdc++, gcc-patches

[-- Attachment #1: Type: text/plain, Size: 492 bytes --]

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.

Tested x86_64-linux, committed to trunk.



[-- Attachment #2: patch.txt --]
[-- Type: text/plain, Size: 2608 bytes --]

commit 6b4a77f22e8d63755453bdae3ce1854fae2d2484
Author: redi <redi@138bc75d-0d04-0410-961f-82ee72b054a4>
Date:   Fri Jan 4 11:06:49 2019 +0000

    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/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 6ac54b509df..bbe60e578ca 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 261c6641043..15f3a4bcbe1 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
 }

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] Avoid spurious test failures when -fno-inline in test flags
  2019-01-04 11:38 [PATCH] Avoid spurious test failures when -fno-inline in test flags Jonathan Wakely
@ 2019-01-04 18:56 ` Jonathan Wakely
  0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Wakely @ 2019-01-04 18:56 UTC (permalink / raw)
  To: libstdc++, gcc-patches

[-- Attachment #1: Type: text/plain, Size: 577 bytes --]

On 04/01/19 11:38 +0000, Jonathan Wakely wrote:
>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.

And another similar patch.

Tested x86_64-linux, committed to trunk.



[-- Attachment #2: patch.txt --]
[-- Type: text/x-patch, Size: 1116 bytes --]

commit 13388137fd5b141231daba34b55c176ed5b2c980
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Fri Jan 4 18:49:11 2019 +0000

    Fix test failure when -fno-inline is used
    
    This currently checks _GLIBCXX_USE_DUAL_ABI which is incorrect, as that
    can be true when _GLIBCXX_USE_CXX11_ABI == 0. The correct check would be
    _GLIBCXX_USE_CXX11_ABI == 1, but that's made redundant by the cxx11-abi
    effective target that the test requires. However, the test will fail if
    -fno-inline is used, so check __NO_INLINE__ instead.
    
            * testsuite/23_containers/list/61347.cc: Avoid spurious failure when
            -fno-inline added to test flags.

diff --git a/libstdc++-v3/testsuite/23_containers/list/61347.cc b/libstdc++-v3/testsuite/23_containers/list/61347.cc
index 0ae905848ec..178c306698f 100644
--- a/libstdc++-v3/testsuite/23_containers/list/61347.cc
+++ b/libstdc++-v3/testsuite/23_containers/list/61347.cc
@@ -42,7 +42,7 @@ void testc(const std::list<short>& l)
 
 int main()
 {
-#if _GLIBCXX_USE_DUAL_ABI
+#if ! __NO_INLINE__
   std::list<short> l;
   testm(l);
   testc(l);

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-01-04 18:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-04 11:38 [PATCH] Avoid spurious test failures when -fno-inline in test flags Jonathan Wakely
2019-01-04 18:56 ` Jonathan Wakely

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).