summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2017-05-08 14:03:10 (GMT)
committerKitware Robot <kwrobot@kitware.com>2017-05-08 14:03:15 (GMT)
commit22d0a83a4cc2188119e008ed346a10f7b0b32f8e (patch)
treef5349a0869c9b7b1a77db33d878ce47769d0c2d0
parent141b8ccf2cddc6b5d3c3c7258cefb181c09e5ce9 (diff)
parent50dd15af58aa9fd69549f769916955b46fdad4eb (diff)
downloadCMake-22d0a83a4cc2188119e008ed346a10f7b0b32f8e.zip
CMake-22d0a83a4cc2188119e008ed346a10f7b0b32f8e.tar.gz
CMake-22d0a83a4cc2188119e008ed346a10f7b0b32f8e.tar.bz2
Merge topic 'c++11-iwyu'
50dd15af QtDialog: block include-what-you-use f3e21613 cmServer: include what you use 9535823b IWYU: map system symbols to libuv 6a91ee02 IWYU: add mapping for cm::auto_ptr 7165065f cmInstalledFile: add cmConfigure.h as first #include Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !811
-rw-r--r--Source/QtDialog/CMakeLists.txt6
-rw-r--r--Source/cmFileMonitor.cxx4
-rw-r--r--Source/cmFileMonitor.h4
-rw-r--r--Source/cmInstalledFile.h2
-rw-r--r--Source/cmServer.cxx19
-rw-r--r--Source/cmServer.h7
-rw-r--r--Source/cmServerConnection.cxx3
-rw-r--r--Source/cmServerConnection.h14
-rw-r--r--Source/cmServerProtocol.cxx21
-rw-r--r--Source/cmServerProtocol.h16
-rw-r--r--Utilities/IWYU/mapping.imp11
11 files changed, 62 insertions, 45 deletions
diff --git a/Source/QtDialog/CMakeLists.txt b/Source/QtDialog/CMakeLists.txt
index 8619fe9..9e9df78 100644
--- a/Source/QtDialog/CMakeLists.txt
+++ b/Source/QtDialog/CMakeLists.txt
@@ -160,6 +160,12 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON)
add_executable(cmake-gui WIN32 MACOSX_BUNDLE ${SRCS} ${MANIFEST_FILE})
target_link_libraries(cmake-gui CMakeLib ${QT_QTMAIN_LIBRARY} ${CMake_QT_LIBRARIES})
+# cmake-gui has not been updated for `include-what-you-use`.
+# Block the tool until this is done.
+set_target_properties(cmake-gui PROPERTIES
+ CXX_INCLUDE_WHAT_YOU_USE ""
+ )
+
# Files generated by MOC, RCC, and UIC may produce clang-tidy warnings.
# We generate a dummy .clang-tidy file in the binary directory that disables
# all clang-tidy checks except one that will never match. This one check is
diff --git a/Source/cmFileMonitor.cxx b/Source/cmFileMonitor.cxx
index 499ee84..8027535 100644
--- a/Source/cmFileMonitor.cxx
+++ b/Source/cmFileMonitor.cxx
@@ -6,9 +6,9 @@
#include "cmsys/SystemTools.hxx"
#include <cassert>
-#include <iostream>
-#include <set>
+#include <stddef.h>
#include <unordered_map>
+#include <utility>
namespace {
void on_directory_change(uv_fs_event_t* handle, const char* filename,
diff --git a/Source/cmFileMonitor.h b/Source/cmFileMonitor.h
index 8574db0..d7ec92a 100644
--- a/Source/cmFileMonitor.h
+++ b/Source/cmFileMonitor.h
@@ -2,7 +2,7 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#pragma once
-#include "cmConfigure.h" // IWYU pragma: keep
+#include "cmConfigure.h"
#include <functional>
#include <string>
@@ -14,6 +14,8 @@ class cmRootWatcher;
class cmFileMonitor
{
+ CM_DISABLE_COPY(cmFileMonitor)
+
public:
cmFileMonitor(uv_loop_t* l);
~cmFileMonitor();
diff --git a/Source/cmInstalledFile.h b/Source/cmInstalledFile.h
index 4fe8134..fbf754f 100644
--- a/Source/cmInstalledFile.h
+++ b/Source/cmInstalledFile.h
@@ -3,6 +3,8 @@
#ifndef cmInstalledFile_h
#define cmInstalledFile_h
+#include "cmConfigure.h" // IWYU pragma: keep
+
#include "cmGeneratorExpression.h"
#include "cm_auto_ptr.hxx"
diff --git a/Source/cmServer.cxx b/Source/cmServer.cxx
index 5a71dc0..19bdd45 100644
--- a/Source/cmServer.cxx
+++ b/Source/cmServer.cxx
@@ -6,18 +6,15 @@
#include "cmServerDictionary.h"
#include "cmServerProtocol.h"
#include "cmSystemTools.h"
-#include "cmVersionMacros.h"
-#include "cmake.h"
-
-#if defined(CMAKE_BUILD_WITH_CMAKE)
#include "cm_jsoncpp_reader.h"
-#include "cm_jsoncpp_value.h"
-#endif
+#include "cm_jsoncpp_writer.h"
+#include "cmake.h"
+#include "cmsys/FStream.hxx"
#include <algorithm>
-#include <fstream>
-#include <iostream>
-#include <memory>
+#include <cassert>
+#include <cstdint>
+#include <utility>
class cmServer::DebugInfo
{
@@ -270,10 +267,8 @@ void cmServer::WriteJsonObject(const Json::Value& jsonValue,
}
if (!debug->OutputFile.empty()) {
- std::ofstream myfile;
- myfile.open(debug->OutputFile);
+ cmsys::ofstream myfile(debug->OutputFile.c_str());
myfile << result;
- myfile.close();
}
}
diff --git a/Source/cmServer.h b/Source/cmServer.h
index 7f29e32..b814050 100644
--- a/Source/cmServer.h
+++ b/Source/cmServer.h
@@ -2,13 +2,10 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#pragma once
-#include "cmListFileCache.h"
-#include "cmState.h"
+#include "cmConfigure.h"
-#if defined(CMAKE_BUILD_WITH_CMAKE)
#include "cm_jsoncpp_value.h"
#include "cm_uv.h"
-#endif
#include <string>
#include <vector>
@@ -21,6 +18,8 @@ class cmServerResponse;
class cmServer
{
+ CM_DISABLE_COPY(cmServer)
+
public:
class DebugInfo;
diff --git a/Source/cmServerConnection.cxx b/Source/cmServerConnection.cxx
index 008052b..36312ed 100644
--- a/Source/cmServerConnection.cxx
+++ b/Source/cmServerConnection.cxx
@@ -2,10 +2,9 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmServerConnection.h"
-#include "cmServerDictionary.h"
-
#include "cmFileMonitor.h"
#include "cmServer.h"
+#include "cmServerDictionary.h"
#include <assert.h>
#include <string.h>
diff --git a/Source/cmServerConnection.h b/Source/cmServerConnection.h
index 1fabe37..b96bf3c 100644
--- a/Source/cmServerConnection.h
+++ b/Source/cmServerConnection.h
@@ -2,21 +2,19 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#pragma once
-#include "cmConfigure.h" // IWYU pragma: keep
+#include "cmConfigure.h"
-#include <string>
-#include <vector>
-
-#if defined(CMAKE_BUILD_WITH_CMAKE)
#include "cm_uv.h"
-#endif
-class cmServer;
+#include <string>
+
class cmFileMonitor;
-class LoopGuard;
+class cmServer;
class cmServerConnection
{
+ CM_DISABLE_COPY(cmServerConnection)
+
public:
cmServerConnection();
virtual ~cmServerConnection();
diff --git a/Source/cmServerProtocol.cxx b/Source/cmServerProtocol.cxx
index 11ee897..4e9e80f 100644
--- a/Source/cmServerProtocol.cxx
+++ b/Source/cmServerProtocol.cxx
@@ -4,27 +4,32 @@
#include "cmExternalMakefileProjectGenerator.h"
#include "cmFileMonitor.h"
+#include "cmGeneratorExpression.h"
#include "cmGeneratorTarget.h"
#include "cmGlobalGenerator.h"
#include "cmLinkLineComputer.h"
-#include "cmListFileCache.h"
#include "cmLocalGenerator.h"
#include "cmMakefile.h"
#include "cmServer.h"
#include "cmServerDictionary.h"
#include "cmSourceFile.h"
+#include "cmState.h"
+#include "cmStateDirectory.h"
+#include "cmStateSnapshot.h"
+#include "cmStateTypes.h"
#include "cmSystemTools.h"
+#include "cm_uv.h"
#include "cmake.h"
-#include "cmServerDictionary.h"
-
-#if defined(CMAKE_BUILD_WITH_CMAKE)
-#include "cm_jsoncpp_reader.h"
-#include "cm_jsoncpp_value.h"
-#endif
-
#include <algorithm>
+#include <cassert>
+#include <cstddef>
+#include <functional>
+#include <limits>
+#include <map>
+#include <set>
#include <string>
+#include <unordered_map>
#include <vector>
// Get rid of some windows macros:
diff --git a/Source/cmServerProtocol.h b/Source/cmServerProtocol.h
index 027f145..83b3d58 100644
--- a/Source/cmServerProtocol.h
+++ b/Source/cmServerProtocol.h
@@ -2,20 +2,17 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#pragma once
-#include "cmListFileCache.h"
-#include "cmake.h"
+#include "cmConfigure.h"
-#if defined(CMAKE_BUILD_WITH_CMAKE)
-#include "cm_jsoncpp_writer.h"
-#endif
+#include "cm_jsoncpp_value.h"
+#include "cmake.h"
#include <memory>
#include <string>
+#include <utility>
-class cmake;
class cmFileMonitor;
class cmServer;
-
class cmServerRequest;
class cmServerResponse
@@ -72,8 +69,11 @@ private:
class cmServerProtocol
{
+ CM_DISABLE_COPY(cmServerProtocol)
+
public:
- virtual ~cmServerProtocol() {}
+ cmServerProtocol() = default;
+ virtual ~cmServerProtocol() = default;
virtual std::pair<int, int> ProtocolVersion() const = 0;
virtual bool IsExperimental() const = 0;
diff --git a/Utilities/IWYU/mapping.imp b/Utilities/IWYU/mapping.imp
index cfa90cc..a732c9c 100644
--- a/Utilities/IWYU/mapping.imp
+++ b/Utilities/IWYU/mapping.imp
@@ -47,6 +47,12 @@
#{ symbol: [ "std::pair", private, "<map>", public ] },
#{ symbol: [ "std::pair", private, "<set>", public ] },
+ # IWYU wrongly suggests to include "cm_auto_ptr.hxx" in some places. This
+ # might be a misinterpretation of a template specialization in <utility>.
+ # As a workaround, map the symbol auto_ptr to "cmConfigure.h".
+ # This will still correctly require "cm_auto_ptr.hxx" for CM_AUTO_PTR.
+ { symbol: [ "cm::auto_ptr", private, "\"cmConfigure.h\"", public ] },
+
# Wrappers for headers added in TR1 / C++11
# { include: [ "<array>", public, "\"cm_array.hxx\"", public ] },
# { include: [ "<functional>", public, "\"cm_functional.hxx\"", public ] },
@@ -113,6 +119,11 @@
{ include: [ "\"cmzlib/zconf.h\"", private, "\"cm_zlib.h\"", public ] },
{ include: [ "\"cmzlib/zlib.h\"", private, "\"cm_zlib.h\"", public ] },
+ # System symbols used by libuv
+ { symbol: [ "SIGHUP", private, "\"cm_uv.h\"", public ] },
+ { symbol: [ "SIGINT", private, "\"cm_uv.h\"", public ] },
+ { symbol: [ "ssize_t", private, "\"cm_uv.h\"", public ] },
+
{ symbol: [ "std::ifstream", private, "\"cmsys/FStream.hxx\"", public ] },
{ symbol: [ "std::ofstream", private, "\"cmsys/FStream.hxx\"", public ] },
{ symbol: [ "cmsys::ifstream", private, "\"cmsys/FStream.hxx\"", public ] },