openmp: Mark deprecated symbols in OpenMP 5.0
authorKwok Cheung Yeung <kcy@codesourcery.com>
Thu, 5 Nov 2020 18:11:23 +0000 (10:11 -0800)
committerKwok Cheung Yeung <kcy@codesourcery.com>
Thu, 5 Nov 2020 18:32:56 +0000 (10:32 -0800)
2020-11-05  Ulrich Drepper  <drepper@redhat.com>
    Kwok Cheung Yeung  <kcy@codesourcery.com>

libgomp/
* Makefile.am (%.mod): Add -cpp and -fopenmp to compile flags.
* Makefile.in: Regenerate.
* fortran.c: Wrap uses of omp_set_nested and omp_get_nested with
pragmas to ignore -Wdeprecated-declarations warnings.
* icv.c: Likewise.
* omp.h.in (__GOMP_DEPRECATED_5_0): Define.
Mark omp_lock_hint_* enum values, omp_lock_hint_t, omp_set_nested,
and omp_get_nested with __GOMP_DEPRECATED_5_0.
* omp_lib.f90.in: Mark omp_get_nested and omp_set_nested as
deprecated.
* testsuite/libgomp.c++/affinity-1.C: Add -Wno-deprecated-declarations
to test options.
* testsuite/libgomp.c/affinity-1.c: Likewise.
* testsuite/libgomp.c/affinity-2.c: Likewise.
* testsuite/libgomp.c/appendix-a/a.15.1.c: Likewise.
* testsuite/libgomp.c/lib-1.c: Likewise.
* testsuite/libgomp.c/nested-1.c: Likewise.
* testsuite/libgomp.c/nested-2.c: Likewise.
* testsuite/libgomp.c/nested-3.c: Likewise.
* testsuite/libgomp.c/pr32362-1.c: Likewise.
* testsuite/libgomp.c/pr32362-2.c: Likewise.
* testsuite/libgomp.c/pr32362-3.c: Likewise.
* testsuite/libgomp.c/pr35549.c: Likewise.
* testsuite/libgomp.c/pr42942.c: Likewise.
* testsuite/libgomp.c/pr61200.c: Likewise.
* testsuite/libgomp.c/sort-1.c: Likewise.
* testsuite/libgomp.c/target-5.c: Likewise.
* testsuite/libgomp.c/target-6.c: Likewise.
* testsuite/libgomp.c/teams-1.c: Likewise.
* testsuite/libgomp.c/thread-limit-1.c: Likewise.
* testsuite/libgomp.c/thread-limit-2.c: Likewise.
* testsuite/libgomp.c/thread-limit-4.c: Likewise.
* testsuite/libgomp.fortran/affinity1.f90: Likewise.
* testsuite/libgomp.fortran/lib1.f90: Likewise.
* testsuite/libgomp.fortran/lib2.f: Likewise.
* testsuite/libgomp.fortran/nested1.f90: Likewise.
* testsuite/libgomp.fortran/teams1.f90: Likewise.

32 files changed:
libgomp/Makefile.am
libgomp/Makefile.in
libgomp/fortran.c
libgomp/icv.c
libgomp/omp.h.in
libgomp/omp_lib.f90.in
libgomp/testsuite/libgomp.c++/affinity-1.C
libgomp/testsuite/libgomp.c/affinity-1.c
libgomp/testsuite/libgomp.c/affinity-2.c
libgomp/testsuite/libgomp.c/appendix-a/a.15.1.c
libgomp/testsuite/libgomp.c/lib-1.c
libgomp/testsuite/libgomp.c/nested-1.c
libgomp/testsuite/libgomp.c/nested-2.c
libgomp/testsuite/libgomp.c/nested-3.c
libgomp/testsuite/libgomp.c/pr32362-1.c
libgomp/testsuite/libgomp.c/pr32362-2.c
libgomp/testsuite/libgomp.c/pr32362-3.c
libgomp/testsuite/libgomp.c/pr35549.c
libgomp/testsuite/libgomp.c/pr42942.c
libgomp/testsuite/libgomp.c/pr61200.c
libgomp/testsuite/libgomp.c/sort-1.c
libgomp/testsuite/libgomp.c/target-5.c
libgomp/testsuite/libgomp.c/target-6.c
libgomp/testsuite/libgomp.c/teams-1.c
libgomp/testsuite/libgomp.c/thread-limit-1.c
libgomp/testsuite/libgomp.c/thread-limit-2.c
libgomp/testsuite/libgomp.c/thread-limit-4.c
libgomp/testsuite/libgomp.fortran/affinity1.f90
libgomp/testsuite/libgomp.fortran/lib1.f90
libgomp/testsuite/libgomp.fortran/lib2.f
libgomp/testsuite/libgomp.fortran/nested1.f90
libgomp/testsuite/libgomp.fortran/teams1.f90

