[Cmake-commits] CMake branch, next, updated. v3.6.0-rc1-254-gf3a1b9a

Stephen Kelly steveire at gmail.com
Sun Jun 12 13:03:52 EDT 2016


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  f3a1b9ac463d290948700ae3e2ebf8a74cb31d44 (commit)
       via  4c906353577e6b6687ae77f550a496f30ec89894 (commit)
       via  bd2b051d2d3dddbfadfb7d37001071d2e3fd9e76 (commit)
      from  80c3bc166b338baf37a8be17c30b993dc9934ab1 (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 -----------------------------------------------------------------
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f3a1b9ac463d290948700ae3e2ebf8a74cb31d44
commit f3a1b9ac463d290948700ae3e2ebf8a74cb31d44
Merge: 80c3bc1 4c90635
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Sun Jun 12 13:03:51 2016 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Sun Jun 12 13:03:51 2016 -0400

    Merge topic 'clean-up-Parser' into next
    
    4c906353 Parser: Out-of-line conditional code to cmMakefile
    bd2b051d Parser: Issue file open error messages through dedicated API


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=4c906353577e6b6687ae77f550a496f30ec89894
commit 4c906353577e6b6687ae77f550a496f30ec89894
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Thu Jan 28 22:10:26 2016 +0100
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Sun Jun 12 19:01:18 2016 +0200

    Parser: Out-of-line conditional code to cmMakefile
    
    Simplify parser API.

diff --git a/Source/cmListFileCache.cxx b/Source/cmListFileCache.cxx
index d0c48d1..52b18f8 100644
--- a/Source/cmListFileCache.cxx
+++ b/Source/cmListFileCache.cxx
@@ -129,7 +129,7 @@ bool cmListFileParser::ParseFile()
   return true;
 }
 
-bool cmListFile::ParseFile(const char* filename, bool topLevel, cmMakefile* mf)
+bool cmListFile::ParseFile(const char* filename, cmMakefile* mf)
 {
   if (!cmSystemTools::FileExists(filename) ||
       cmSystemTools::FileIsDirectory(filename)) {
@@ -143,76 +143,6 @@ bool cmListFile::ParseFile(const char* filename, bool topLevel, cmMakefile* mf)
     parseError = !parser.ParseFile();
   }
 
-  // do we need a cmake_policy(VERSION call?
-  if (topLevel) {
-    bool hasVersion = false;
-    // search for the right policy command
-    for (std::vector<cmListFileFunction>::iterator i = this->Functions.begin();
-         i != this->Functions.end(); ++i) {
-      if (cmSystemTools::LowerCase(i->Name) == "cmake_minimum_required") {
-        hasVersion = true;
-        break;
-      }
-    }
-    // if no policy command is found this is an error if they use any
-    // non advanced functions or a lot of functions
-    if (!hasVersion) {
-      bool isProblem = true;
-      if (this->Functions.size() < 30) {
-        // the list of simple commands DO NOT ADD TO THIS LIST!!!!!
-        // these commands must have backwards compatibility forever and
-        // and that is a lot longer than your tiny mind can comprehend mortal
-        std::set<std::string> allowedCommands;
-        allowedCommands.insert("project");
-        allowedCommands.insert("set");
-        allowedCommands.insert("if");
-        allowedCommands.insert("endif");
-        allowedCommands.insert("else");
-        allowedCommands.insert("elseif");
-        allowedCommands.insert("add_executable");
-        allowedCommands.insert("add_library");
-        allowedCommands.insert("target_link_libraries");
-        allowedCommands.insert("option");
-        allowedCommands.insert("message");
-        isProblem = false;
-        for (std::vector<cmListFileFunction>::iterator i =
-               this->Functions.begin();
-             i != this->Functions.end(); ++i) {
-          std::string name = cmSystemTools::LowerCase(i->Name);
-          if (allowedCommands.find(name) == allowedCommands.end()) {
-            isProblem = true;
-            break;
-          }
-        }
-      }
-
-      if (isProblem) {
-        // Tell the top level cmMakefile to diagnose
-        // this violation of CMP0000.
-        mf->SetCheckCMP0000(true);
-
-        // Implicitly set the version for the user.
-        mf->SetPolicyVersion("2.4");
-      }
-    }
-    bool hasProject = false;
-    // search for a project command
-    for (std::vector<cmListFileFunction>::iterator i = this->Functions.begin();
-         i != this->Functions.end(); ++i) {
-      if (cmSystemTools::LowerCase(i->Name) == "project") {
-        hasProject = true;
-        break;
-      }
-    }
-    // if no project command is found, add one
-    if (!hasProject) {
-      cmListFileFunction project;
-      project.Name = "PROJECT";
-      cmListFileArgument prj("Project", cmListFileArgument::Unquoted, 0);
-      project.Arguments.push_back(prj);
-      this->Functions.insert(this->Functions.begin(), project);
-    }
-  }
   return !parseError;
 }
 
