https://gcc.gnu.org/g:6b31e42fa76b517a617d39d7fa8808afe770dd67

commit r13-9238-g6b31e42fa76b517a617d39d7fa8808afe770dd67
Author: Jonathan Wakely <jwak...@redhat.com>
Date:   Wed Nov 13 16:37:24 2024 +0000

    libstdc++: Use __is_single_threaded() in performance tests
    
    With recent glibc releases the __gthread_active_p() function is always
    true, so we always append "-thread" onto performance benchmark names.
    
    Use the __gnu_cxx::__is_single_threaded() function instead.
    
    libstdc++-v3/ChangeLog:
    
            * testsuite/util/testsuite_performance.h: Use
            __gnu_cxx::__is_single_threaded instead of __gthread_active_p().
    
    (cherry picked from commit 2b92007016ce8de3fc0a8c4508a789b822ea8e6b)

Diff:
---
 libstdc++-v3/testsuite/util/testsuite_performance.h | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/libstdc++-v3/testsuite/util/testsuite_performance.h 
b/libstdc++-v3/testsuite/util/testsuite_performance.h
index 4674d3f891ad..e561fa4f07ed 100644
--- a/libstdc++-v3/testsuite/util/testsuite_performance.h
+++ b/libstdc++-v3/testsuite/util/testsuite_performance.h
@@ -33,6 +33,7 @@
 #include <stdexcept>
 #include <sstream>
 #include <cxxabi.h>
+#include <ext/atomicity.h>
 #include <testsuite_common_types.h>
 
 #if defined (__linux__) || defined (__GLIBC__)
@@ -226,10 +227,8 @@ namespace __gnu_test
 
     std::ofstream out(name, std::ios_base::app);
 
-#ifdef __GTHREADS
-    if (__gthread_active_p())
+    if (!__gnu_cxx::__is_single_threaded())
       testname.append("-thread");
-#endif
 
     out.setf(std::ios_base::left);
     out << std::setw(25) << testname << tab;
@@ -256,10 +255,8 @@ namespace __gnu_test
 
     std::ofstream out(name, std::ios_base::app);
 
-#ifdef __GTHREADS
-    if (__gthread_active_p ())
+    if (!__gnu_cxx::__is_single_threaded ())
       testname.append("-thread");
-#endif
 
     out.setf(std::ios_base::left);
     out << std::setw(25) << testname << tab;

Reply via email to