fortran 2003 use, non_instrinsic

incl

inver
pull/5546/head
Michael Hirsch, Ph.D 6 years ago committed by Jussi Pakkanen
parent 9dbd5f129b
commit 3f531be2e7
  1. 3
      test cases/fortran/14 fortran links c/meson.build
  2. 24
      test cases/fortran/15 include/include_tests.f90
  3. 7
      test cases/fortran/3 module procedure/meson.build
  4. 15
      test cases/fortran/3 module procedure/prog.f90
  5. 31
      test cases/fortran/3 module procedure/use_syntax.f90

@ -1,4 +1,5 @@
project('Fortran calling C', 'fortran', 'c')
project('Fortran calling C', 'fortran', 'c',
meson_version: '>= 0.51.0')
ccid = meson.get_compiler('c').get_id()
if ccid == 'msvc' or ccid == 'clang-cl'

@ -0,0 +1,24 @@
implicit none
integer :: x, y
x = 1
y = 0
! include "timestwo.f90"
! double quote and inline comment check
include "timestwo.f90" ! inline comment check
if (x/=2) error stop 'failed on first include'
! leading space and single quote check
include 'timestwo.f90'
if (x/=4) error stop 'failed on second include'
! Most Fortran compilers can't handle the non-standard #include,
! including (ha!) Flang, Gfortran, Ifort and PGI.
! #include "timestwo.f90"
print *, 'OK: Fortran include tests: x=',x
end program

@ -1,4 +1,5 @@
project('use in same file', 'fortran')
project('Fortran 2003 use statement, in same file', 'fortran',
meson_version: '>= 0.50.0')
e = executable('prog', 'prog.f90')
test('simple', e)
e = executable('use_syntax', 'use_syntax.f90')
test('Fortran 2003 use syntax', e)

@ -1,15 +0,0 @@
MODULE Circle
REAL, PARAMETER :: Pi = 3.1415927
REAL :: radius
INTERFACE DEFAULT
MODULE PROCEDURE func
END INTERFACE
CONTAINS
FUNCTION func()
func = 0
END FUNCTION
END MODULE Circle
PROGRAM PROG
print *, "Module procedure is working."
END PROGRAM PROG

@ -0,0 +1,31 @@
module circle
implicit none
integer :: x
real :: radius
interface default
module procedure timestwo
end interface
contains
elemental integer function timestwo(x) result(y)
integer, intent(in) :: x
y = 2*x
end function
end module circle
program prog
use, non_intrinsic :: circle, only: timestwo, x
implicit none
x = 3
if (timestwo(x) /= 6) error stop 'fortran module procedure problem'
print *,'OK: Fortran module procedure'
end program prog
Loading…
Cancel
Save