https://gcc.gnu.org/g:5d05d496b2b4a3d4674b2e5a46d3a355abf4055d

commit r15-9552-g5d05d496b2b4a3d4674b2e5a46d3a355abf4055d
Author: Jakub Jelinek <ja...@redhat.com>
Date:   Thu Apr 17 12:14:15 2025 +0200

    libgomp: Don't test ompx::allocator::gnu_pinned_mem on non-linux targets.
    
    The libgomp.c/alloc-pinned*.c test have
    /* { dg-skip-if "Pinning not implemented on this host" { ! *-*-linux-gnu* } 
} */
    so they are only run on Linux targets right now.  Duplicating the tests or
    reworking them into headers looked like too much work for me right now this
    late in stage4, so I've just #ifdefed the uses at least for now.
    
    2025-04-17  Jakub Jelinek  <ja...@redhat.com>
    
            PR libgomp/119849
            * testsuite/libgomp.c++/allocator-1.C (test_inequality, main): Guard
            ompx::allocator::gnu_pinned_mem uses with #ifdef __gnu_linux__.
            * testsuite/libgomp.c++/allocator-2.C (main): Likewise.

Diff:
---
 libgomp/testsuite/libgomp.c++/allocator-1.C | 13 +++++++++++++
 libgomp/testsuite/libgomp.c++/allocator-2.C |  9 +++++++++
 2 files changed, 22 insertions(+)

diff --git a/libgomp/testsuite/libgomp.c++/allocator-1.C 
b/libgomp/testsuite/libgomp.c++/allocator-1.C
index f82072284883..49425386b33f 100644
--- a/libgomp/testsuite/libgomp.c++/allocator-1.C
+++ b/libgomp/testsuite/libgomp.c++/allocator-1.C
@@ -78,7 +78,10 @@ void test_inequality ()
   CHECK_INEQUALITY (omp::allocator::cgroup_mem, void);
   CHECK_INEQUALITY (omp::allocator::pteam_mem, void);
   CHECK_INEQUALITY (omp::allocator::thread_mem, void);
+#ifdef __gnu_linux__
+  /* Pinning not implemented on other targets.  */
   CHECK_INEQUALITY (ompx::allocator::gnu_pinned_mem, void);
+#endif
   /* And again with the same type passed to the allocator.  */
   CHECK_INEQUALITY (omp::allocator::null_allocator, T);
   CHECK_INEQUALITY (omp::allocator::default_mem, T);
@@ -89,7 +92,9 @@ void test_inequality ()
   CHECK_INEQUALITY (omp::allocator::cgroup_mem, T);
   CHECK_INEQUALITY (omp::allocator::pteam_mem, T);
   CHECK_INEQUALITY (omp::allocator::thread_mem, T);
+#ifdef __gnu_linux__
   CHECK_INEQUALITY (ompx::allocator::gnu_pinned_mem, T);
+#endif
 }
 
 #undef CHECK_INEQUALITY
@@ -121,7 +126,9 @@ int main ()
   test<int, omp::allocator::cgroup_mem>(42);
   test<int, omp::allocator::pteam_mem>(42);
   test<int, omp::allocator::thread_mem>(42);
+#ifdef __gnu_linux__
   test<int, ompx::allocator::gnu_pinned_mem>(42);
+#endif
 
   test<long long, omp::allocator::null_allocator>(42);
   test<long long, omp::allocator::default_mem>(42);
@@ -132,7 +139,9 @@ int main ()
   test<long long, omp::allocator::cgroup_mem>(42);
   test<long long, omp::allocator::pteam_mem>(42);
   test<long long, omp::allocator::thread_mem>(42);
+#ifdef __gnu_linux__
   test<long long, ompx::allocator::gnu_pinned_mem>(42);
+#endif
 
   test<S, omp::allocator::null_allocator>( S{42, true, 128.f});
   test<S, omp::allocator::default_mem>(    S{42, true, 128.f});
@@ -143,7 +152,9 @@ int main ()
   test<S, omp::allocator::cgroup_mem>(     S{42, true, 128.f});
   test<S, omp::allocator::pteam_mem>(      S{42, true, 128.f});
   test<S, omp::allocator::thread_mem>(     S{42, true, 128.f});
+#ifdef __gnu_linux__
   test<S, ompx::allocator::gnu_pinned_mem>(S{42, true, 128.f});
+#endif
 
   test_inequality<int, omp::allocator::null_allocator>();
   test_inequality<int, omp::allocator::default_mem>();
@@ -154,5 +165,7 @@ int main ()
   test_inequality<int, omp::allocator::cgroup_mem>();
   test_inequality<int, omp::allocator::pteam_mem>();
   test_inequality<int, omp::allocator::thread_mem>();
+#ifdef __gnu_linux__
   test_inequality<int, ompx::allocator::gnu_pinned_mem>();
+#endif
 }
diff --git a/libgomp/testsuite/libgomp.c++/allocator-2.C 
b/libgomp/testsuite/libgomp.c++/allocator-2.C
index d25b75501a99..ca94fc7e376e 100644
--- a/libgomp/testsuite/libgomp.c++/allocator-2.C
+++ b/libgomp/testsuite/libgomp.c++/allocator-2.C
@@ -86,7 +86,10 @@ int main ()
   f<int, omp::allocator::cgroup_mem     >(0, 1, 2, 3);
   f<int, omp::allocator::pteam_mem      >(0, 1, 2, 3);
   f<int, omp::allocator::thread_mem     >(0, 1, 2, 3);
+#ifdef __gnu_linux__
+  /* Pinning not implemented on other targets.  */
   f<int, ompx::allocator::gnu_pinned_mem>(0, 1, 2, 3);
+#endif
 
   f<long long, omp::allocator::null_allocator >(0, 1, 2, 3);
   f<long long, omp::allocator::default_mem    >(0, 1, 2, 3);
@@ -97,7 +100,9 @@ int main ()
   f<long long, omp::allocator::cgroup_mem     >(0, 1, 2, 3);
   f<long long, omp::allocator::pteam_mem      >(0, 1, 2, 3);
   f<long long, omp::allocator::thread_mem     >(0, 1, 2, 3);
+#ifdef __gnu_linux__
   f<long long, ompx::allocator::gnu_pinned_mem>(0, 1, 2, 3);
+#endif
 
   S0 s0_0{   42, true,  111128.f};
   S0 s0_1{  142, false,  11128.f};
@@ -112,7 +117,9 @@ int main ()
   f<S0, omp::allocator::cgroup_mem     >(s0_0, s0_1, s0_2, s0_3);
   f<S0, omp::allocator::pteam_mem      >(s0_0, s0_1, s0_2, s0_3);
   f<S0, omp::allocator::thread_mem     >(s0_0, s0_1, s0_2, s0_3);
+#ifdef __gnu_linux__
   f<S0, ompx::allocator::gnu_pinned_mem>(s0_0, s0_1, s0_2, s0_3);
+#endif
 
   S1 s1_0{   42, true,  111128.f};
   S1 s1_1{  142, false,  11128.f};
@@ -128,5 +135,7 @@ int main ()
   f<S1, omp::allocator::cgroup_mem     >(s1_0, s1_1, s1_2, s1_3);
   f<S1, omp::allocator::pteam_mem      >(s1_0, s1_1, s1_2, s1_3);
   f<S1, omp::allocator::thread_mem     >(s1_0, s1_1, s1_2, s1_3);
+#ifdef __gnu_linux__
   f<S1, ompx::allocator::gnu_pinned_mem>(s1_0, s1_1, s1_2, s1_3);
+#endif
 }

Reply via email to