BUGFIX: Fortran module regex handle more edge cases

pull/5543/head
Michael Hirsch, Ph.D 5 years ago committed by Jussi Pakkanen
parent 9042130e9a
commit ef53107f14
  1. 8
      mesonbuild/backend/ninjabackend.py
  2. 4
      test cases/fortran/12 submodule/child.f90
  3. 5
      test cases/fortran/12 submodule/parent.f90
  4. 2
      test cases/fortran/2 modules/mymod.f90

@ -38,10 +38,10 @@ from ..mesonlib import get_compiler_for_source, has_path_sep
from .backends import CleanTrees
from ..build import InvalidArguments
FORTRAN_INCLUDE_PAT = r"#?include\s*['\"](\w+\.\w+)['\"]"
FORTRAN_MODULE_PAT = r"\s*\bmodule\b\s+(?!procedure)(\w+)"
FORTRAN_SUBMOD_PAT = r"\s*submodule\s*\((\w+:?\w+)\)\s*(\w+)"
FORTRAN_USE_PAT = r"\s*use,?\s*(?:non_intrinsic)?\s*(?:::)?\s*(\w+)"
FORTRAN_INCLUDE_PAT = r"^\s*#?include\s*['\"](\w+\.\w+)['\"]"
FORTRAN_MODULE_PAT = r"^\s*\bmodule\b\s+(\w+)\s*(?:!+.*)*$"
FORTRAN_SUBMOD_PAT = r"^\s*\bsubmodule\b\s*\((\w+:?\w+)\)\s*(\w+)"
FORTRAN_USE_PAT = r"^\s*use,?\s*(?:non_intrinsic)?\s*(?:::)?\s*(\w+)"
if mesonlib.is_windows():
quote_func = lambda s: '"{}"'.format(s)

@ -6,5 +6,9 @@ module procedure pi2tau
pi2tau = 2*pi
end procedure pi2tau
module procedure good
print *, 'Good!'
end procedure good
end submodule parent

@ -6,6 +6,9 @@ interface
module elemental real function pi2tau(pi)
real, intent(in) :: pi
end function pi2tau
module subroutine good()
end subroutine good
end interface
end module parent
@ -17,4 +20,6 @@ tau = pi2tau(pi)
print *,'pi=',pi, 'tau=', tau
call good()
end program

@ -1,3 +1,5 @@
! module circle to be sure module regex doesn't allow commented modules
module circle
implicit none

Loading…
Cancel
Save