On Wed, Nov 04, 2020 at 02:23:17PM +0000, Kwok Cheung Yeung wrote: > I have used Tobias' recently added patch for Fortran deprecation support to > mark omp_get_nested and omp_set_nested as deprecated. If the omp_lock_hint_* > integer parameters are marked though, then the deprecation warnings will > fire the moment omp_lib is used from a Fortran program, even if they are not > referenced in the progam itself - a bug perhaps? > > I have added '-cpp' (for preprocessor support) and '-fopenmp' (for the > _OPENMP define) to the Makefile when compiling the omp_lib.f90. > > Would a warning message be acceptable if OMP_NESTED is used? Obviously this > cannot be done at compile-time.
I'd strongly prefer no runtime warnings. > 2020-11-04 Ulrich Drepper <drep...@redhat.com> > Kwok Cheung Yeung <k...@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. LGTM, except: > + 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, The above line is too long and needs wrapping. But it would be nice to also add -Wno-deprecated to dg-additional-options of tests that do use those. Perhaps for testing replace the 201811 temporarily with 201511 and run make check. > --- 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 Also, what about omp_lib.h? Do you plan to change it only when we switch _OPENMP macro? I mean, we can't rely on preprocessing in that case... Jakub