metomi / fcm

:hammer: FCM: a modern Fortran build system + wrappers to Subversion for scientific software development
http://metomi.github.io/fcm/doc/
GNU General Public License v3.0
40 stars 17 forks source link

Dependency checker generates false dependencies from generated interface files #213

Open gdcarver opened 8 years ago

gdcarver commented 8 years ago

FCM can falsely report dependencies from FCM generated interface files because it assumes 'USE'd modules in the .F90 are needed in the interface. This can lead to non-existent cyclic dependencies being reported halting the build.

Consider, dr_hook_util.F90:

   SUBROUTINE DR_HOOK_UTIL(PKEY)
   USE PARKIND1  ,ONLY : JPRB
   USE MPL_INIT_MOD, ONLY : MPL_INIT
   REAL(KIND=JPRB),INTENT(INOUT) :: PKEY
   END

The generated interface is then, dr_hook_util.intfb.h :

   INTERFACE
   SUBROUTINE DR_HOOK_UTIL(PKEY)
   USE PARKIND1  ,ONLY : JPRB
   REAL(KIND=JPRB),INTENT(INOUT) :: PKEY
   END INTERFACE

The module MPL_INIT_MOD is not needed for the interface file. However, for this (larger than shown) code, FCM incorrectly reports a cyclic dependency stemming from dr_hook_util.intfb.h (intfb.h being automatically generated). e.g:

... snipped ...
[FAIL]     required by: mpl_init_mod.mod
[FAIL]     required by: dr_hook_util.intfb.h
... snipped ...

The dependency is on the dr_hook_util.o file, but the 'mpl_init_mod.mod' should not be considered a dependency on the generated interface file in this case.

matthewrmshin commented 7 years ago

@gdcarver how are you working round this at the moment? Is this causing a lot of problem?