diff mbox series

[2/2] libstdc++: Replace stacktrace effective target with feature test

Message ID 20240323001908.384974-2-jwakely@redhat.com
State New
Headers show
Series [1/2] libstdc++: Add dg-require-cpp-feature-test to test feature test macros | expand

Commit Message

Jonathan Wakely March 22, 2024, 11:51 p.m. UTC
And this replaces an existing custom dg-require- directive with a use of
the new one that checks for a standard feature test macro. I didn't see
any other existing dg-require-xxx directives that can be replaced like
this.

-- >8 --

Remove the dejagnu code for checking whether std::stacktrace is supported
and just use the new dg-require-cpp-feature-test directive to check for
__cpp_lib_stacktrace instead.

libstdc++-v3/ChangeLog:

	* testsuite/19_diagnostics/stacktrace/current.cc: Check for
	__cpp_lib_stacktrace instead of check for stacktrace ET.
	* testsuite/19_diagnostics/stacktrace/entry.cc: Likewise.
	* testsuite/19_diagnostics/stacktrace/hash.cc: Likewise.
	* testsuite/19_diagnostics/stacktrace/output.cc: Likewise.
	* testsuite/19_diagnostics/stacktrace/stacktrace.cc: Likewise.
	* testsuite/19_diagnostics/stacktrace/synopsis.cc: Likewise.
	* testsuite/19_diagnostics/stacktrace/version.cc: Likewise.
	* testsuite/23_containers/vector/debug/assign4_backtrace_neg.cc:
	Likewise.
	* testsuite/lib/libstdc++.exp (check_effective_target_stacktrace):
	Remove.
---
 .../testsuite/19_diagnostics/stacktrace/current.cc        | 2 +-
 libstdc++-v3/testsuite/19_diagnostics/stacktrace/entry.cc | 2 +-
 libstdc++-v3/testsuite/19_diagnostics/stacktrace/hash.cc  | 2 +-
 .../testsuite/19_diagnostics/stacktrace/output.cc         | 2 +-
 .../testsuite/19_diagnostics/stacktrace/stacktrace.cc     | 2 +-
 .../testsuite/19_diagnostics/stacktrace/synopsis.cc       | 2 +-
 .../testsuite/19_diagnostics/stacktrace/version.cc        | 2 +-
 .../23_containers/vector/debug/assign4_backtrace_neg.cc   | 2 +-
 libstdc++-v3/testsuite/lib/libstdc++.exp                  | 8 --------
 9 files changed, 8 insertions(+), 16 deletions(-)

Comments

Jonathan Wakely March 26, 2024, 11:44 a.m. UTC | #1
Pushed to trunk.

