This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
[gfortran,patch] Don't rewrite module files when they haven't changed
- From: FX Coudert <fxcoudert at gmail dot com>
- To: Fortran List <fortran at gcc dot gnu dot org>, gcc-patches List <gcc-patches at gcc dot gnu dot org>
- Cc: janis187 at us dot ibm dot com
- Date: Fri, 20 Apr 2007 23:36:21 +0200
- Subject: [gfortran,patch] Don't rewrite module files when they haven't changed
:ADDPATCH fortran:
[Janis: this patch contains a testsuite new procedure to scan
modules, for which I need your approval. See the last paragraph of
the mail.]
Building large Fortran codebases efficiently requires dependency
tracking. When using gfortran, this is currently hampered by the fact
that, given a file code.f90 that contains a module use_me, when
code.f90 is recompiled after having changed, the module file
use_me.mod is overwritten on the disk, even if its content hasn't
changed.
This patch solves this by adding, on the second line of module files,
a MD5 sum of the contents of the module file itself (except the first
two lines). Furthermore, when a module is created, it's written to
disk in a use_me.mod0 file, which is then only renamed into
use_me.mod if it is different from the old one (as determined by
reading the old MD5 sum and comparing). Thus, we don't update module
files that haven't changed.
The patch comes with a testcase, and a new dejagnu procedure, scan-
module, to scan module files. Janis, I need your approval for that
one, and will welcome comments!
This was regtested on x86_64-linux, and I will test on i386-pc-
mingw32 before committing. OK for mainline?
FX