Skip a number of 'g++.dg/lto/' test cases for '-fno-exceptions' testing (was: Skip a number of C++ "split files" test cases for '-fno-exceptions' testing (was: Skip a number of C++ test cases for '-fno-exceptions' testing (was: Support in the GCC(/C++) te

Message ID 87h6m3t7mk.fsf@euler.schwinge.homeip.net
State Accepted
Headers
Series Skip a number of 'g++.dg/lto/' test cases for '-fno-exceptions' testing (was: Skip a number of C++ "split files" test cases for '-fno-exceptions' testing (was: Skip a number of C++ test cases for '-fno-exceptions' testing (was: Support in the GCC(/C++) te |

Checks

Context Check Description
snail/gcc-patch-check success Github commit url

Commit Message

Thomas Schwinge Nov. 3, 2023, 11:10 a.m. UTC
  Hi!

On 2023-06-15T17:47:57+0200, I wrote:
> [...], OK to push the attached
> "Skip a number of C++ "split files" test cases for '-fno-exceptions' testing"?

The 'g++.dg/lto/' parts of this pushed to master branch in
commit 94782ed70796427e6f4b15b1c2df91cd7bef28e8
"Skip a number of 'g++.dg/lto/' test cases for '-fno-exceptions' testing",
see attached.


Grüße
 Thomas


-----------------
Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955
  

Patch

From 94782ed70796427e6f4b15b1c2df91cd7bef28e8 Mon Sep 17 00:00:00 2001
From: Thomas Schwinge <thomas@codesourcery.com>
Date: Wed, 7 Jun 2023 16:11:11 +0200
Subject: [PATCH] Skip a number of 'g++.dg/lto/' test cases for
 '-fno-exceptions' testing

Running 'make check' with: 'RUNTESTFLAGS=--target_board=unix/-fno-exceptions',
'error: exception handling disabled' is triggered for C++ 'throw' etc. usage,
and per 'gcc/testsuite/lib/gcc-dg.exp:gcc-dg-prune':

    # If exceptions are disabled, mark tests expecting exceptions to be enabled
    # as unsupported.
    if { ![check_effective_target_exceptions_enabled] } {
        if [regexp "(^|\n)\[^\n\]*: error: exception handling disabled" $text] {
          return "::unsupported::exception handling disabled"
        }

..., which generally means:

    -PASS: [...] (test for excess errors)
    +UNSUPPORTED: [...]: exception handling disabled

However, this doesn't work for "split files" test cases.  For example:

    [-PASS:-]{+UNSUPPORTED:+} g++.dg/lto/20081109-1 cp_lto_20081109-1_0.o [-assemble, -fPIC -flto -flto-partition=1to1-]{+assemble: exception handling disabled+}
    [-PASS:-]{+UNRESOLVED:+} g++.dg/lto/20081109-1 cp_lto_20081109-1_0.o-cp_lto_20081109-1_0.o [-link,-]{+link+} -fPIC -flto -flto-partition=1to1
    {+UNRESOLVED: g++.dg/lto/20081109-1 cp_lto_20081109-1_0.o-cp_lto_20081109-1_0.o execute -fPIC -flto -flto-partition=1to1+}

The "compile"/"assemble" tests (either continue to work, or) result in the
expected 'UNSUPPORTED: [...] compile: exception handling disabled', but
dependent "link" and "execute" tests then turn UNRESOLVED.

Specify 'dg-require-effective-target exceptions_enabled' for those test cases.

	gcc/testsuite/
	* g++.dg/lto/20081109-1_0.C: Specify
	'dg-require-effective-target exceptions_enabled'.
	* g++.dg/lto/20081109_0.C: Likewise.
	* g++.dg/lto/20091026-1_0.C: Likewise.
	* g++.dg/lto/pr87906_0.C: Likewise.
	* g++.dg/lto/pr88046_0.C: Likewise.
---
 gcc/testsuite/g++.dg/lto/20081109-1_0.C | 1 +
 gcc/testsuite/g++.dg/lto/20081109_0.C   | 2 ++
 gcc/testsuite/g++.dg/lto/20091026-1_0.C | 1 +
 gcc/testsuite/g++.dg/lto/pr87906_0.C    | 1 +
 gcc/testsuite/g++.dg/lto/pr88046_0.C    | 1 +
 5 files changed, 6 insertions(+)

diff --git a/gcc/testsuite/g++.dg/lto/20081109-1_0.C b/gcc/testsuite/g++.dg/lto/20081109-1_0.C
index db0ba367fe8..7dc315b39ed 100644
--- a/gcc/testsuite/g++.dg/lto/20081109-1_0.C
+++ b/gcc/testsuite/g++.dg/lto/20081109-1_0.C
@@ -1,4 +1,5 @@ 
 // { dg-lto-do link }
+// Explicit { dg-require-effective-target exceptions_enabled } so that dependent tests don't turn UNRESOLVED for '-fno-exceptions'.
 // { dg-require-effective-target fpic }
 // { dg-lto-options {{-fPIC -flto -flto-partition=1to1}} }
 // { dg-extra-ld-options "-fPIC -flto -flto-partition=1to1 -r -fno-exceptions -flinker-output=nolto-rel" }
diff --git a/gcc/testsuite/g++.dg/lto/20081109_0.C b/gcc/testsuite/g++.dg/lto/20081109_0.C
index 93cfc67fff2..4746e1c7c46 100644
--- a/gcc/testsuite/g++.dg/lto/20081109_0.C
+++ b/gcc/testsuite/g++.dg/lto/20081109_0.C
@@ -1,3 +1,5 @@ 
+// Explicit { dg-require-effective-target exceptions_enabled } so that dependent tests don't turn UNRESOLVED for '-fno-exceptions'.
+
 extern "C" { void abort (void);}
 int foo (int);
 
diff --git a/gcc/testsuite/g++.dg/lto/20091026-1_0.C b/gcc/testsuite/g++.dg/lto/20091026-1_0.C
index 06eff292cb6..ca0729c52f5 100644
--- a/gcc/testsuite/g++.dg/lto/20091026-1_0.C
+++ b/gcc/testsuite/g++.dg/lto/20091026-1_0.C
@@ -1,4 +1,5 @@ 
 // { dg-lto-do link }
+// Explicit { dg-require-effective-target exceptions_enabled } so that dependent tests don't turn UNRESOLVED for '-fno-exceptions'.
 // { dg-extra-ld-options "-r -nostdlib -flinker-output=nolto-rel" }
 
 #include "20091026-1_a.h"
diff --git a/gcc/testsuite/g++.dg/lto/pr87906_0.C b/gcc/testsuite/g++.dg/lto/pr87906_0.C
index 6a04cd5c6f0..623c29ca007 100644
--- a/gcc/testsuite/g++.dg/lto/pr87906_0.C
+++ b/gcc/testsuite/g++.dg/lto/pr87906_0.C
@@ -1,4 +1,5 @@ 
 // { dg-lto-do link }
+// Explicit { dg-require-effective-target exceptions_enabled } so that dependent tests don't turn UNRESOLVED for '-fno-exceptions'.
 // { dg-require-effective-target fpic }
 // { dg-require-effective-target shared }
 // { dg-lto-options { { -O -fPIC -flto } } }
diff --git a/gcc/testsuite/g++.dg/lto/pr88046_0.C b/gcc/testsuite/g++.dg/lto/pr88046_0.C
index 734ce86e9b8..99224b5011f 100644
--- a/gcc/testsuite/g++.dg/lto/pr88046_0.C
+++ b/gcc/testsuite/g++.dg/lto/pr88046_0.C
@@ -1,5 +1,6 @@ 
 // { dg-lto-do link }
 // { dg-lto-options { { -O2 -fPIC -flto } } }
+// Explicit { dg-require-effective-target exceptions_enabled } so that dependent tests don't turn UNRESOLVED for '-fno-exceptions'.
 // { dg-require-effective-target shared }
 // { dg-require-effective-target fpic }
 // { dg-extra-ld-options "-shared -g" }
-- 
2.34.1