[cmake-commits] king committed cmDependsC.cxx 1.30 1.31 cmDependsC.h 1.19 1.20

cmake-commits at cmake.org cmake-commits at cmake.org
Mon Feb 5 09:48:40 EST 2007


Update of /cvsroot/CMake/CMake/Source
In directory public:/mounts/ram/cvs-serv2225

Modified Files:
	cmDependsC.cxx cmDependsC.h 
Log Message:
BUG: Patch from Alex to recompute dependencies when the include regex changes.  This addresses bug#4168.


Index: cmDependsC.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmDependsC.h,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- cmDependsC.h	13 Sep 2006 16:43:32 -0000	1.19
+++ cmDependsC.h	5 Feb 2007 14:48:38 -0000	1.20
@@ -60,6 +60,9 @@
   // recursively and which to complain about not finding.
   cmsys::RegularExpression IncludeRegexScan;
   cmsys::RegularExpression IncludeRegexComplain;
+  const std::string IncludeRegexLineString;
+  const std::string IncludeRegexScanString;
+  const std::string IncludeRegexComplainString;
 
 public:
   // Data structures for dependency graph walk.

Index: cmDependsC.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmDependsC.cxx,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -d -r1.30 -r1.31
--- cmDependsC.cxx	27 Sep 2006 16:55:58 -0000	1.30
+++ cmDependsC.cxx	5 Feb 2007 14:48:38 -0000	1.31
@@ -22,6 +22,13 @@
 
 #include <ctype.h> // isspace
 
+
+#define INCLUDE_REGEX_LINE "^[ \t]*#[ \t]*(include|import)[ \t]*[<\"]([^\">]+)([\">])"
+
+#define INCLUDE_REGEX_LINE_MARKER "#IncludeRegexLine: "
+#define INCLUDE_REGEX_SCAN_MARKER "#IncludeRegexScan: "
+#define INCLUDE_REGEX_COMPLAIN_MARKER "#IncludeRegexComplain: "
+
 //----------------------------------------------------------------------------
 cmDependsC::cmDependsC():
   IncludePath(0)
@@ -33,10 +40,12 @@
                        const char* scanRegex, const char* complainRegex,
                        const cmStdString& cacheFileName):
   IncludePath(&includes),
-  IncludeRegexLine(
-    "^[ \t]*#[ \t]*(include|import)[ \t]*[<\"]([^\">]+)([\">])"),
+  IncludeRegexLine(INCLUDE_REGEX_LINE),
   IncludeRegexScan(scanRegex),
   IncludeRegexComplain(complainRegex),
+  IncludeRegexLineString(INCLUDE_REGEX_LINE_MARKER INCLUDE_REGEX_LINE),
+  IncludeRegexScanString(std::string(INCLUDE_REGEX_SCAN_MARKER)+scanRegex),
+  IncludeRegexComplainString(std::string(INCLUDE_REGEX_COMPLAIN_MARKER)+complainRegex),
   CacheFileName(cacheFileName)
 {
   this->ReadCacheFile();
@@ -281,6 +290,31 @@
         cacheEntry=new cmIncludeLines;
         this->FileCache[line]=cacheEntry;
         }
+      // file doesn't exist, check that the regular expressions haven't changed
+      else if (res==false)
+        {
+        if (line.find(INCLUDE_REGEX_LINE_MARKER) == 0)
+          {
+          if (line != this->IncludeRegexLineString)
+            {
+            return;
+            }
+          }
+        else if (line.find(INCLUDE_REGEX_SCAN_MARKER) == 0)
+          {
+          if (line != this->IncludeRegexScanString)
+            {
+            return;
+            }
+          }
+        else if (line.find(INCLUDE_REGEX_COMPLAIN_MARKER) == 0)
+          {
+          if (line != this->IncludeRegexComplainString)
+            {
+            return;
+            }
+          }
+        }
       }
     else if (cacheEntry!=0)
       {
@@ -311,6 +345,10 @@
     return;
     }
   
+  cacheOut << this->IncludeRegexLineString << "\n\n";
+  cacheOut << this->IncludeRegexScanString << "\n\n";
+  cacheOut << this->IncludeRegexComplainString << "\n\n";
+
   for (std::map<cmStdString, cmIncludeLines*>::const_iterator fileIt=
          this->FileCache.begin();
        fileIt!=this->FileCache.end(); ++fileIt)



More information about the Cmake-commits mailing list