Should we mark the symbols that are deprecated in OpenMP 5.0 as such in the header? Yes, this will break code that uses the symbols and -Werror but this is the standard writers intend, right? It's easy enough to work around for the time being.
Aside from the header changes the files implementing the omp_[gs]et_nested functions had to be changed. I just use the pragma to disable the warning temporarily instead of a more global option like using -Wno-deprecated-declarations in the Makefile. What do people think about this? 2019-01-02 Ulrich Drepper <drep...@redhat.com> Newly deprecated symbols in OpenMP 5.0. * omp.h.in (__GOMP_DEPRECATED): Define. Make omp_lock_hint_* enum values, omp_lock_hint_t, omp_set_nested, and omp_get_nested with __GOMP_DEPRECATED. * fortran.c: Wrap uses of omp_set_nested and omp_get_nested with pragmas to ignore -Wdeprecated-declarations warnings. * icv.c: Likewise.
diff --git a/libgomp/fortran.c b/libgomp/fortran.c index 4d544be1c99..24d361157f0 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) @@ -276,6 +279,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) { @@ -287,6 +292,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) @@ -306,11 +312,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 095d57a93b1..af0f4c0596e 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) @@ -198,10 +201,13 @@ omp_get_partition_place_nums (int *place_nums) } 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 d7ac71400ad..060ee374829 100644 --- a/libgomp/omp.h.in +++ b/libgomp/omp.h.in @@ -26,6 +26,13 @@ #ifndef _OMP_H #define _OMP_H 1 + +#ifdef __GNUC__ +# define __GOMP_DEPRECATED __attribute__((__deprecated__)) +#else +# define __GOMP_DEPRECATED +#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 +73,18 @@ 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 = omp_sync_hint_none, omp_sync_hint_uncontended = 1, - omp_lock_hint_uncontended = omp_sync_hint_uncontended, + omp_lock_hint_uncontended __GOMP_DEPRECATED = omp_sync_hint_uncontended, omp_sync_hint_contended = 2, - omp_lock_hint_contended = omp_sync_hint_contended, + omp_lock_hint_contended __GOMP_DEPRECATED = omp_sync_hint_contended, omp_sync_hint_nonspeculative = 4, - omp_lock_hint_nonspeculative = omp_sync_hint_nonspeculative, + omp_lock_hint_nonspeculative __GOMP_DEPRECATED = omp_sync_hint_nonspeculative, omp_sync_hint_speculative = 8, - omp_lock_hint_speculative = omp_sync_hint_speculative + omp_lock_hint_speculative __GOMP_DEPRECATED = omp_sync_hint_speculative } omp_sync_hint_t; -typedef omp_sync_hint_t omp_lock_hint_t; +typedef __GOMP_DEPRECATED omp_sync_hint_t omp_lock_hint_t; typedef struct __attribute__((__aligned__ (sizeof (void *)))) omp_depend_t { @@ -108,8 +115,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_DEPRECATED __GOMP_NOTHROW; +extern int omp_get_nested (void) __GOMP_DEPRECATED __GOMP_NOTHROW; extern void omp_init_lock (omp_lock_t *) __GOMP_NOTHROW; extern void omp_init_lock_with_hint (omp_lock_t *, omp_sync_hint_t)
signature.asc
Description: OpenPGP digital signature