index 586c930a4d7a98faa81ad1260ff03ac553069317..4cf1f58199531a9a687a9c49373fadcc18b50ed6 100644 (file)
@@ -92,7 +92,7 @@ openacc_kinds.mod: openacc.mod
 openacc.mod: openacc.lo
        :
 %.mod: %.f90
-       $(FC) $(FCFLAGS) -fsyntax-only $<
+       $(FC) $(FCFLAGS) -cpp -fopenmp -fsyntax-only $<
 fortran.lo: libgomp_f.h
 fortran.o: libgomp_f.h
 env.lo: libgomp_f.h
index 00d5e2919ee82f77de397f1fdabd7ac8a3675c55..eb868b36704ac3c01c1c2270fdbcffd1edb708a4 100644 (file)
@@ -1382,7 +1382,7 @@ openacc_kinds.mod: openacc.mod
 openacc.mod: openacc.lo
        :
 %.mod: %.f90
-       $(FC) $(FCFLAGS) -fsyntax-only $<
+       $(FC) $(FCFLAGS) -cpp -fopenmp -fsyntax-only $<
 fortran.lo: libgomp_f.h
 fortran.o: libgomp_f.h
 env.lo: libgomp_f.h
index 029dec17459412d04753f0eb10e307baede2c94b..cd719f92fc8360e4e13c4bfd83f61ad83fa6dc31 100644 (file)
@@ -47,10 +47,13 @@ ialias_redirect (omp_test_lock)
 ialias_redirect (omp_test_nest_lock)
 # endif
 ialias_redirect (omp_set_dynamic)
-ialias_redirect (omp_set_nested)
-ialias_redirect (omp_set_num_threads)
 ialias_redirect (omp_get_dynamic)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+ialias_redirect (omp_set_nested)
 ialias_redirect (omp_get_nested)
+#pragma GCC diagnostic pop
+ialias_redirect (omp_set_num_threads)
 ialias_redirect (omp_in_parallel)
 ialias_redirect (omp_get_max_threads)
 ialias_redirect (omp_get_num_procs)
@@ -281,6 +284,8 @@ omp_set_dynamic_8_ (const int64_t *set)
   omp_set_dynamic (!!*set);
 }
 
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
 void
 omp_set_nested_ (const int32_t *set)
 {
@@ -292,6 +297,7 @@ omp_set_nested_8_ (const int64_t *set)
 {
   omp_set_nested (!!*set);
 }
+#pragma GCC diagnostic pop
 
 void
 omp_set_num_threads_ (const int32_t *set)
@@ -311,11 +317,14 @@ omp_get_dynamic_ (void)
   return omp_get_dynamic ();
 }
 
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
 int32_t
 omp_get_nested_ (void)
 {
   return omp_get_nested ();
 }
+#pragma GCC diagnostic pop
 
 int32_t
 omp_in_parallel_ (void)
index 4da6527c9b82f43319047c65d9d79a12bb2455bc..8df15e385e705a799f4b82027d306a47df6e64cd 100644 (file)
@@ -51,6 +51,8 @@ omp_get_dynamic (void)
   return icv->dyn_var;
 }
 
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
 void
 omp_set_nested (int val)
 {
@@ -64,6 +66,7 @@ omp_get_nested (void)
   struct gomp_task_icv *icv = gomp_icv (false);
   return icv->nest_var;
 }
+#pragma GCC diagnostic pop
 
 void
 omp_set_schedule (omp_sched_t kind, int chunk_size)
@@ -222,10 +225,13 @@ omp_get_default_allocator (void)
 }
 
 ialias (omp_set_dynamic)
-ialias (omp_set_nested)
-ialias (omp_set_num_threads)
 ialias (omp_get_dynamic)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+ialias (omp_set_nested)
 ialias (omp_get_nested)
+#pragma GCC diagnostic pop
+ialias (omp_set_num_threads)
 ialias (omp_set_schedule)
 ialias (omp_get_schedule)
 ialias (omp_get_max_threads)
index a9e6c448dc3ca95fa6962e96e50aeeb887bef48e..be7df6d283f1c487ddd2d4e898fb050d3b7ae190 100644 (file)
 #ifndef _OMP_H
 #define _OMP_H 1
 
