Use case-insensitive suffix check for fortran

In Fortran it is common to use capital F in the suffix (eg. '.F90') if
the source file makes use of preprocessor statements. Such files should
probably be treated like all other fortran files by meson.

Case insensitivity for suffixes was already implemented several places
in meson before this. So most likely, the few places changed here were
oversights anyway.
pull/8226/head
Jonas Lundholm Bertelsen 4 years ago
parent 8133a7b9a4
commit bd2394e872
  1. 4
      mesonbuild/backend/ninjabackend.py
  2. 4
      mesonbuild/scripts/depscan.py

@ -637,7 +637,7 @@ int dummy;
if self.environment.is_llvm_ir(source) or \ if self.environment.is_llvm_ir(source) or \
self.environment.is_assembly(source): self.environment.is_assembly(source):
return False return False
suffix = os.path.splitext(source)[1][1:] suffix = os.path.splitext(source)[1][1:].lower()
for lang in self.langs_cant_unity: for lang in self.langs_cant_unity:
if lang not in target.compilers: if lang not in target.compilers:
continue continue
@ -925,7 +925,7 @@ int dummy;
all_suffixes = set(compilers.lang_suffixes['cpp']) | set(compilers.lang_suffixes['fortran']) all_suffixes = set(compilers.lang_suffixes['cpp']) | set(compilers.lang_suffixes['fortran'])
selected_sources = [] selected_sources = []
for source in compiled_sources: for source in compiled_sources:
ext = os.path.splitext(source)[1][1:] ext = os.path.splitext(source)[1][1:].lower()
if ext in all_suffixes: if ext in all_suffixes:
selected_sources.append(source) selected_sources.append(source)
return selected_sources return selected_sources

@ -46,7 +46,7 @@ class DependencyScanner:
self.sources_with_exports = [] # type: T.List[str] self.sources_with_exports = [] # type: T.List[str]
def scan_file(self, fname: str) -> None: def scan_file(self, fname: str) -> None:
suffix = os.path.splitext(fname)[1][1:] suffix = os.path.splitext(fname)[1][1:].lower()
if suffix in lang_suffixes['fortran']: if suffix in lang_suffixes['fortran']:
self.scan_fortran_file(fname) self.scan_fortran_file(fname)
elif suffix in lang_suffixes['cpp']: elif suffix in lang_suffixes['cpp']:
@ -131,7 +131,7 @@ class DependencyScanner:
return objname return objname
def module_name_for(self, src: str) -> str: def module_name_for(self, src: str) -> str:
suffix= os.path.splitext(src)[1][1:] suffix = os.path.splitext(src)[1][1:].lower()
if suffix in lang_suffixes['fortran']: if suffix in lang_suffixes['fortran']:
exported = self.exports[src] exported = self.exports[src]
# Module foo:bar goes to a file name foo@bar.smod # Module foo:bar goes to a file name foo@bar.smod

Loading…
Cancel
Save