From: Kwok Cheung Yeung Date: Thu, 5 Nov 2020 18:11:23 +0000 (-0800) Subject: openmp: Mark deprecated symbols in OpenMP 5.0 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=10508db867934264bbc2578f1f454c19fa558fd3;p=gcc.git openmp: Mark deprecated symbols in OpenMP 5.0 2020-11-05 Ulrich Drepper Kwok Cheung Yeung 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. --- diff --git a/libgomp/Makefile.am b/libgomp/Makefile.am index 586c930a4d7..4cf1f581995 100644 --- a/libgomp/Makefile.am +++ b/libgomp/Makefile.am @@ -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 diff --git a/libgomp/Makefile.in b/libgomp/Makefile.in index 00d5e2919ee..eb868b36704 100644 --- a/libgomp/Makefile.in +++ b/libgomp/Makefile.in @@ -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 diff --git a/libgomp/fortran.c b/libgomp/fortran.c index 029dec17459..cd719f92fc8 100644 --- a/libgomp/fortran.c +++ b/libgomp/fortran.c @@ -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) diff --git a/libgomp/icv.c b/libgomp/icv.c index 4da6527c9b8..8df15e385e7 100644 --- a/libgomp/icv.c +++ b/libgomp/icv.c @@ -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) diff --git a/libgomp/omp.h.in b/libgomp/omp.h.in index a9e6c448dc3..be7df6d283f 100644 --- a/libgomp/omp.h.in +++ b/libgomp/omp.h.in @@ -26,6 +26,12 @@ #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) diff --git a/libgomp/omp_lib.f90.in b/libgomp/omp_lib.f90.in index 2fae57b0e5f..3b7f0cba116 100644 --- a/libgomp/omp_lib.f90.in +++ b/libgomp/omp_lib.f90.in @@ -644,4 +644,8 @@ end function end interface +#if _OPENMP >= 201811 +!GCC$ ATTRIBUTES DEPRECATED :: omp_get_nested, omp_set_nested +#endif + end module omp_lib diff --git a/libgomp/testsuite/libgomp.c++/affinity-1.C b/libgomp/testsuite/libgomp.c++/affinity-1.C index d20b392baf6..eff23165054 100644 --- a/libgomp/testsuite/libgomp.c++/affinity-1.C +++ b/libgomp/testsuite/libgomp.c++/affinity-1.C @@ -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" diff --git a/libgomp/testsuite/libgomp.c/affinity-1.c b/libgomp/testsuite/libgomp.c/affinity-1.c index aeb0f4d5def..4c9f9d19db1 100644 --- a/libgomp/testsuite/libgomp.c/affinity-1.c +++ b/libgomp/testsuite/libgomp.c/affinity-1.c @@ -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 diff --git a/libgomp/testsuite/libgomp.c/affinity-2.c b/libgomp/testsuite/libgomp.c/affinity-2.c index f8216574704..8e5bb56a16a 100644 --- a/libgomp/testsuite/libgomp.c/affinity-2.c +++ b/libgomp/testsuite/libgomp.c/affinity-2.c @@ -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 #include diff --git a/libgomp/testsuite/libgomp.c/appendix-a/a.15.1.c b/libgomp/testsuite/libgomp.c/appendix-a/a.15.1.c index c167dab5c93..469da6ad598 100644 --- a/libgomp/testsuite/libgomp.c/appendix-a/a.15.1.c +++ b/libgomp/testsuite/libgomp.c/appendix-a/a.15.1.c @@ -1,4 +1,5 @@ /* { dg-do run } */ +/* { dg-additional-options "-Wno-deprecated-declarations" } */ #include #include diff --git a/libgomp/testsuite/libgomp.c/lib-1.c b/libgomp/testsuite/libgomp.c/lib-1.c index 086036d0a69..fc6f746b83a 100644 --- a/libgomp/testsuite/libgomp.c/lib-1.c +++ b/libgomp/testsuite/libgomp.c/lib-1.c @@ -1,3 +1,5 @@ +/* { dg-additional-options "-Wno-deprecated-declarations" } */ + #include #include diff --git a/libgomp/testsuite/libgomp.c/nested-1.c b/libgomp/testsuite/libgomp.c/nested-1.c index d3cfb010069..925f5c55831 100644 --- a/libgomp/testsuite/libgomp.c/nested-1.c +++ b/libgomp/testsuite/libgomp.c/nested-1.c @@ -1,3 +1,5 @@ +/* { dg-additional-options "-Wno-deprecated-declarations" } */ + #include #include diff --git a/libgomp/testsuite/libgomp.c/nested-2.c b/libgomp/testsuite/libgomp.c/nested-2.c index f52b074ff13..ab113f1bdbd 100644 --- a/libgomp/testsuite/libgomp.c/nested-2.c +++ b/libgomp/testsuite/libgomp.c/nested-2.c @@ -1,3 +1,5 @@ +/* { dg-additional-options "-Wno-deprecated-declarations" } */ + #include #include diff --git a/libgomp/testsuite/libgomp.c/nested-3.c b/libgomp/testsuite/libgomp.c/nested-3.c index 618600633ac..625ca88a0a9 100644 --- a/libgomp/testsuite/libgomp.c/nested-3.c +++ b/libgomp/testsuite/libgomp.c/nested-3.c @@ -1,3 +1,5 @@ +/* { dg-additional-options "-Wno-deprecated-declarations" } */ + #include #include #include diff --git a/libgomp/testsuite/libgomp.c/pr32362-1.c b/libgomp/testsuite/libgomp.c/pr32362-1.c index 55807e33a49..33890df3cf1 100644 --- a/libgomp/testsuite/libgomp.c/pr32362-1.c +++ b/libgomp/testsuite/libgomp.c/pr32362-1.c @@ -1,5 +1,6 @@ /* PR middle-end/32362 */ /* { dg-do run } */ +/* { dg-additional-options "-Wno-deprecated-declarations" } */ #include #include diff --git a/libgomp/testsuite/libgomp.c/pr32362-2.c b/libgomp/testsuite/libgomp.c/pr32362-2.c index d4ce0918ef5..445ccbf5c27 100644 --- a/libgomp/testsuite/libgomp.c/pr32362-2.c +++ b/libgomp/testsuite/libgomp.c/pr32362-2.c @@ -1,5 +1,6 @@ /* PR middle-end/32362 */ /* { dg-do run } */ +/* { dg-additional-options "-Wno-deprecated-declarations" } */ #include #include diff --git a/libgomp/testsuite/libgomp.c/pr32362-3.c b/libgomp/testsuite/libgomp.c/pr32362-3.c index 11a0a0a81dd..1d0b19cd733 100644 --- a/libgomp/testsuite/libgomp.c/pr32362-3.c +++ b/libgomp/testsuite/libgomp.c/pr32362-3.c @@ -1,5 +1,6 @@ /* PR middle-end/32362 */ /* { dg-do run } */ +/* { dg-additional-options "-Wno-deprecated-declarations" } */ #include #include diff --git a/libgomp/testsuite/libgomp.c/pr35549.c b/libgomp/testsuite/libgomp.c/pr35549.c index 269a0c26290..a492c563cc0 100644 --- a/libgomp/testsuite/libgomp.c/pr35549.c +++ b/libgomp/testsuite/libgomp.c/pr35549.c @@ -1,5 +1,6 @@ /* PR middle-end/35549 */ /* { dg-do run } */ +/* { dg-additional-options "-Wno-deprecated-declarations" } */ #include #include diff --git a/libgomp/testsuite/libgomp.c/pr42942.c b/libgomp/testsuite/libgomp.c/pr42942.c index 5d57852450a..260dd9003e8 100644 --- a/libgomp/testsuite/libgomp.c/pr42942.c +++ b/libgomp/testsuite/libgomp.c/pr42942.c @@ -1,5 +1,6 @@ /* PR libgomp/42942 */ /* { dg-do run } */ +/* { dg-additional-options "-Wno-deprecated-declarations" } */ #include #include diff --git a/libgomp/testsuite/libgomp.c/pr61200.c b/libgomp/testsuite/libgomp.c/pr61200.c index ba3ed37e040..c98c10a8253 100644 --- a/libgomp/testsuite/libgomp.c/pr61200.c +++ b/libgomp/testsuite/libgomp.c/pr61200.c @@ -1,5 +1,6 @@ /* PR libgomp/61200 */ /* { dg-do run } */ +/* { dg-additional-options "-Wno-deprecated-declarations" } */ #include #include diff --git a/libgomp/testsuite/libgomp.c/sort-1.c b/libgomp/testsuite/libgomp.c/sort-1.c index f706fa2dc7e..bcabea507e1 100644 --- a/libgomp/testsuite/libgomp.c/sort-1.c +++ b/libgomp/testsuite/libgomp.c/sort-1.c @@ -15,6 +15,8 @@ along with GCC; see the file COPYING3. If not see . */ +/* { dg-additional-options "-Wno-deprecated-declarations" } */ + #include #include #include diff --git a/libgomp/testsuite/libgomp.c/target-5.c b/libgomp/testsuite/libgomp.c/target-5.c index 436744359ca..21a69ea6812 100644 --- a/libgomp/testsuite/libgomp.c/target-5.c +++ b/libgomp/testsuite/libgomp.c/target-5.c @@ -1,3 +1,5 @@ +/* { dg-additional-options "-Wno-deprecated-declarations" } */ + #include #include diff --git a/libgomp/testsuite/libgomp.c/target-6.c b/libgomp/testsuite/libgomp.c/target-6.c index ea35aa465f5..8ffcb5b5b6a 100644 --- a/libgomp/testsuite/libgomp.c/target-6.c +++ b/libgomp/testsuite/libgomp.c/target-6.c @@ -1,3 +1,5 @@ +/* { dg-additional-options "-Wno-deprecated-declarations" } */ + #include #include diff --git a/libgomp/testsuite/libgomp.c/teams-1.c b/libgomp/testsuite/libgomp.c/teams-1.c index c5df8371b9e..977e5fc5323 100644 --- a/libgomp/testsuite/libgomp.c/teams-1.c +++ b/libgomp/testsuite/libgomp.c/teams-1.c @@ -1,3 +1,5 @@ +/* { dg-additional-options "-Wno-deprecated-declarations" } */ + #include #include diff --git a/libgomp/testsuite/libgomp.c/thread-limit-1.c b/libgomp/testsuite/libgomp.c/thread-limit-1.c index 1d9794a7a4f..c8f76f9c78d 100644 --- a/libgomp/testsuite/libgomp.c/thread-limit-1.c +++ b/libgomp/testsuite/libgomp.c/thread-limit-1.c @@ -1,5 +1,6 @@ /* { dg-do run } */ /* { dg-set-target-env-var OMP_THREAD_LIMIT "6" } */ +/* { dg-additional-options "-Wno-deprecated-declarations" } */ #include #include diff --git a/libgomp/testsuite/libgomp.c/thread-limit-2.c b/libgomp/testsuite/libgomp.c/thread-limit-2.c index dc247a714fc..2cff1fd48c3 100644 --- a/libgomp/testsuite/libgomp.c/thread-limit-2.c +++ b/libgomp/testsuite/libgomp.c/thread-limit-2.c @@ -1,5 +1,6 @@ /* { dg-do run } */ /* { dg-set-target-env-var OMP_THREAD_LIMIT "9" } */ +/* { dg-additional-options "-Wno-deprecated-declarations" } */ #include #include diff --git a/libgomp/testsuite/libgomp.c/thread-limit-4.c b/libgomp/testsuite/libgomp.c/thread-limit-4.c index 5642e6a87ba..351423cab94 100644 --- a/libgomp/testsuite/libgomp.c/thread-limit-4.c +++ b/libgomp/testsuite/libgomp.c/thread-limit-4.c @@ -1,5 +1,6 @@ /* { dg-do run } */ /* { dg-set-target-env-var OMP_THREAD_LIMIT "9" } */ +/* { dg-additional-options "-Wno-deprecated-declarations" } */ #include #include diff --git a/libgomp/testsuite/libgomp.fortran/affinity1.f90 b/libgomp/testsuite/libgomp.fortran/affinity1.f90 index 26b5185ba3c..ea84b834dda 100644 --- a/libgomp/testsuite/libgomp.fortran/affinity1.f90 +++ b/libgomp/testsuite/libgomp.fortran/affinity1.f90 @@ -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 diff --git a/libgomp/testsuite/libgomp.fortran/lib1.f90 b/libgomp/testsuite/libgomp.fortran/lib1.f90 index 4e7f9b24bd5..c99eb7bdd6d 100644 --- a/libgomp/testsuite/libgomp.fortran/lib1.f90 +++ b/libgomp/testsuite/libgomp.fortran/lib1.f90 @@ -1,4 +1,5 @@ ! { dg-do run } +! { dg-additional-options "-Wno-deprecated-declarations" } use omp_lib diff --git a/libgomp/testsuite/libgomp.fortran/lib2.f b/libgomp/testsuite/libgomp.fortran/lib2.f index 91b56c06081..a25611bb4d0 100644 --- a/libgomp/testsuite/libgomp.fortran/lib2.f +++ b/libgomp/testsuite/libgomp.fortran/lib2.f @@ -1,4 +1,5 @@ C { dg-do run } +C { dg-additional-options "-Wno-deprecated-declarations" } USE OMP_LIB diff --git a/libgomp/testsuite/libgomp.fortran/nested1.f90 b/libgomp/testsuite/libgomp.fortran/nested1.f90 index f521b7bf820..bb3d0ed2797 100644 --- a/libgomp/testsuite/libgomp.fortran/nested1.f90 +++ b/libgomp/testsuite/libgomp.fortran/nested1.f90 @@ -1,4 +1,6 @@ ! { dg-do run } +! { dg-additional-options "-Wno-deprecated-declarations" } + program nested1 use omp_lib integer :: e1, e2, e3, e diff --git a/libgomp/testsuite/libgomp.fortran/teams1.f90 b/libgomp/testsuite/libgomp.fortran/teams1.f90 index 4f146074d3d..0077a703f74 100644 --- a/libgomp/testsuite/libgomp.fortran/teams1.f90 +++ b/libgomp/testsuite/libgomp.fortran/teams1.f90 @@ -1,3 +1,5 @@ +! { dg-additional-options "-Wno-deprecated-declarations" } + program teams1 use omp_lib !$omp teams thread_limit (2)