+#if defined(__GNUC__) && _OPENMP >= 201811
+# define __GOMP_DEPRECATED_5_0 __attribute__((__deprecated__))
+#else
+# define __GOMP_DEPRECATED_5_0
+#endif
+
 #ifndef _LIBGOMP_OMP_LOCK_DEFINED
 #define _LIBGOMP_OMP_LOCK_DEFINED 1
 /* These two structures get edited by the libgomp build process to 
@@ -66,18 +72,19 @@ typedef enum omp_proc_bind_t
 typedef enum omp_sync_hint_t
 {
   omp_sync_hint_none = 0,
-  omp_lock_hint_none = omp_sync_hint_none,
+  omp_lock_hint_none __GOMP_DEPRECATED_5_0 = omp_sync_hint_none,
   omp_sync_hint_uncontended = 1,
-  omp_lock_hint_uncontended = omp_sync_hint_uncontended,
+  omp_lock_hint_uncontended __GOMP_DEPRECATED_5_0 = omp_sync_hint_uncontended,
   omp_sync_hint_contended = 2,
-  omp_lock_hint_contended = omp_sync_hint_contended,
+  omp_lock_hint_contended __GOMP_DEPRECATED_5_0 = omp_sync_hint_contended,
   omp_sync_hint_nonspeculative = 4,
-  omp_lock_hint_nonspeculative = omp_sync_hint_nonspeculative,
+  omp_lock_hint_nonspeculative __GOMP_DEPRECATED_5_0
+    = omp_sync_hint_nonspeculative,
   omp_sync_hint_speculative = 8,
-  omp_lock_hint_speculative = omp_sync_hint_speculative
+  omp_lock_hint_speculative __GOMP_DEPRECATED_5_0 = omp_sync_hint_speculative
 } omp_sync_hint_t;
 
-typedef omp_sync_hint_t omp_lock_hint_t;
+typedef __GOMP_DEPRECATED_5_0 omp_sync_hint_t omp_lock_hint_t;
 
 typedef struct __attribute__((__aligned__ (sizeof (void *)))) omp_depend_t
 {
@@ -184,8 +191,8 @@ extern int omp_in_parallel (void) __GOMP_NOTHROW;
 extern void omp_set_dynamic (int) __GOMP_NOTHROW;
 extern int omp_get_dynamic (void) __GOMP_NOTHROW;
 
-extern void omp_set_nested (int) __GOMP_NOTHROW;
-extern int omp_get_nested (void) __GOMP_NOTHROW;
+extern void omp_set_nested (int) __GOMP_NOTHROW __GOMP_DEPRECATED_5_0;
+extern int omp_get_nested (void) __GOMP_NOTHROW __GOMP_DEPRECATED_5_0;
 
 extern void omp_init_lock (omp_lock_t *) __GOMP_NOTHROW;
 extern void omp_init_lock_with_hint (omp_lock_t *, omp_sync_hint_t)
index 2fae57b0e5f5b5cced5cc153d9d07cd3c1959b44..3b7f0cba1166c6c88d0c03e89b4567e6e3fe2396 100644 (file)
           end function
         end interface
 
+#if _OPENMP >= 201811
+!GCC$ ATTRIBUTES DEPRECATED :: omp_get_nested, omp_set_nested
+#endif
+
       end module omp_lib
index d20b392baf6c6bd89650b93f1d9e6d1224a454aa..eff231650544ae88c61403d1cf057f30a8f14611 100644 (file)
@@ -1,4 +1,5 @@
 // { dg-do run }
 // { dg-set-target-env-var OMP_PROC_BIND "true" }
+// { dg-additional-options "-Wno-deprecated-declarations" }
 
 #include "../libgomp.c/affinity-1.c"
index aeb0f4d5defce92cffe74aeedb30142e8623b295..4c9f9d19db134f268b89f3274d03bb380df86949 100644 (file)
@@ -17,7 +17,8 @@
 
 /* { dg-do run } */
 /* { dg-set-target-env-var OMP_PROC_BIND "false" } */
-/* { dg-additional-options "-DINTERPOSE_GETAFFINITY -DDO_FORK -ldl" { target *-*-linux* } } */
+/* { dg-additional-options "-Wno-deprecated-declarations" } */
+/* { dg-additional-options "-DINTERPOSE_GETAFFINITY -DDO_FORK -ldl -Wno-deprecated-declarations" { target *-*-linux* } } */
 
 #ifndef _GNU_SOURCE
 #define _GNU_SOURCE
index f821657470473004056523fdb1eef41383e8d26c..8e5bb56a16ae6ace87f2ce14cd9234662c458135 100644 (file)
@@ -2,6 +2,7 @@
 /* { dg-set-target-env-var OMP_PROC_BIND "spread,close" } */
 /* { dg-set-target-env-var OMP_PLACES "{6,7}:4:-2,!{2,3}" } */
 /* { dg-set-target-env-var OMP_NUM_THREADS "2" } */
