From 1b830c907f5cf5bdb872a02832b0924d2c635276 Mon Sep 17 00:00:00 2001 From: Jussi Pakkanen Date: Fri, 8 Aug 2014 14:29:20 +0300 Subject: [PATCH] Handle Fortran sources with dependencies to themselves. --- ninjabackend.py | 5 +++++ test cases/fortran/4 self dependency/meson.build | 4 ++++ test cases/fortran/4 self dependency/selfdep.f90 | 11 +++++++++++ 3 files changed, 20 insertions(+) create mode 100644 test cases/fortran/4 self dependency/meson.build create mode 100644 test cases/fortran/4 self dependency/selfdep.f90 diff --git a/ninjabackend.py b/ninjabackend.py index 5cb77052c..d7b1cf127 100644 --- a/ninjabackend.py +++ b/ninjabackend.py @@ -1012,6 +1012,11 @@ class NinjaBackend(backends.Backend): raise InvalidArguments('Module %s in file %s not provided by any other source file.' % (usename, src)) mod_source_file = tdeps[usename] + # Check if a source uses a module it exports itself. + # Potential bug if multiple targets have a file with + # the same name. + if mod_source_file == os.path.split(src)[1]: + continue # WORKAROUND, we should set up a file level dependency to the # module file and mark it as an output of this target. However # we can't do that as Ninja does not support dependency tracking diff --git a/test cases/fortran/4 self dependency/meson.build b/test cases/fortran/4 self dependency/meson.build new file mode 100644 index 000000000..bc5dab4ed --- /dev/null +++ b/test cases/fortran/4 self dependency/meson.build @@ -0,0 +1,4 @@ +project('selfdep', 'fortran') + +e = executable('selfdep', 'selfdep.f90') +test('selfdep', e) diff --git a/test cases/fortran/4 self dependency/selfdep.f90 b/test cases/fortran/4 self dependency/selfdep.f90 new file mode 100644 index 000000000..a27283283 --- /dev/null +++ b/test cases/fortran/4 self dependency/selfdep.f90 @@ -0,0 +1,11 @@ +MODULE Circle + REAL, PARAMETER :: Pi = 3.1415927 + REAL :: radius +END MODULE Circle + +PROGRAM prog + +use Circle +IMPLICIT NONE + +END PROGRAM prog