From ff03a142dcdb8e2225a57f62bbc7679c384e88e5 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 C++ "split files" 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: g++.dg/compat/eh/ctor1 cp_compat_main_tst.o compile
[-PASS:-]{+UNSUPPORTED:+} g++.dg/compat/eh/ctor1 cp_compat_x_tst.o [-compile-]{+compile: exception handling disabled+}
[-PASS:-]{+UNSUPPORTED:+} g++.dg/compat/eh/ctor1 cp_compat_y_tst.o [-compile-]{+compile: exception handling disabled+}
[-PASS:-]{+UNRESOLVED:+} g++.dg/compat/eh/ctor1 cp_compat_x_tst.o-cp_compat_y_tst.o link
[-PASS:-]{+UNRESOLVED:+} g++.dg/compat/eh/ctor1 cp_compat_x_tst.o-cp_compat_y_tst.o execute
..., or:
[-PASS:-]{+UNSUPPORTED:+} g++.dg/lto/20081109-1 cp_lto_20081109-1_0.o [-assemble,-]{+assemble: exception handling disabled+}
{+UNRESOLVED: g++.dg/lto/20081109-1 cp_lto_20081109-1_0.o-cp_lto_20081109-1_0.o execute+} -fPIC -flto -flto-partition=1to1
[-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
The "compile"/"assemble" ones (either continue to work, or) result in the
expected 'UNSUPPORTED: [...] compile: exception handling disabled', but
"link" and "execute" ones then turn UNRESOLVED.
Specify 'dg-require-effective-target exceptions_enabled' for those test cases.
gcc/testsuite/
* g++.dg/compat/eh/ctor1_main.C: Specify
'dg-require-effective-target exceptions_enabled'.
* g++.dg/compat/eh/ctor2_main.C: Likewise.
* g++.dg/compat/eh/dtor1_main.C: Likewise.
* g++.dg/compat/eh/filter1_main.C: Likewise.
* g++.dg/compat/eh/filter2_main.C: Likewise.
* g++.dg/compat/eh/new1_main.C: Likewise.
* g++.dg/compat/eh/nrv1_main.C: Likewise.
* g++.dg/compat/eh/spec3_main.C: Likewise.
* g++.dg/compat/eh/template1_main.C: Likewise.
* g++.dg/compat/eh/unexpected1_main.C: Likewise.
* g++.dg/compat/init/array5_main.C: Likewise.
* g++.dg/lto/20081109-1_0.C: Likewise.
* 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/compat/eh/ctor1_main.C | 2 ++
gcc/testsuite/g++.dg/compat/eh/ctor2_main.C | 2 ++
gcc/testsuite/g++.dg/compat/eh/dtor1_main.C | 2 ++
gcc/testsuite/g++.dg/compat/eh/filter1_main.C | 2 ++
gcc/testsuite/g++.dg/compat/eh/filter2_main.C | 2 ++
gcc/testsuite/g++.dg/compat/eh/new1_main.C | 2 ++
gcc/testsuite/g++.dg/compat/eh/nrv1_main.C | 2 ++
gcc/testsuite/g++.dg/compat/eh/spec3_main.C | 2 ++
gcc/testsuite/g++.dg/compat/eh/template1_main.C | 2 ++
gcc/testsuite/g++.dg/compat/eh/unexpected1_main.C | 2 ++
gcc/testsuite/g++.dg/compat/init/array5_main.C | 2 ++
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 +
16 files changed, 28 insertions(+)
@@ -4,6 +4,8 @@
// Split into pieces for binary compatibility testing October 2002
+// { dg-require-effective-target exceptions_enabled }
+
extern void ctor1_x (void);
int
@@ -4,6 +4,8 @@
// Split into pieces for binary compatibility testing October 2002
+// { dg-require-effective-target exceptions_enabled }
+
extern void ctor2_x (void);
int main ()
@@ -5,6 +5,8 @@
// Split into pieces for binary compatibility testing October 2002
+// { dg-require-effective-target exceptions_enabled }
+
extern void dtor1_x (void);
int
@@ -2,6 +2,8 @@
// Split into pieces for binary compatibility testing October 2002
+// { dg-require-effective-target exceptions_enabled }
+
extern void filter1_x (void);
int
@@ -3,6 +3,8 @@
// Split into pieces for binary compatibility testing October 2002
+// { dg-require-effective-target exceptions_enabled }
+
extern void filter2_x (void);
int
@@ -4,6 +4,8 @@
// Split into pieces for binary compatibility testing October 2002
+// { dg-require-effective-target exceptions_enabled }
+
extern void new1_x (void);
int
@@ -3,6 +3,8 @@
// Split into pieces for binary compatibility testing October 2002
+// { dg-require-effective-target exceptions_enabled }
+
extern void nrv1_x (void);
int
@@ -3,6 +3,8 @@
// Split into pieces for binary compatibility testing October 2002
+// { dg-require-effective-target exceptions_enabled }
+
extern void spec3_x (void);
int
@@ -3,6 +3,8 @@
// Split into pieces for binary compatibility testing October 2002
+// { dg-require-effective-target exceptions_enabled }
+
extern void template1_x (void);
int
@@ -3,6 +3,8 @@
// Split into pieces for binary compatibility testing October 2002
+// { dg-require-effective-target exceptions_enabled }
+
extern void unexpected1_x ();
int
@@ -5,6 +5,8 @@
// Incorrect construction and destruction of multi-dimensional
// array of class.
+// { dg-require-effective-target exceptions_enabled }
+
extern void array5_x (void);
int
@@ -1,4 +1,5 @@
// { dg-lto-do link }
+// { dg-require-effective-target exceptions_enabled }
// { 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" }
@@ -1,3 +1,5 @@
+// { dg-require-effective-target exceptions_enabled }
+
extern "C" { void abort (void);}
int foo (int);
@@ -1,4 +1,5 @@
// { dg-lto-do link }
+// { dg-require-effective-target exceptions_enabled }
// { dg-extra-ld-options "-r -nostdlib -flinker-output=nolto-rel" }
#include "20091026-1_a.h"
@@ -1,4 +1,5 @@
// { dg-lto-do link }
+// { dg-require-effective-target exceptions_enabled }
// { dg-require-effective-target fpic }
// { dg-require-effective-target shared }
// { dg-lto-options { { -O -fPIC -flto } } }
@@ -1,5 +1,6 @@
// { dg-lto-do link }
// { dg-lto-options { { -O2 -fPIC -flto } } }
+// { dg-require-effective-target exceptions_enabled }
// { dg-require-effective-target shared }
// { dg-require-effective-target fpic }
// { dg-extra-ld-options "-shared -g" }
--
2.34.1