From c8d144b064169f5e7b34b76c95a585d9e4ca5f44 Mon Sep 17 00:00:00 2001 From: "Michael Hirsch, Ph.D" Date: Sun, 23 Jun 2019 10:56:05 -0400 Subject: fortran include syntax checks minvers --- .../fortran/15 include/include_hierarchy.f90 | 8 ++++++++ test cases/fortran/15 include/include_syntax.f90 | 23 ++++++++++++++++++++++ test cases/fortran/15 include/main.f90 | 8 -------- test cases/fortran/15 include/meson.build | 10 +++++++--- test cases/fortran/15 include/timestwo.f90 | 2 ++ 5 files changed, 40 insertions(+), 11 deletions(-) create mode 100644 test cases/fortran/15 include/include_hierarchy.f90 create mode 100644 test cases/fortran/15 include/include_syntax.f90 delete mode 100644 test cases/fortran/15 include/main.f90 create mode 100644 test cases/fortran/15 include/timestwo.f90 (limited to 'test cases/fortran') diff --git a/test cases/fortran/15 include/include_hierarchy.f90 b/test cases/fortran/15 include/include_hierarchy.f90 new file mode 100644 index 0000000..661aa62 --- /dev/null +++ b/test cases/fortran/15 include/include_hierarchy.f90 @@ -0,0 +1,8 @@ + +implicit none + +include "inc1.f90" + +print *, '2*pi:', tau + +end program diff --git a/test cases/fortran/15 include/include_syntax.f90 b/test cases/fortran/15 include/include_syntax.f90 new file mode 100644 index 0000000..d35e0ce --- /dev/null +++ b/test cases/fortran/15 include/include_syntax.f90 @@ -0,0 +1,23 @@ +implicit none + +integer :: x, y + +x = 1 +y = 0 + +! include "timestwo.f90" + +include "timestwo.f90" ! inline comment check +if (x/=2) error stop 'failed on first include' + +! leading space 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/15 include/main.f90 b/test cases/fortran/15 include/main.f90 deleted file mode 100644 index 661aa62..0000000 --- a/test cases/fortran/15 include/main.f90 +++ /dev/null @@ -1,8 +0,0 @@ - -implicit none - -include "inc1.f90" - -print *, '2*pi:', tau - -end program diff --git a/test cases/fortran/15 include/meson.build b/test cases/fortran/15 include/meson.build index 5609128..2196d13 100644 --- a/test cases/fortran/15 include/meson.build +++ b/test cases/fortran/15 include/meson.build @@ -1,4 +1,8 @@ -project('Inclusive', 'fortran') +project('Inclusive', 'fortran', + meson_version: '>= 0.51.1') -exe = executable('incexe', 'main.f90') -test('Fortran include files', exe) +hier_exe = executable('include_hierarchy', 'include_hierarchy.f90') +test('Fortran include file hierarchy', hier_exe) + +syntax_exe = executable('include_syntax', 'include_syntax.f90') +test('Fortran include file syntax', syntax_exe) \ No newline at end of file diff --git a/test cases/fortran/15 include/timestwo.f90 b/test cases/fortran/15 include/timestwo.f90 new file mode 100644 index 0000000..0e2d5ac --- /dev/null +++ b/test cases/fortran/15 include/timestwo.f90 @@ -0,0 +1,2 @@ +x = 2*x +y = y+1 \ No newline at end of file -- cgit v1.1