+/* { dg-additional-options "-Wno-deprecated-declarations" } */
 
 #include <omp.h>
 #include <stdlib.h>
index c167dab5c933323358be77d5610c92d1efb08809..469da6ad598865bb8cc10755575ea02f34c2135a 100644 (file)
@@ -1,4 +1,5 @@
 /* { dg-do run } */
+/* { dg-additional-options "-Wno-deprecated-declarations" } */
 
 #include <omp.h>
 #include <stdio.h>
index 086036d0a699cfb7d6d7a963b1652e6245ed7459..fc6f746b83a9b5eebfe8cfece6280df2b6d99f3a 100644 (file)
@@ -1,3 +1,5 @@
+/* { dg-additional-options "-Wno-deprecated-declarations" } */
+
 #include <stdlib.h>
 #include <omp.h>
 
index d3cfb01006980e8d606cb857ff85f438a8069049..925f5c55831bd81d99769c65a902dac6e52d1169 100644 (file)
@@ -1,3 +1,5 @@
+/* { dg-additional-options "-Wno-deprecated-declarations" } */
+
 #include <omp.h>
 #include <stdlib.h>
 
index f52b074ff133c525adb66370b95c4c22157c05e4..ab113f1bdbd7c6501de69e85402aa2d60132e1a7 100644 (file)
@@ -1,3 +1,5 @@
+/* { dg-additional-options "-Wno-deprecated-declarations" } */
+
 #include <omp.h>
 #include <stdlib.h>
 
index 618600633ac2e89a674654dc5ac30a809d4c42d5..625ca88a0a97e859dc8c7b7b1cb6d17bf891979f 100644 (file)
@@ -1,3 +1,5 @@
+/* { dg-additional-options "-Wno-deprecated-declarations" } */
+
 #include <omp.h>
 #include <stdlib.h>
 #include <string.h>
index 55807e33a496488c4b9f6f6a74db0960be21ae6a..33890df3cf1bce585b6eab9914ec3a9813242e8f 100644 (file)
@@ -1,5 +1,6 @@
 /* PR middle-end/32362 */
 /* { dg-do run } */
+/* { dg-additional-options "-Wno-deprecated-declarations" } */
 
 #include <omp.h>
 #include <stdlib.h>
index d4ce0918ef596a41802d762bb17167f44592d27f..445ccbf5c2712578e0bf6ec90373f52098075196 100644 (file)
@@ -1,5 +1,6 @@
 /* PR middle-end/32362 */
 /* { dg-do run } */
+/* { dg-additional-options "-Wno-deprecated-declarations" } */
 
 #include <omp.h>
 #include <stdlib.h>
index 11a0a0a81dd0660b6a3363fa071e21733ff0edd3..1d0b19cd733867ec19e0ba5b951b12b2adae633a 100644 (file)
@@ -1,5 +1,6 @@
 /* PR middle-end/32362 */
 /* { dg-do run } */
+/* { dg-additional-options "-Wno-deprecated-declarations" } */
 
 #include <omp.h>
 #include <stdlib.h>
index 269a0c26290c5e9b56c6b180e55277de5a9bc0dc..a492c563cc0efc913dd21dbb29e35f1837b857a5 100644 (file)
@@ -1,5 +1,6 @@
 /* PR middle-end/35549 */
 /* { dg-do run } */
+/* { dg-additional-options "-Wno-deprecated-declarations" } */
 
 #include <omp.h>
 #include <stdlib.h>
index 5d57852450ad329fc2e38b6ce9c3778129f24858..260dd9003e8d847dc1bbc04514f8cbca53506626 100644 (file)
@@ -1,5 +1,6 @@
 /* PR libgomp/42942 */
 /* { dg-do run } */
+/* { dg-additional-options "-Wno-deprecated-declarations" } */
 
 #include <omp.h>
 #include <stdlib.h>
index ba3ed37e0405292867c8ecae4be394130a742d3c..c98c10a8253c6ac7cf4a8ccefb8d0543d51faab5 100644 (file)
@@ -1,5 +1,6 @@
 /* PR libgomp/61200 */
 /* { dg-do run } */
+/* { dg-additional-options "-Wno-deprecated-declarations" } */
 
 #include <omp.h>
 #include <stdlib.h>
index f706fa2dc7e698926e76586d9ef67dd0591c6c17..bcabea507e10bad7e160ac1ab1415c6b72d4f18c 100644 (file)
@@ -15,6 +15,8 @@
    along with GCC; see the file COPYING3.  If not see
    <http://www.gnu.org/licenses/>.  */
 
