From 7165065f03625df4ede55a04a7e957cc5dd15a40 Mon Sep 17 00:00:00 2001 From: Daniel Pfeifer Date: Fri, 5 May 2017 23:21:39 +0200 Subject: cmInstalledFile: add cmConfigure.h as first #include --- Source/cmInstalledFile.h | 2 ++ 1 file changed, 2 insertions(+) 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" -- cgit v0.12 From 6a91ee026547b2c9e2906a42c03fc49656470beb Mon Sep 17 00:00:00 2001 From: Daniel Pfeifer Date: Fri, 5 May 2017 23:21:39 +0200 Subject: IWYU: add mapping for cm::auto_ptr --- Utilities/IWYU/mapping.imp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Utilities/IWYU/mapping.imp b/Utilities/IWYU/mapping.imp index cfa90cc..31313e5 100644 --- a/Utilities/IWYU/mapping.imp +++ b/Utilities/IWYU/mapping.imp @@ -47,6 +47,12 @@ #{ symbol: [ "std::pair", private, "", public ] }, #{ symbol: [ "std::pair", private, "", public ] }, + # IWYU wrongly suggests to include "cm_auto_ptr.hxx" in some places. This + # might be a misinterpretation of a template specialization in . + # 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: [ "", public, "\"cm_array.hxx\"", public ] }, # { include: [ "", public, "\"cm_functional.hxx\"", public ] }, -- cgit v0.12 From 9535823b2cff81b05e4c6b64016a95e2264ecda5 Mon Sep 17 00:00:00 2001 From: Daniel Pfeifer Date: Fri, 5 May 2017 23:21:39 +0200 Subject: IWYU: map system symbols to libuv --- Utilities/IWYU/mapping.imp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Utilities/IWYU/mapping.imp b/Utilities/IWYU/mapping.imp index 31313e5..a732c9c 100644 --- a/Utilities/IWYU/mapping.imp +++ b/Utilities/IWYU/mapping.imp @@ -119,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 ] }, -- cgit v0.12 From f3e216131b7b0a889507c3c4100b298c75ad3d84 Mon Sep 17 00:00:00 2001 From: Daniel Pfeifer Date: Fri, 5 May 2017 23:21:39 +0200 Subject: cmServer: include what you use --- Source/cmFileMonitor.cxx | 4 ++-- Source/cmFileMonitor.h | 4 +++- Source/cmServer.cxx | 19 +++++++------------ Source/cmServer.h | 7 +++---- Source/cmServerConnection.cxx | 3 +-- Source/cmServerConnection.h | 14 ++++++-------- Source/cmServerProtocol.cxx | 21 +++++++++++++-------- Source/cmServerProtocol.h | 16 ++++++++-------- 8 files changed, 43 insertions(+), 45 deletions(-) diff --git a/Source/cmFileMonitor.cxx b/Source/cmFileMonitor.cxx index ed794c3..6971465 100644 --- a/Source/cmFileMonitor.cxx +++ b/Source/cmFileMonitor.cxx @@ -5,9 +5,9 @@ #include "cmsys/SystemTools.hxx" #include -#include -#include +#include #include +#include 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 #include @@ -14,6 +14,8 @@ class cmRootWatcher; class cmFileMonitor { + CM_DISABLE_COPY(cmFileMonitor) + public: cmFileMonitor(uv_loop_t* l); ~cmFileMonitor(); 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 -#include -#include -#include +#include +#include +#include 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 #include @@ -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 #include 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 -#include - -#if defined(CMAKE_BUILD_WITH_CMAKE) #include "cm_uv.h" -#endif -class cmServer; +#include + 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 +#include +#include +#include +#include +#include +#include #include +#include #include // 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 #include +#include -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 ProtocolVersion() const = 0; virtual bool IsExperimental() const = 0; -- cgit v0.12 From 50dd15af58aa9fd69549f769916955b46fdad4eb Mon Sep 17 00:00:00 2001 From: Daniel Pfeifer Date: Fri, 5 May 2017 23:21:40 +0200 Subject: QtDialog: block include-what-you-use --- Source/QtDialog/CMakeLists.txt | 6 ++++++ 1 file changed, 6 insertions(+) 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 -- cgit v0.12