On Wed, Aug 18, 2021 at 11:00:47AM +0200, Tobias Burnus wrote:
> ---------------- Note 2 -----------------------
> 'omp_lib.h' is included in as declaration-construct in the
> specification-part of a file (i.e. possibly after an implicit statement);
> hence, it cannot contain a use-stmt.  Additionally, it needs to support
> both free- and fixed-form source files.
> While thought to be compatible with Fortran 77, nothing actually requires
> that only Fortran 77 code is used and gfortran only supports -std=f95 or
> higher.
> 
> Hence, (rightly!) assuming that only gfortran compiles that file,
> Fortran 90 + 95 features can be used; the code already uses TYPE.
> 
> However, the the attached patch also BIND(C) + IMPORT, which are
> Fortran 2003 features, effectively preventing the compilation with
> -std=f95.
> 
> My impression is that old code (Fortran IV, 66, 77, older 90/95) code
> tends to use vendor extension (preventing the compilation with -std=f*)
> and users do not care about setting -std=f* flags.
> Or the code is old but still maintained. But in that case, new features
> of Fortran 2003 (and later) intentionally and/or accidentally get used,
> already preventing the compilation with -std=f95.
> 
> Thus, I think it is okay to use a Fortran 2003 feature.

Perhaps we could add some new !GCC$ extension that would temporarily
turn off errors about new language features (or temporarily switch language
version), slightly similar to
#pragma GCC push_options
#pragma GCC ...
...
#pragma GCC pop_options
except that in C/C++ one can't change the language version (but on the other
side we have __extension__ and system headers surpressing some diagnostics).

> libgomp/ChangeLog:
> 
>       * omp_lib.f90.in (omp_alloc, omp_free, omp_target_alloc,
>       omp_target_free. omp_target_is_present, omp_target_memcpy,
>       omp_target_memcpy_rect, omp_target_associate_ptr,
>       omp_target_disassociate_ptr): Add interface.
>       * omp_lib.h.in (omp_alloc, omp_free, omp_target_alloc,
>       omp_target_free. omp_target_is_present, omp_target_memcpy,
>       omp_target_memcpy_rect, omp_target_associate_ptr,
>       omp_target_disassociate_ptr): Add interface.
>       * testsuite/libgomp.fortran/alloc-1.F90: Remove local
>       interface block for omp_alloc + omp_free.
>       * testsuite/libgomp.fortran/alloc-4.f90: Likewise.
>       * testsuite/libgomp.fortran/refcount-1.f90: New test.
>       * testsuite/libgomp.fortran/target-12.f90: New test.
> 
>  libgomp/omp_lib.f90.in                           |  94 +++++++++++++++
>  libgomp/omp_lib.h.in                             |  97 +++++++++++++++
>  libgomp/testsuite/libgomp.fortran/alloc-1.F90    |  16 ---
>  libgomp/testsuite/libgomp.fortran/alloc-4.f90    |  16 ---
>  libgomp/testsuite/libgomp.fortran/refcount-1.f90 |  61 ++++++++++
>  libgomp/testsuite/libgomp.fortran/target-12.f90  | 147 
> +++++++++++++++++++++++
>  6 files changed, 399 insertions(+), 32 deletions(-)

Ok.

        Jakub

Reply via email to