+/* { dg-additional-options "-Wno-deprecated-declarations" } */
+
 #include <limits.h>
 #include <omp.h>
 #include <stdbool.h>
index 436744359cae0b30882a27c84827a709d62ab814..21a69ea68121238347ba711e2bc543078c90e266 100644 (file)
@@ -1,3 +1,5 @@
+/* { dg-additional-options "-Wno-deprecated-declarations" } */
+
 #include <omp.h>
 #include <stdlib.h>
 
index ea35aa465f500a1577b6a4bac6a22be8eae0c6b0..8ffcb5b5b6ae01340594fa23860bcceb8b3d032c 100644 (file)
@@ -1,3 +1,5 @@
+/* { dg-additional-options "-Wno-deprecated-declarations" } */
+
 #include <omp.h>
 #include <stdlib.h>
 
index c5df8371b9ee592facdf7e5f5ba04ed519f72d7a..977e5fc53234a6f573468591c63df2691f38e855 100644 (file)
@@ -1,3 +1,5 @@
+/* { dg-additional-options "-Wno-deprecated-declarations" } */
+
 #include <omp.h>
 #include <stdlib.h>
 
index 1d9794a7a4f0b8254c45df2ef95f88a562243d0c..c8f76f9c78d23e2c1cd50eed001289078a1a7dda 100644 (file)
@@ -1,5 +1,6 @@
 /* { dg-do run } */
 /* { dg-set-target-env-var OMP_THREAD_LIMIT "6" } */
+/* { dg-additional-options "-Wno-deprecated-declarations" } */
 
 #include <stdlib.h>
 #include <unistd.h>
index dc247a714fcf69bebe88924d24cae7299109b35b..2cff1fd48c33c27f0a6079ea5d6274599fdaa153 100644 (file)
@@ -1,5 +1,6 @@
 /* { dg-do run } */
 /* { dg-set-target-env-var OMP_THREAD_LIMIT "9" } */
+/* { dg-additional-options "-Wno-deprecated-declarations" } */
 
 #include <stdlib.h>
 #include <unistd.h>
index 5642e6a87ba4382173c3c54bbe3f6ad5067639b1..351423cab9456857eec10c34ae0cfdb1cd26bc13 100644 (file)
@@ -1,5 +1,6 @@
 /* { dg-do run } */
 /* { dg-set-target-env-var OMP_THREAD_LIMIT "9" } */
+/* { dg-additional-options "-Wno-deprecated-declarations" } */
 
 #include <stdlib.h>
 #include <unistd.h>
index 26b5185ba3c5813648679db969f3b2ecb7b8dd48..ea84b834dda358343c299b644ded556532915f3e 100644 (file)
@@ -3,6 +3,7 @@
 ! { dg-set-target-env-var OMP_PROC_BIND "spread,close" }
 ! { dg-set-target-env-var OMP_PLACES "{6,7}:4:-2,!{2,3}" }
 ! { dg-set-target-env-var OMP_NUM_THREADS "2" }
+! { dg-additional-options "-Wno-deprecated-declarations" }
 
   use omp_lib
   integer :: num, i, nump
index 4e7f9b24bd5c36ac035efec62fb56da312c89c64..c99eb7bdd6d7671fced07714897842b38c9aae73 100644 (file)
@@ -1,4 +1,5 @@
 ! { dg-do run }
+! { dg-additional-options "-Wno-deprecated-declarations" }
 
   use omp_lib
 
index 91b56c06081486ad2c535cb739992a820717dfea..a25611bb4d0ac398ae04558e1a0b1f0866c17f5d 100644 (file)
@@ -1,4 +1,5 @@
 C { dg-do run }
+C { dg-additional-options "-Wno-deprecated-declarations" }
 
       USE OMP_LIB
 
index f521b7bf820f039ab2b8394284f61997c5470f3a..bb3d0ed279785165fd2ab1b36040fa0ab982a54f 100644 (file)
@@ -1,4 +1,6 @@
 ! { dg-do run }
+! { dg-additional-options "-Wno-deprecated-declarations" }
+
 program nested1
   use omp_lib
   integer :: e1, e2, e3, e
index 4f146074d3dc8196115047744f3c5ed0bd84a763..0077a703f7489084daa1a4a13f0d32f68d4ffe3d 100644 (file)
@@ -1,3 +1,5 @@
+! { dg-additional-options "-Wno-deprecated-declarations" }
+
 program teams1
   use omp_lib
 !$omp teams thread_limit (2)