Message ID | 20240618182201.3518098-1-thiago.bauermann@linaro.org |
---|---|
State | New |
Headers | show |
Series | libstdc++: testsuite: Skip atomics test if there's no -latomic | expand |
diff --git a/gcc/testsuite/lib/target-supports-dg.exp b/gcc/testsuite/lib/target-supports-dg.exp index 6dce9fdc1ce2..502e4e22b368 100644 --- a/gcc/testsuite/lib/target-supports-dg.exp +++ b/gcc/testsuite/lib/target-supports-dg.exp @@ -698,3 +698,12 @@ proc dg-require-prog-name-available { args } { } } +# If the atomic library is supported on this target, skip this test. + +proc dg-require-libatomic-available { args } { + set libatomic_available [check_effective_target_libatomic_available] + if { $libatomic_available == 0 } { + upvar dg-do-what dg-do-what + set dg-do-what [list [lindex ${dg-do-what} 0] "N" "P"] + } +} diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index e307f4e69efb..de27297c1787 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -1662,7 +1662,7 @@ proc check_iconv_available { test_what } { proc check_effective_target_libatomic_available { } { return [check_no_compiler_messages libatomic_available executable { int main (void) { return 0; } - } "-latomic"] + } "[atomic_link_flags [get_multilibs]] -latomic"] } # Return 1 if an ASCII locale is supported on this host, 0 otherwise. diff --git a/libstdc++-v3/testsuite/29_atomics/atomic_float/compare_exchange_padding.cc b/libstdc++-v3/testsuite/29_atomics/atomic_float/compare_exchange_padding.cc index 49626ac66511..351244b25279 100644 --- a/libstdc++-v3/testsuite/29_atomics/atomic_float/compare_exchange_padding.cc +++ b/libstdc++-v3/testsuite/29_atomics/atomic_float/compare_exchange_padding.cc @@ -1,4 +1,5 @@ // { dg-do run { target c++20 } } +// { dg-require-libatomic-available "" } // { dg-options "-O0" } // { dg-additional-options "[atomic_link_flags [get_multilibs]] -latomic" }