On Sat, 23 Mar 2024 at 00:22, Jonathan Wakely <jwakely@redhat.com> wrote:
>
> And this replaces an existing custom dg-require- directive with a use of
> the new one that checks for a standard feature test macro. I didn't see
> any other existing dg-require-xxx directives that can be replaced like
> this.
>
> -- >8 --
>
> Remove the dejagnu code for checking whether std::stacktrace is supported
> and just use the new dg-require-cpp-feature-test directive to check for
> __cpp_lib_stacktrace instead.
>
> libstdc++-v3/ChangeLog:
>
>         * testsuite/19_diagnostics/stacktrace/current.cc: Check for
>         __cpp_lib_stacktrace instead of check for stacktrace ET.
>         * testsuite/19_diagnostics/stacktrace/entry.cc: Likewise.
>         * testsuite/19_diagnostics/stacktrace/hash.cc: Likewise.
>         * testsuite/19_diagnostics/stacktrace/output.cc: Likewise.
>         * testsuite/19_diagnostics/stacktrace/stacktrace.cc: Likewise.
>         * testsuite/19_diagnostics/stacktrace/synopsis.cc: Likewise.
>         * testsuite/19_diagnostics/stacktrace/version.cc: Likewise.
>         * testsuite/23_containers/vector/debug/assign4_backtrace_neg.cc:
>         Likewise.
>         * testsuite/lib/libstdc++.exp (check_effective_target_stacktrace):
>         Remove.
> ---
>  .../testsuite/19_diagnostics/stacktrace/current.cc        | 2 +-
>  libstdc++-v3/testsuite/19_diagnostics/stacktrace/entry.cc | 2 +-
>  libstdc++-v3/testsuite/19_diagnostics/stacktrace/hash.cc  | 2 +-
>  .../testsuite/19_diagnostics/stacktrace/output.cc         | 2 +-
>  .../testsuite/19_diagnostics/stacktrace/stacktrace.cc     | 2 +-
>  .../testsuite/19_diagnostics/stacktrace/synopsis.cc       | 2 +-
>  .../testsuite/19_diagnostics/stacktrace/version.cc        | 2 +-
>  .../23_containers/vector/debug/assign4_backtrace_neg.cc   | 2 +-
>  libstdc++-v3/testsuite/lib/libstdc++.exp                  | 8 --------
>  9 files changed, 8 insertions(+), 16 deletions(-)
>
> diff --git a/libstdc++-v3/testsuite/19_diagnostics/stacktrace/current.cc b/libstdc++-v3/testsuite/19_diagnostics/stacktrace/current.cc
> index a27836d27af..b1af5f74fb2 100644
> --- a/libstdc++-v3/testsuite/19_diagnostics/stacktrace/current.cc
> +++ b/libstdc++-v3/testsuite/19_diagnostics/stacktrace/current.cc
> @@ -1,6 +1,6 @@
>  // { dg-options "-lstdc++exp" }
>  // { dg-do run { target c++23 } }
> -// { dg-require-effective-target stacktrace }
> +// { dg-require-cpp-feature-test __cpp_lib_stacktrace }
>
>  #include <stacktrace>
>  #include <memory>
> diff --git a/libstdc++-v3/testsuite/19_diagnostics/stacktrace/entry.cc b/libstdc++-v3/testsuite/19_diagnostics/stacktrace/entry.cc
> index ab016d56400..bb348ebef8f 100644
> --- a/libstdc++-v3/testsuite/19_diagnostics/stacktrace/entry.cc
> +++ b/libstdc++-v3/testsuite/19_diagnostics/stacktrace/entry.cc
> @@ -1,6 +1,6 @@
>  // { dg-options "-lstdc++exp" }
>  // { dg-do run { target c++23 } }
> -// { dg-require-effective-target stacktrace }
> +// { dg-require-cpp-feature-test __cpp_lib_stacktrace }
>
>  #include <stacktrace>
>  #include "testsuite_hooks.h"
> diff --git a/libstdc++-v3/testsuite/19_diagnostics/stacktrace/hash.cc b/libstdc++-v3/testsuite/19_diagnostics/stacktrace/hash.cc
> index 21705098ff0..2176596ae5c 100644
> --- a/libstdc++-v3/testsuite/19_diagnostics/stacktrace/hash.cc
> +++ b/libstdc++-v3/testsuite/19_diagnostics/stacktrace/hash.cc
> @@ -1,6 +1,6 @@
>  // { dg-options "-lstdc++exp" }
>  // { dg-do run { target c++23 } }
> -// { dg-require-effective-target stacktrace }
> +// { dg-require-cpp-feature-test __cpp_lib_stacktrace }
>
>  #include <stacktrace>
>  #include <testsuite_allocator.h>
> diff --git a/libstdc++-v3/testsuite/19_diagnostics/stacktrace/output.cc b/libstdc++-v3/testsuite/19_diagnostics/stacktrace/output.cc
> index 67f1e0cebaf..e27aea1f508 100644
> --- a/libstdc++-v3/testsuite/19_diagnostics/stacktrace/output.cc
> +++ b/libstdc++-v3/testsuite/19_diagnostics/stacktrace/output.cc
> @@ -1,6 +1,6 @@
>  // { dg-options "-lstdc++exp" }
>  // { dg-do run { target c++23 } }
> -// { dg-require-effective-target stacktrace }
> +// { dg-require-cpp-feature-test __cpp_lib_stacktrace }
>  // { dg-add-options no_pch }
>
>  #include <stacktrace>
> diff --git a/libstdc++-v3/testsuite/19_diagnostics/stacktrace/stacktrace.cc b/libstdc++-v3/testsuite/19_diagnostics/stacktrace/stacktrace.cc
> index 5dfa76951df..070c4157471 100644
> --- a/libstdc++-v3/testsuite/19_diagnostics/stacktrace/stacktrace.cc
> +++ b/libstdc++-v3/testsuite/19_diagnostics/stacktrace/stacktrace.cc
> @@ -1,6 +1,6 @@
>  // { dg-options "-lstdc++exp" }
>  // { dg-do run { target c++23 } }
> -// { dg-require-effective-target stacktrace }
> +// { dg-require-cpp-feature-test __cpp_lib_stacktrace }
>
>  #include <stacktrace>
>  #include "testsuite_allocator.h"
> diff --git a/libstdc++-v3/testsuite/19_diagnostics/stacktrace/synopsis.cc b/libstdc++-v3/testsuite/19_diagnostics/stacktrace/synopsis.cc
> index 9e775b86ac9..b99d382ec26 100644
> --- a/libstdc++-v3/testsuite/19_diagnostics/stacktrace/synopsis.cc
> +++ b/libstdc++-v3/testsuite/19_diagnostics/stacktrace/synopsis.cc
> @@ -1,5 +1,5 @@
>  // { dg-do compile { target c++23 } }
> -// { dg-require-effective-target stacktrace }
> +// { dg-require-cpp-feature-test __cpp_lib_stacktrace }
>  // { dg-require-normal-namespace "" }
>  // { dg-add-options no_pch }
>
> diff --git a/libstdc++-v3/testsuite/19_diagnostics/stacktrace/version.cc b/libstdc++-v3/testsuite/19_diagnostics/stacktrace/version.cc
> index 21c2d48b7b5..1fc7722a6f4 100644
> --- a/libstdc++-v3/testsuite/19_diagnostics/stacktrace/version.cc
> +++ b/libstdc++-v3/testsuite/19_diagnostics/stacktrace/version.cc
> @@ -1,5 +1,5 @@
>  // { dg-do preprocess { target c++23 } }
> -// { dg-require-effective-target stacktrace }
> +// { dg-require-cpp-feature-test __cpp_lib_stacktrace }
>  // { dg-add-options no_pch }
>
>  #include <version>
> diff --git a/libstdc++-v3/testsuite/23_containers/vector/debug/assign4_backtrace_neg.cc b/libstdc++-v3/testsuite/23_containers/vector/debug/assign4_backtrace_neg.cc
> index 43a82fb1201..2f7238c590c 100644
> --- a/libstdc++-v3/testsuite/23_containers/vector/debug/assign4_backtrace_neg.cc
> +++ b/libstdc++-v3/testsuite/23_containers/vector/debug/assign4_backtrace_neg.cc
> @@ -1,6 +1,6 @@
>  // { dg-do run { xfail *-*-* } }
>  // { dg-options "-D_GLIBCXX_DEBUG_BACKTRACE -lstdc++exp" }
> -// { dg-require-effective-target stacktrace }
> +// { dg-require-cpp-feature-test __cpp_lib_stacktrace }
>
>  #include <debug/vector>
>  #include <debug/checks.h>
> diff --git a/libstdc++-v3/testsuite/lib/libstdc++.exp b/libstdc++-v3/testsuite/lib/libstdc++.exp
> index 2b31c950826..67a63f5b5f3 100644
> --- a/libstdc++-v3/testsuite/lib/libstdc++.exp
> +++ b/libstdc++-v3/testsuite/lib/libstdc++.exp
> @@ -1570,14 +1570,6 @@ proc check_effective_target_std_allocator_new { } {
>      }]
>  }
>
> -# Return 1 if libstdc++ was built as --enable-libstdcxx-backtrace
> -proc check_effective_target_stacktrace { } {
> -    return [check_v3_target_prop_cached et_stacktrace {
> -       set cond "_GLIBCXX_HAVE_STACKTRACE && _GLIBCXX_HOSTED"
> -       return [v3_check_preprocessor_condition stacktrace $cond]
> -    }]
> -}
> -
>  # Return 1 if RTTI is enabled by the current test flags.
>  proc check_effective_target_rtti { } {
>      return [check_v3_target_prop_cached et_rtti {
> --
> 2.44.0
>
diff mbox series

Patch

diff --git a/libstdc++-v3/testsuite/19_diagnostics/stacktrace/current.cc b/libstdc++-v3/testsuite/19_diagnostics/stacktrace/current.cc
index a27836d27af..b1af5f74fb2 100644
--- a/libstdc++-v3/testsuite/19_diagnostics/stacktrace/current.cc
+++ b/libstdc++-v3/testsuite/19_diagnostics/stacktrace/current.cc
@@ -1,6 +1,6 @@ 
 // { dg-options "-lstdc++exp" }
 // { dg-do run { target c++23 } }
-// { dg-require-effective-target stacktrace }
+// { dg-require-cpp-feature-test __cpp_lib_stacktrace }
 
 #include <stacktrace>
 #include <memory>
diff --git a/libstdc++-v3/testsuite/19_diagnostics/stacktrace/entry.cc b/libstdc++-v3/testsuite/19_diagnostics/stacktrace/entry.cc
index ab016d56400..bb348ebef8f 100644
--- a/libstdc++-v3/testsuite/19_diagnostics/stacktrace/entry.cc
+++ b/libstdc++-v3/testsuite/19_diagnostics/stacktrace/entry.cc
@@ -1,6 +1,6 @@ 
 // { dg-options "-lstdc++exp" }
 // { dg-do run { target c++23 } }
-// { dg-require-effective-target stacktrace }
+// { dg-require-cpp-feature-test __cpp_lib_stacktrace }
 
 #include <stacktrace>
 #include "testsuite_hooks.h"
diff --git a/libstdc++-v3/testsuite/19_diagnostics/stacktrace/hash.cc b/libstdc++-v3/testsuite/19_diagnostics/stacktrace/hash.cc
index 21705098ff0..2176596ae5c 100644
--- a/libstdc++-v3/testsuite/19_diagnostics/stacktrace/hash.cc
+++ b/libstdc++-v3/testsuite/19_diagnostics/stacktrace/hash.cc
@@ -1,6 +1,6 @@ 
 // { dg-options "-lstdc++exp" }
 // { dg-do run { target c++23 } }
-// { dg-require-effective-target stacktrace }
+// { dg-require-cpp-feature-test __cpp_lib_stacktrace }
 
 #include <stacktrace>
 #include <testsuite_allocator.h>
diff --git a/libstdc++-v3/testsuite/19_diagnostics/stacktrace/output.cc b/libstdc++-v3/testsuite/19_diagnostics/stacktrace/output.cc
index 67f1e0cebaf..e27aea1f508 100644
--- a/libstdc++-v3/testsuite/19_diagnostics/stacktrace/output.cc
+++ b/libstdc++-v3/testsuite/19_diagnostics/stacktrace/output.cc
@@ -1,6 +1,6 @@ 
 // { dg-options "-lstdc++exp" }
 // { dg-do run { target c++23 } }
-// { dg-require-effective-target stacktrace }
+// { dg-require-cpp-feature-test __cpp_lib_stacktrace }
 // { dg-add-options no_pch }
 
 #include <stacktrace>
diff --git a/libstdc++-v3/testsuite/19_diagnostics/stacktrace/stacktrace.cc b/libstdc++-v3/testsuite/19_diagnostics/stacktrace/stacktrace.cc
index 5dfa76951df..070c4157471 100644
--- a/libstdc++-v3/testsuite/19_diagnostics/stacktrace/stacktrace.cc
+++ b/libstdc++-v3/testsuite/19_diagnostics/stacktrace/stacktrace.cc
@@ -1,6 +1,6 @@ 
 // { dg-options "-lstdc++exp" }
 // { dg-do run { target c++23 } }
-// { dg-require-effective-target stacktrace }
+// { dg-require-cpp-feature-test __cpp_lib_stacktrace }
 
 #include <stacktrace>
 #include "testsuite_allocator.h"
diff --git a/libstdc++-v3/testsuite/19_diagnostics/stacktrace/synopsis.cc b/libstdc++-v3/testsuite/19_diagnostics/stacktrace/synopsis.cc
index 9e775b86ac9..b99d382ec26 100644
--- a/libstdc++-v3/testsuite/19_diagnostics/stacktrace/synopsis.cc
+++ b/libstdc++-v3/testsuite/19_diagnostics/stacktrace/synopsis.cc
@@ -1,5 +1,5 @@ 
 // { dg-do compile { target c++23 } }
-// { dg-require-effective-target stacktrace }
+// { dg-require-cpp-feature-test __cpp_lib_stacktrace }
 // { dg-require-normal-namespace "" }
 // { dg-add-options no_pch }
 
diff --git a/libstdc++-v3/testsuite/19_diagnostics/stacktrace/version.cc b/libstdc++-v3/testsuite/19_diagnostics/stacktrace/version.cc
index 21c2d48b7b5..1fc7722a6f4 100644
--- a/libstdc++-v3/testsuite/19_diagnostics/stacktrace/version.cc
+++ b/libstdc++-v3/testsuite/19_diagnostics/stacktrace/version.cc
@@ -1,5 +1,5 @@ 
 // { dg-do preprocess { target c++23 } }
-// { dg-require-effective-target stacktrace }
+// { dg-require-cpp-feature-test __cpp_lib_stacktrace }
 // { dg-add-options no_pch }
 
 #include <version>
diff --git a/libstdc++-v3/testsuite/23_containers/vector/debug/assign4_backtrace_neg.cc b/libstdc++-v3/testsuite/23_containers/vector/debug/assign4_backtrace_neg.cc
index 43a82fb1201..2f7238c590c 100644
--- a/libstdc++-v3/testsuite/23_containers/vector/debug/assign4_backtrace_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/vector/debug/assign4_backtrace_neg.cc
@@ -1,6 +1,6 @@ 
 // { dg-do run { xfail *-*-* } }
 // { dg-options "-D_GLIBCXX_DEBUG_BACKTRACE -lstdc++exp" }
-// { dg-require-effective-target stacktrace }
+// { dg-require-cpp-feature-test __cpp_lib_stacktrace }
 
 #include <debug/vector>
 #include <debug/checks.h>
diff --git a/libstdc++-v3/testsuite/lib/libstdc++.exp b/libstdc++-v3/testsuite/lib/libstdc++.exp
index 2b31c950826..67a63f5b5f3 100644
--- a/libstdc++-v3/testsuite/lib/libstdc++.exp
+++ b/libstdc++-v3/testsuite/lib/libstdc++.exp
@@ -1570,14 +1570,6 @@  proc check_effective_target_std_allocator_new { } {
     }]
 }
 
-# Return 1 if libstdc++ was built as --enable-libstdcxx-backtrace
-proc check_effective_target_stacktrace { } {
-    return [check_v3_target_prop_cached et_stacktrace {
-	set cond "_GLIBCXX_HAVE_STACKTRACE && _GLIBCXX_HOSTED"
-	return [v3_check_preprocessor_condition stacktrace $cond]
-    }]
-}
-
 # Return 1 if RTTI is enabled by the current test flags.
 proc check_effective_target_rtti { } {
     return [check_v3_target_prop_cached et_rtti {