[Cmake-commits] CMake branch, next, updated. v3.6.0-rc1-264-g63bc1a8

Stephen Kelly steveire at gmail.com
Sun Jun 12 16:09:51 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  63bc1a824aa06ec90bde12603d6bfaa612a80462 (commit)
       via  23f87e8157770c56d3aa568f3d1318f9b9070364 (commit)
       via  54c65d5fb22c3cc53ecd707687c2f25b1643726b (commit)
      from  b70f00924338bd5efe4144076bd7994223ef3195 (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=63bc1a824aa06ec90bde12603d6bfaa612a80462
commit 63bc1a824aa06ec90bde12603d6bfaa612a80462
Merge: b70f009 23f87e8
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Sun Jun 12 16:09:50 2016 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Sun Jun 12 16:09:50 2016 -0400

    Merge topic 'fix-cmake-ISP-violation' into next
    
    23f87e81 cmake: Remove force from IssueMessage API
    54c65d5f cmake: Extract DisplayMessage API.


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=23f87e8157770c56d3aa568f3d1318f9b9070364
commit 23f87e8157770c56d3aa568f3d1318f9b9070364
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Thu Jun 9 09:57:47 2016 +0200
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Sun Jun 12 22:09:27 2016 +0200

    cmake: Remove force from IssueMessage API
    
    The force parameter is ugly and makes the method harder to reason about
    (issues the message ... but maybe it doesn't ... but then again you can
    force it).  It is a violation of
    
     https://en.wikipedia.org/wiki/Interface_segregation_principle
    
    and is the kind of thing described in a recent blog here:
    
     http://code.joejag.com/2016/anti-if-the-missing-patterns.html
    
     "Any time you see this you actually have two methods bundled into one.
      That boolean represents an opportunity to name a concept in your code."

diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index ca30b3d..00ff5ac 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -105,8 +105,8 @@ cmMakefile::~cmMakefile()
   cmDeleteAll(this->EvaluationFiles);
 }
 
-void cmMakefile::IssueMessage(cmake::MessageType t, std::string const& text,
-                              bool force) const
+void cmMakefile::IssueMessage(cmake::MessageType t,
+                              std::string const& text) const
 {
   // Collect context information.
   if (!this->ExecutionStatusStack.empty()) {
@@ -114,7 +114,7 @@ void cmMakefile::IssueMessage(cmake::MessageType t, std::string const& text,
       this->ExecutionStatusStack.back()->SetNestedError(true);
     }
   }
-  this->GetCMakeInstance()->IssueMessage(t, text, this->GetBacktrace(), force);
+  this->GetCMakeInstance()->IssueMessage(t, text, this->GetBacktrace());
 }
 
 cmStringRange cmMakefile::GetIncludeDirectoriesEntries() const
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index c665b1f..719c764 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -715,8 +715,7 @@ public:
     cmMakefile* Makefile;
   };
 
-  void IssueMessage(cmake::MessageType t, std::string const& text,
-                    bool force = false) const;
+  void IssueMessage(cmake::MessageType t, std::string const& text) const;
 
   /** Set whether or not to report a CMP0000 violation.  */
   void SetCheckCMP0000(bool b) { this->CheckCMP0000 = b; }
diff --git a/Source/cmMessageCommand.cxx b/Source/cmMessageCommand.cxx
index f4458a7..689e3fa 100644
--- a/Source/cmMessageCommand.cxx
+++ b/Source/cmMessageCommand.cxx
@@ -63,8 +63,9 @@ bool cmMessageCommand::InitialPass(std::vector<std::string> const& args,
   std::string message = cmJoin(cmMakeRange(i, args.end()), std::string());
 
   if (type != cmake::MESSAGE) {
-    // we've overriden the message type, above, so force IssueMessage to use it
-    this->Makefile->IssueMessage(type, message, true);
+    // we've overriden the message type, above, so display it directly
+    cmake* cm = this->Makefile->GetCMakeInstance();
+    cm->DisplayMessage(type, message, this->Makefile->GetBacktrace());
   } else {
     if (status) {
       this->Makefile->DisplayStatus(message.c_str(), -1);
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 657091b..594eebf 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -2294,16 +2294,14 @@ void displayMessage(cmake::MessageType t, std::ostringstream& msg)
 }
 
 void cmake::IssueMessage(cmake::MessageType t, std::string const& text,
-                         cmListFileBacktrace const& backtrace,
-                         bool force) const
-{
-  if (!force) {
-    // override the message type, if needed, for warnings and errors
-    cmake::MessageType override = this->ConvertMessageType(t);
-    if (override != t) {
-      t = override;
-      force = true;
-    }
+                         cmListFileBacktrace const& backtrace) const
+{
+  bool force = false;
+  // override the message type, if needed, for warnings and errors
+  cmake::MessageType override = this->ConvertMessageType(t);
+  if (override != t) {
+    t = override;
+    force = true;
   }
 
   if (!force && !this->IsMessageTypeVisible(t)) {
diff --git a/Source/cmake.h b/Source/cmake.h
index 1d63ede..523c576 100644
--- a/Source/cmake.h
+++ b/Source/cmake.h
@@ -381,8 +381,7 @@ public:
   /** Display a message to the user.  */
   void IssueMessage(
     cmake::MessageType t, std::string const& text,
-    cmListFileBacktrace const& backtrace = cmListFileBacktrace(),
-    bool force = false) const;
+    cmListFileBacktrace const& backtrace = cmListFileBacktrace()) const;
 
   void DisplayMessage(cmake::MessageType t, std::string const& text,
                       cmListFileBacktrace const& backtrace) const;

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=54c65d5fb22c3cc53ecd707687c2f25b1643726b
commit 54c65d5fb22c3cc53ecd707687c2f25b1643726b
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Sun Jun 12 22:06:01 2016 +0200
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Sun Jun 12 22:08:47 2016 +0200

    cmake: Extract DisplayMessage API.

diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index ecbdc61..657091b 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -2310,6 +2310,12 @@ void cmake::IssueMessage(cmake::MessageType t, std::string const& text,
     return;
   }
 
+  this->DisplayMessage(t, text, backtrace);
+}
+
+void cmake::DisplayMessage(cmake::MessageType t, std::string const& text,
+                           cmListFileBacktrace const& backtrace) const
+{
   std::ostringstream msg;
   if (!printMessagePreamble(t, msg)) {
     return;
diff --git a/Source/cmake.h b/Source/cmake.h
index 4958a05..1d63ede 100644
--- a/Source/cmake.h
+++ b/Source/cmake.h
@@ -384,6 +384,9 @@ public:
     cmListFileBacktrace const& backtrace = cmListFileBacktrace(),
     bool force = false) const;
 
+  void DisplayMessage(cmake::MessageType t, std::string const& text,
+                      cmListFileBacktrace const& backtrace) const;
+
   ///! run the --build option
   int Build(const std::string& dir, const std::string& target,
             const std::string& config,

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

Summary of changes:
 Source/cmMakefile.cxx       |    6 +++---
 Source/cmMakefile.h         |    3 +--
 Source/cmMessageCommand.cxx |    5 +++--
 Source/cmake.cxx            |   22 +++++++++++++---------
 Source/cmake.h              |    6 ++++--
 5 files changed, 24 insertions(+), 18 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list