diff --git a/Source/cmListFileCache.h b/Source/cmListFileCache.h
index d72c360..f3e6f70 100644
--- a/Source/cmListFileCache.h
+++ b/Source/cmListFileCache.h
@@ -158,7 +158,7 @@ private:
 
 struct cmListFile
 {
-  bool ParseFile(const char* path, bool topLevel, cmMakefile* mf);
+  bool ParseFile(const char* path, cmMakefile* mf);
 
   std::vector<cmListFileFunction> Functions;
 };
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index ca30b3d..0a80347 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -426,7 +426,7 @@ bool cmMakefile::ReadDependentFile(const char* filename, bool noPolicyScope)
   IncludeScope incScope(this, filenametoread, noPolicyScope);
 
   cmListFile listFile;
-  if (!listFile.ParseFile(filenametoread.c_str(), false, this)) {
+  if (!listFile.ParseFile(filenametoread.c_str(), this)) {
     return false;
   }
 
@@ -475,7 +475,7 @@ bool cmMakefile::ReadListFile(const char* filename)
   ListFileScope scope(this, filenametoread);
 
   cmListFile listFile;
-  if (!listFile.ParseFile(filenametoread.c_str(), false, this)) {
+  if (!listFile.ParseFile(filenametoread.c_str(), this)) {
     return false;
   }
 
@@ -1420,10 +1420,81 @@ void cmMakefile::Configure()
   this->AddDefinition("CMAKE_PARENT_LIST_FILE", currentStart.c_str());
 
   cmListFile listFile;
-  if (!listFile.ParseFile(currentStart.c_str(), this->IsRootMakefile(),
-                          this)) {
+  if (!listFile.ParseFile(currentStart.c_str(), this)) {
     return;
   }
+  if (this->IsRootMakefile()) {
+    bool hasVersion = false;
+    // search for the right policy command
+    for (std::vector<cmListFileFunction>::iterator i =
+           listFile.Functions.begin();
+         i != listFile.Functions.end(); ++i) {
+      if (cmSystemTools::LowerCase(i->Name) == "cmake_minimum_required") {
+        hasVersion = true;
+        break;
+      }
+    }
+    // if no policy command is found this is an error if they use any
+    // non advanced functions or a lot of functions
+    if (!hasVersion) {
+      bool isProblem = true;
+      if (listFile.Functions.size() < 30) {
+        // the list of simple commands DO NOT ADD TO THIS LIST!!!!!
+        // these commands must have backwards compatibility forever and
+        // and that is a lot longer than your tiny mind can comprehend mortal
+        std::set<std::string> allowedCommands;
+        allowedCommands.insert("project");
+        allowedCommands.insert("set");
+        allowedCommands.insert("if");
+        allowedCommands.insert("endif");
+        allowedCommands.insert("else");
+        allowedCommands.insert("elseif");
+        allowedCommands.insert("add_executable");
+        allowedCommands.insert("add_library");
+        allowedCommands.insert("target_link_libraries");
+        allowedCommands.insert("option");
+        allowedCommands.insert("message");
+        isProblem = false;
+        for (std::vector<cmListFileFunction>::iterator i =
+               listFile.Functions.begin();
+             i != listFile.Functions.end(); ++i) {
+          std::string name = cmSystemTools::LowerCase(i->Name);
+          if (allowedCommands.find(name) == allowedCommands.end()) {
+            isProblem = true;
+            break;
+          }
+        }
+      }
+
+      if (isProblem) {
+        // Tell the top level cmMakefile to diagnose
+        // this violation of CMP0000.
+        this->SetCheckCMP0000(true);
+
+        // Implicitly set the version for the user.
+        this->SetPolicyVersion("2.4");
+      }
+    }
+    bool hasProject = false;
+    // search for a project command
+    for (std::vector<cmListFileFunction>::iterator i =
+           listFile.Functions.begin();
+         i != listFile.Functions.end(); ++i) {
+      if (cmSystemTools::LowerCase(i->Name) == "project") {
+        hasProject = true;
+        break;
+      }
+    }
+    // if no project command is found, add one
+    if (!hasProject) {
+      cmListFileFunction project;
+      project.Name = "PROJECT";
+      cmListFileArgument prj("Project", cmListFileArgument::Unquoted, 0);
+      project.Arguments.push_back(prj);
+      listFile.Functions.insert(listFile.Functions.begin(), project);
+    }
+  }
+
   this->ReadListFile(listFile, currentStart);
   if (cmSystemTools::GetFatalErrorOccured()) {
     scope.Quiet();

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=bd2b051d2d3dddbfadfb7d37001071d2e3fd9e76
commit bd2b051d2d3dddbfadfb7d37001071d2e3fd9e76
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Thu Jun 9 09:58:15 2016 +0200
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Sun Jun 12 19:01:18 2016 +0200

    Parser: Issue file open error messages through dedicated API

diff --git a/Source/cmListFileCache.cxx b/Source/cmListFileCache.cxx
index 547b582..d0c48d1 100644
--- a/Source/cmListFileCache.cxx
+++ b/Source/cmListFileCache.cxx
@@ -24,6 +24,7 @@ struct cmListFileParser
   cmListFileParser(cmListFile* lf, cmMakefile* mf, const char* filename);
   ~cmListFileParser();
   void IssueError(std::string const& text);
+  void IssueFileOpenError(std::string const& text) const;
   bool ParseFile();
   bool ParseFunction(const char* name, long line);
   bool AddArgument(cmListFileLexer_Token* token,
@@ -57,6 +58,12 @@ cmListFileParser::~cmListFileParser()
   cmListFileLexer_Delete(this->Lexer);
 }
 
+void cmListFileParser::IssueFileOpenError(const std::string& text) const
+{
+  this->Makefile->GetCMakeInstance()->IssueMessage(cmake::FATAL_ERROR, text,
+                                                   this->Backtrace);
+}
+
 void cmListFileParser::IssueError(const std::string& text)
 {
   cmListFileContext lfc;
@@ -73,16 +80,15 @@ bool cmListFileParser::ParseFile()
   // Open the file.
   cmListFileLexer_BOM bom;
   if (!cmListFileLexer_SetFileName(this->Lexer, this->FileName, &bom)) {
-    cmSystemTools::Error("cmListFileCache: error can not open file ",
-                         this->FileName);
+    this->IssueFileOpenError("cmListFileCache: error can not open file.");
     return false;
   }
 
   // Verify the Byte-Order-Mark, if any.
   if (bom != cmListFileLexer_BOM_None && bom != cmListFileLexer_BOM_UTF8) {
     cmListFileLexer_SetFileName(this->Lexer, 0, 0);
-    this->Makefile->IssueMessage(cmake::FATAL_ERROR,
-     "File starts with a Byte-Order-Mark that is not UTF-8.");
+    this->IssueFileOpenError(
+      "File starts with a Byte-Order-Mark that is not UTF-8.");
     return false;
   }
 

-----------------------------------------------------------------------

Summary of changes:


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list