[Cmake-commits] CMake branch, next, updated. v3.0.0-3785-gfaf118d
Brad King
brad.king at kitware.com
Thu Jun 19 09:31:16 EDT 2014
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".
The branch, next has been updated
via faf118d36bc137b95836b171a895d2b7e7f0f63d (commit)
via 2ce6a4e0429b8568237cc274a4a1f3c9b8335dc2 (commit)
from ce0fc375226be1602328576c1b3a5ba2671530e5 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=faf118d36bc137b95836b171a895d2b7e7f0f63d
commit faf118d36bc137b95836b171a895d2b7e7f0f63d
Merge: ce0fc37 2ce6a4e
Author: Brad King <brad.king at kitware.com>
AuthorDate: Thu Jun 19 09:31:15 2014 -0400
Commit: CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Thu Jun 19 09:31:15 2014 -0400
Merge topic 'gfortran-compressed-modules' into next
2ce6a4e0 Fortran: Add support for GNU >= 4.9 compressed modules (#14975)
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2ce6a4e0429b8568237cc274a4a1f3c9b8335dc2
commit 2ce6a4e0429b8568237cc274a4a1f3c9b8335dc2
Author: Brad King <brad.king at kitware.com>
AuthorDate: Thu Jun 19 09:11:29 2014 -0400
Commit: Brad King <brad.king at kitware.com>
CommitDate: Thu Jun 19 09:17:10 2014 -0400
Fortran: Add support for GNU >= 4.9 compressed modules (#14975)
From the GCC 4.9 release notes for Fortran:
https://gcc.gnu.org/gcc-4.9/changes.html
"Module files: The version of the module files (.mod) has been
incremented; additionally, module files are now compressed."
Teach cmDependsFortran::ModulesDiffer to look for the gzip magic numbers
at the beginning of the module file. If found, assume the module was
produced by gfortran >= 4.9. The modules do not appear to contain the
date as earlier versions did so we can compare the content directly
and do not actually need to decompress.
diff --git a/Source/cmDependsFortran.cxx b/Source/cmDependsFortran.cxx
index d5472a1..157a52f 100644
--- a/Source/cmDependsFortran.cxx
+++ b/Source/cmDependsFortran.cxx
@@ -765,7 +765,11 @@ bool cmDependsFortran::ModulesDiffer(const char* modFile,
const char* compilerId)
{
/*
- gnu:
+ gnu >= 4.9:
+ A mod file is an ascii file compressed with gzip.
+ Compiling twice produces identical modules.
+
+ gnu < 4.9:
A mod file is an ascii file.
<bar.mod>
FORTRAN module created from /path/to/foo.f90 on Sun Dec 30 22:47:58 2007
@@ -821,21 +825,30 @@ bool cmDependsFortran::ModulesDiffer(const char* modFile,
*/
if (strcmp(compilerId, "GNU") == 0 )
{
- const char seq[1] = {'\n'};
- const int seqlen = 1;
-
- if(!cmDependsFortranStreamContainsSequence(finModFile, seq, seqlen))
+ // GNU Fortran 4.9 and later compress .mod files with gzip
+ // but also do not include a date so we can fall through to
+ // compare them without skipping any prefix.
+ unsigned char hdr[2];
+ bool okay = finModFile.read(reinterpret_cast<char*>(hdr), 2);
+ finModFile.seekg(0);
+ if(!(okay && hdr[0] == 0x1f && hdr[1] == 0x8b))
{
- // The module is of unexpected format. Assume it is different.
- std::cerr << compilerId << " fortran module " << modFile
- << " has unexpected format." << std::endl;
- return true;
- }
+ const char seq[1] = {'\n'};
+ const int seqlen = 1;
- if(!cmDependsFortranStreamContainsSequence(finStampFile, seq, seqlen))
- {
- // The stamp must differ if the sequence is not contained.
- return true;
+ if(!cmDependsFortranStreamContainsSequence(finModFile, seq, seqlen))
+ {
+ // The module is of unexpected format. Assume it is different.
+ std::cerr << compilerId << " fortran module " << modFile
+ << " has unexpected format." << std::endl;
+ return true;
+ }
+
+ if(!cmDependsFortranStreamContainsSequence(finStampFile, seq, seqlen))
+ {
+ // The stamp must differ if the sequence is not contained.
+ return true;
+ }
}
}
else if(strcmp(compilerId, "Intel") == 0)
-----------------------------------------------------------------------
Summary of changes:
Source/cmDependsFortran.cxx | 41 +++++++++++++++++++++++++++--------------
1 file changed, 27 insertions(+), 14 deletions(-)
hooks/post-receive
--
CMake
More information about the Cmake-commits
mailing list