diff options
author | Michael Hirsch, Ph.D <scivision@users.noreply.github.com> | 2019-06-23 11:14:06 -0400 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2019-06-23 21:11:16 +0300 |
commit | 3f531be2e77656976f54c16ecaa9419dad6ac9ff (patch) | |
tree | 8ae762cc03b806b41ffd46df0a3df51f1825c522 | |
parent | 9dbd5f129b770d365caaed6a805fb43de8100682 (diff) | |
download | meson-3f531be2e77656976f54c16ecaa9419dad6ac9ff.zip meson-3f531be2e77656976f54c16ecaa9419dad6ac9ff.tar.gz meson-3f531be2e77656976f54c16ecaa9419dad6ac9ff.tar.bz2 |
fortran 2003 use, non_instrinsic
incl
inver
-rw-r--r-- | test cases/fortran/14 fortran links c/meson.build | 3 | ||||
-rw-r--r-- | test cases/fortran/15 include/include_tests.f90 | 24 | ||||
-rw-r--r-- | test cases/fortran/3 module procedure/meson.build | 7 | ||||
-rw-r--r-- | test cases/fortran/3 module procedure/prog.f90 | 15 | ||||
-rw-r--r-- | test cases/fortran/3 module procedure/use_syntax.f90 | 31 |
5 files changed, 61 insertions, 19 deletions
diff --git a/test cases/fortran/14 fortran links c/meson.build b/test cases/fortran/14 fortran links c/meson.build index cd1369d..1ac47e4 100644 --- a/test cases/fortran/14 fortran links c/meson.build +++ b/test cases/fortran/14 fortran links c/meson.build @@ -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' diff --git a/test cases/fortran/15 include/include_tests.f90 b/test cases/fortran/15 include/include_tests.f90 new file mode 100644 index 0000000..56e4619 --- /dev/null +++ b/test cases/fortran/15 include/include_tests.f90 @@ -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
\ No newline at end of file diff --git a/test cases/fortran/3 module procedure/meson.build b/test cases/fortran/3 module procedure/meson.build index f05a70c..a590015 100644 --- a/test cases/fortran/3 module procedure/meson.build +++ b/test cases/fortran/3 module procedure/meson.build @@ -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) diff --git a/test cases/fortran/3 module procedure/prog.f90 b/test cases/fortran/3 module procedure/prog.f90 deleted file mode 100644 index 4899d8b..0000000 --- a/test cases/fortran/3 module procedure/prog.f90 +++ /dev/null @@ -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 diff --git a/test cases/fortran/3 module procedure/use_syntax.f90 b/test cases/fortran/3 module procedure/use_syntax.f90 new file mode 100644 index 0000000..2f3a9e6 --- /dev/null +++ b/test cases/fortran/3 module procedure/use_syntax.f90 @@ -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 |