[Cmake-commits] CMake branch, next, updated. v3.7.0-1239-gaf3ae22

Brad King brad.king at kitware.com
Thu Nov 17 13:28:49 EST 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  af3ae22aaa5397fe0b904b7de138740da402ad9e (commit)
       via  f5065d58f331268f22d3a433a60a60dbbecac0d4 (commit)
       via  d9ed2bbdfb2addfc64cd36c78453b945aa73815a (commit)
       via  420225ada23d2a72e16cc8ded6b2f21189eee3b3 (commit)
      from  db1ee8ada8a5c3e4dc286772663b2b6d2da190b1 (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=af3ae22aaa5397fe0b904b7de138740da402ad9e
commit af3ae22aaa5397fe0b904b7de138740da402ad9e
Merge: db1ee8a f5065d5
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Thu Nov 17 13:28:45 2016 -0500
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Thu Nov 17 13:28:45 2016 -0500

    Merge topic 'capture-clang-tidy-errors' into next
    
    f5065d58 cmake: Report if the <LANG>_CLANG_TIDY tool exits with non-zero
    d9ed2bbd cmake: If ldd for LINK_WHAT_YOU_USE fails to run then report why
    420225ad cmake: Comment why we ignore the include-what-you-use return code


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f5065d58f331268f22d3a433a60a60dbbecac0d4
commit f5065d58f331268f22d3a433a60a60dbbecac0d4
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Thu Nov 17 11:36:04 2016 -0500
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Thu Nov 17 11:49:53 2016 -0500

    cmake: Report if the <LANG>_CLANG_TIDY tool exits with non-zero
    
    When using `<LANG>_CLANG_TIDY` our internal launcher for the tool must
    capture its return code and stderr and report them on failure.
    Otherwise incorrect command lines silently fail.
    
    Closes: #16435

diff --git a/Help/release/dev/capture-clang-tidy-errors.rst b/Help/release/dev/capture-clang-tidy-errors.rst
new file mode 100644
index 0000000..14c32e6
--- /dev/null
+++ b/Help/release/dev/capture-clang-tidy-errors.rst
@@ -0,0 +1,6 @@
+capture-clang-tidy-errors
+-------------------------
+
+* If a command specified by the :prop_tgt:`<LANG>_CLANG_TIDY` target property
+  returns non-zero at build time this is now treated as an error instead of
+  silently ignored.
diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx
index dca5ffc..8431945 100644
--- a/Source/cmcmd.cxx
+++ b/Source/cmcmd.cxx
@@ -358,11 +358,13 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
 
         // Run the tidy command line.  Capture its stdout and hide its stderr.
         std::string stdOut;
-        if (!cmSystemTools::RunSingleCommand(tidy_cmd, &stdOut, CM_NULLPTR,
-                                             &ret, CM_NULLPTR,
-                                             cmSystemTools::OUTPUT_NONE)) {
-          std::cerr << "Error running '" << tidy_cmd[0] << "'\n";
-          return 1;
+        std::string stdErr;
+        if (!cmSystemTools::RunSingleCommand(tidy_cmd, &stdOut, &stdErr, &ret,
+                                             CM_NULLPTR,
+                                             cmSystemTools::OUTPUT_NONE) ||
+            ret != 0) {
+          std::cerr << "Error running '" << tidy_cmd[0] << "':\n" << stdErr;
+          return ret != 0 ? ret : 1;
         }
         // Output the stdout from clang-tidy to stderr
         std::cerr << stdOut;
diff --git a/Tests/RunCMake/ClangTidy/C-bad-Build-result.txt b/Tests/RunCMake/ClangTidy/C-bad-Build-result.txt
new file mode 100644
index 0000000..d197c91
--- /dev/null
+++ b/Tests/RunCMake/ClangTidy/C-bad-Build-result.txt
@@ -0,0 +1 @@
+[^0]
diff --git a/Tests/RunCMake/ClangTidy/C-bad-Build-stdout.txt b/Tests/RunCMake/ClangTidy/C-bad-Build-stdout.txt
new file mode 100644
index 0000000..ef0afe5
--- /dev/null
+++ b/Tests/RunCMake/ClangTidy/C-bad-Build-stdout.txt
@@ -0,0 +1,2 @@
+Error running '[^']*Tests/RunCMake/pseudo_tidy[^']*':
+bad command line arg '-bad'
diff --git a/Tests/RunCMake/ClangTidy/C-bad.cmake b/Tests/RunCMake/ClangTidy/C-bad.cmake
new file mode 100644
index 0000000..aa54c08
--- /dev/null
+++ b/Tests/RunCMake/ClangTidy/C-bad.cmake
@@ -0,0 +1,3 @@
+enable_language(C)
+set(CMAKE_C_CLANG_TIDY "${PSEUDO_TIDY}" -bad)
+add_executable(main main.c)
diff --git a/Tests/RunCMake/ClangTidy/RunCMakeTest.cmake b/Tests/RunCMake/ClangTidy/RunCMakeTest.cmake
index 27cd922..2f41e50 100644
--- a/Tests/RunCMake/ClangTidy/RunCMakeTest.cmake
+++ b/Tests/RunCMake/ClangTidy/RunCMakeTest.cmake
@@ -20,3 +20,4 @@ if (NOT RunCMake_GENERATOR STREQUAL "Watcom WMake")
   run_tidy(C-launch)
   run_tidy(CXX-launch)
 endif()
+run_tidy(C-bad)
diff --git a/Tests/RunCMake/pseudo_tidy.c b/Tests/RunCMake/pseudo_tidy.c
index c950d03..f435e47 100644
--- a/Tests/RunCMake/pseudo_tidy.c
+++ b/Tests/RunCMake/pseudo_tidy.c
@@ -1,9 +1,14 @@
 #include <stdio.h>
+#include <string.h>
 
 int main(int argc, char* argv[])
 {
   int i;
   for (i = 1; i < argc; ++i) {
+    if (strcmp(argv[i], "-bad") == 0) {
+      fprintf(stderr, "bad command line arg '-bad'\n");
+      return 1;
+    }
     if (argv[i][0] != '-') {
       fprintf(stdout, "%s:0:0: warning: message [checker]\n", argv[i]);
       break;

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d9ed2bbdfb2addfc64cd36c78453b945aa73815a
commit d9ed2bbdfb2addfc64cd36c78453b945aa73815a
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Thu Nov 17 11:34:32 2016 -0500
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Thu Nov 17 11:49:29 2016 -0500

    cmake: If ldd for LINK_WHAT_YOU_USE fails to run then report why

diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx
index 945913e..dca5ffc 100644
--- a/Source/cmcmd.cxx
+++ b/Source/cmcmd.cxx
@@ -378,11 +378,15 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
 
         // Run the ldd -u -r command line.
         // Capture its stdout and hide its stderr.
+        // Ignore its return code because the tool always returns non-zero
+        // if there are any warnings, but we just want to warn.
         std::string stdOut;
-        if (!cmSystemTools::RunSingleCommand(lwyu_cmd, &stdOut, CM_NULLPTR,
-                                             &ret, CM_NULLPTR,
+        std::string stdErr;
+        if (!cmSystemTools::RunSingleCommand(lwyu_cmd, &stdOut, &stdErr, &ret,
+                                             CM_NULLPTR,
                                              cmSystemTools::OUTPUT_NONE)) {
-          std::cerr << "Error running '" << lwyu_cmd[0] << "'\n";
+          std::cerr << "Error running '" << lwyu_cmd[0] << "': " << stdErr
+                    << "\n";
           return 1;
         }
 

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=420225ada23d2a72e16cc8ded6b2f21189eee3b3
commit 420225ada23d2a72e16cc8ded6b2f21189eee3b3
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Thu Nov 17 11:33:24 2016 -0500
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Thu Nov 17 11:49:29 2016 -0500

    cmake: Comment why we ignore the include-what-you-use return code

diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx
index 1db147a..945913e 100644
--- a/Source/cmcmd.cxx
+++ b/Source/cmcmd.cxx
@@ -327,6 +327,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
         iwyu_cmd.insert(iwyu_cmd.end(), orig_cmd.begin() + 1, orig_cmd.end());
 
         // Run the iwyu command line.  Capture its stderr and hide its stdout.
+        // Ignore its return code because the tool always returns non-zero.
         std::string stdErr;
         if (!cmSystemTools::RunSingleCommand(iwyu_cmd, CM_NULLPTR, &stdErr,
                                              &ret, CM_NULLPTR,

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

Summary of changes:
 Help/release/dev/capture-clang-tidy-errors.rst     |    6 +++++
 Source/cmcmd.cxx                                   |   23 +++++++++++++-------
 .../C-bad-Build-result.txt}                        |    0
 Tests/RunCMake/ClangTidy/C-bad-Build-stdout.txt    |    2 ++
 Tests/RunCMake/ClangTidy/C-bad.cmake               |    3 +++
 Tests/RunCMake/ClangTidy/RunCMakeTest.cmake        |    1 +
 Tests/RunCMake/pseudo_tidy.c                       |    5 +++++
 7 files changed, 32 insertions(+), 8 deletions(-)
 create mode 100644 Help/release/dev/capture-clang-tidy-errors.rst
 copy Tests/RunCMake/{CMP0060/CMP0060-OLD-Build-result.txt => ClangTidy/C-bad-Build-result.txt} (100%)
 create mode 100644 Tests/RunCMake/ClangTidy/C-bad-Build-stdout.txt
 create mode 100644 Tests/RunCMake/ClangTidy/C-bad.cmake


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list