diff options
-rw-r--r-- | Source/CMakeVersion.cmake | 2 | ||||
-rw-r--r-- | Source/CMakeVersion.rc.in | 3 | ||||
-rw-r--r-- | Source/Checks/cm_cxx_attribute_fallthrough.cxx | 11 | ||||
-rw-r--r-- | Source/Checks/cm_cxx_fallthrough.cxx | 11 | ||||
-rw-r--r-- | Source/Checks/cm_cxx_features.cmake | 7 | ||||
-rw-r--r-- | Source/Checks/cm_cxx_gnu_fallthrough.cxx | 11 | ||||
-rw-r--r-- | Source/cmConfigure.cmake.h.in | 13 | ||||
-rw-r--r-- | Source/cmStandardLexer.h | 2 | ||||
-rw-r--r-- | Source/kwsys/CMakeLists.txt | 1 | ||||
-rw-r--r-- | Source/kwsys/Configure.hxx.in | 26 | ||||
-rw-r--r-- | Source/kwsys/testConfigure.cxx | 30 | ||||
-rw-r--r-- | Tests/Server/cmakelib.py | 28 | ||||
-rwxr-xr-x | bootstrap | 1 |
13 files changed, 91 insertions, 55 deletions
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index afba743..305aa87 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 10) -set(CMake_VERSION_PATCH 20171130) +set(CMake_VERSION_PATCH 20171201) #set(CMake_VERSION_RC 1) diff --git a/Source/CMakeVersion.rc.in b/Source/CMakeVersion.rc.in index f4ca3d5..60e14e5 100644 --- a/Source/CMakeVersion.rc.in +++ b/Source/CMakeVersion.rc.in @@ -7,6 +7,9 @@ #define VER_PRODUCTVERSION @CMake_VERSION_MAJOR@,@CMake_VERSION_MINOR@,@CMake_VERSION_PATCH@ #define VER_PRODUCTVERSION_STR "@CMake_VERSION@\0" +/* Version-information resource identifier. */ +#define VS_VERSION_INFO 1 + VS_VERSION_INFO VERSIONINFO FILEVERSION VER_FILEVERSION PRODUCTVERSION VER_PRODUCTVERSION diff --git a/Source/Checks/cm_cxx_attribute_fallthrough.cxx b/Source/Checks/cm_cxx_attribute_fallthrough.cxx deleted file mode 100644 index 50605b7..0000000 --- a/Source/Checks/cm_cxx_attribute_fallthrough.cxx +++ /dev/null @@ -1,11 +0,0 @@ -int main(int argc, char* []) -{ - int i = 3; - switch (argc) { - case 1: - i = 0; - __attribute__((fallthrough)); - default: - return i; - } -} diff --git a/Source/Checks/cm_cxx_fallthrough.cxx b/Source/Checks/cm_cxx_fallthrough.cxx deleted file mode 100644 index 2825bed..0000000 --- a/Source/Checks/cm_cxx_fallthrough.cxx +++ /dev/null @@ -1,11 +0,0 @@ -int main(int argc, char* []) -{ - int i = 3; - switch (argc) { - case 1: - i = 0; - [[fallthrough]]; - default: - return i; - } -} diff --git a/Source/Checks/cm_cxx_features.cmake b/Source/Checks/cm_cxx_features.cmake index a30a5e6..2704c40 100644 --- a/Source/Checks/cm_cxx_features.cmake +++ b/Source/Checks/cm_cxx_features.cmake @@ -41,13 +41,6 @@ function(cm_check_cxx_feature name) endif() endfunction() -cm_check_cxx_feature(fallthrough) -if(NOT CMake_HAVE_CXX_FALLTHROUGH) - cm_check_cxx_feature(gnu_fallthrough) - if(NOT CMake_HAVE_CXX_GNU_FALLTHROUGH) - cm_check_cxx_feature(attribute_fallthrough) - endif() -endif() cm_check_cxx_feature(make_unique) if(CMake_HAVE_CXX_MAKE_UNIQUE) set(CMake_HAVE_CXX_UNIQUE_PTR 1) diff --git a/Source/Checks/cm_cxx_gnu_fallthrough.cxx b/Source/Checks/cm_cxx_gnu_fallthrough.cxx deleted file mode 100644 index ebc15f4..0000000 --- a/Source/Checks/cm_cxx_gnu_fallthrough.cxx +++ /dev/null @@ -1,11 +0,0 @@ -int main(int argc, char* []) -{ - int i = 3; - switch (argc) { - case 1: - i = 0; - [[gnu::fallthrough]]; - default: - return i; - } -} diff --git a/Source/cmConfigure.cmake.h.in b/Source/cmConfigure.cmake.h.in index 9a78aca..c80439b 100644 --- a/Source/cmConfigure.cmake.h.in +++ b/Source/cmConfigure.cmake.h.in @@ -19,22 +19,11 @@ #cmakedefine HAVE_UNSETENV #cmakedefine CMAKE_USE_ELF_PARSER #cmakedefine CMAKE_USE_MACH_PARSER -#cmakedefine CMake_HAVE_CXX_FALLTHROUGH -#cmakedefine CMake_HAVE_CXX_GNU_FALLTHROUGH -#cmakedefine CMake_HAVE_CXX_ATTRIBUTE_FALLTHROUGH #cmakedefine CMake_HAVE_CXX_MAKE_UNIQUE #define CMAKE_BIN_DIR "/@CMAKE_BIN_DIR@" #define CMAKE_DATA_DIR "/@CMAKE_DATA_DIR@" -#if defined(CMake_HAVE_CXX_FALLTHROUGH) -#define CM_FALLTHROUGH [[fallthrough]] -#elif defined(CMake_HAVE_CXX_GNU_FALLTHROUGH) -#define CM_FALLTHROUGH [[gnu::fallthrough]] -#elif defined(CMake_HAVE_CXX_ATTRIBUTE_FALLTHROUGH) -#define CM_FALLTHROUGH __attribute__((fallthrough)) -#else -#define CM_FALLTHROUGH -#endif +#define CM_FALLTHROUGH cmsys_FALLTHROUGH #define CM_DISABLE_COPY(Class) \ Class(Class const&) = delete; \ diff --git a/Source/cmStandardLexer.h b/Source/cmStandardLexer.h index c9f42e4..b212c7e 100644 --- a/Source/cmStandardLexer.h +++ b/Source/cmStandardLexer.h @@ -3,7 +3,7 @@ #ifndef cmStandardLexer_h #define cmStandardLexer_h -#include "cmConfigure.h" // IWYU pragma: keep +#include "cmsys/Configure.h" // IWYU pragma: keep /* Disable some warnings. */ #if defined(_MSC_VER) diff --git a/Source/kwsys/CMakeLists.txt b/Source/kwsys/CMakeLists.txt index 51f4088..64b6484 100644 --- a/Source/kwsys/CMakeLists.txt +++ b/Source/kwsys/CMakeLists.txt @@ -1033,6 +1033,7 @@ IF(KWSYS_STANDALONE OR CMake_SOURCE_DIR) ) ENDIF() SET(KWSYS_CXX_TESTS ${KWSYS_CXX_TESTS} + testConfigure testSystemTools testCommandLineArguments testCommandLineArguments1 diff --git a/Source/kwsys/Configure.hxx.in b/Source/kwsys/Configure.hxx.in index 1c07a4e..1e67874 100644 --- a/Source/kwsys/Configure.hxx.in +++ b/Source/kwsys/Configure.hxx.in @@ -12,6 +12,31 @@ #define @KWSYS_NAMESPACE@_CXX_HAS_EXT_STDIO_FILEBUF_H \ @KWSYS_CXX_HAS_EXT_STDIO_FILEBUF_H@ +#if defined(__SUNPRO_CC) && __SUNPRO_CC > 0x5130 && defined(__has_attribute) +#define @KWSYS_NAMESPACE@__has_cpp_attribute(x) __has_attribute(x) +#elif defined(__has_cpp_attribute) +#define @KWSYS_NAMESPACE@__has_cpp_attribute(x) __has_cpp_attribute(x) +#else +#define @KWSYS_NAMESPACE@__has_cpp_attribute(x) 0 +#endif + +#ifndef @KWSYS_NAMESPACE@_FALLTHROUGH +#if __cplusplus >= 201703L && @KWSYS_NAMESPACE@__has_cpp_attribute(fallthrough) +#define @KWSYS_NAMESPACE@_FALLTHROUGH [[fallthrough]] +#elif __cplusplus >= 201103L && \ + @KWSYS_NAMESPACE@__has_cpp_attribute(gnu::fallthrough) +#define @KWSYS_NAMESPACE@_FALLTHROUGH [[gnu::fallthrough]] +#elif __cplusplus >= 201103L && \ + @KWSYS_NAMESPACE@__has_cpp_attribute(clang::fallthrough) +#define @KWSYS_NAMESPACE@_FALLTHROUGH [[clang::fallthrough]] +#endif +#endif +#ifndef @KWSYS_NAMESPACE@_FALLTHROUGH +#define @KWSYS_NAMESPACE@_FALLTHROUGH static_cast<void>(0) +#endif + +#undef @KWSYS_NAMESPACE@__has_cpp_attribute + /* If building a C++ file in kwsys itself, give the source file access to the macros without a configured namespace. */ #if defined(KWSYS_NAMESPACE) @@ -22,6 +47,7 @@ #define KWSYS_STL_HAS_WSTRING @KWSYS_NAMESPACE@_STL_HAS_WSTRING #define KWSYS_CXX_HAS_EXT_STDIO_FILEBUF_H \ @KWSYS_NAMESPACE@_CXX_HAS_EXT_STDIO_FILEBUF_H +#define KWSYS_FALLTHROUGH @KWSYS_NAMESPACE@_FALLTHROUGH #endif #endif diff --git a/Source/kwsys/testConfigure.cxx b/Source/kwsys/testConfigure.cxx new file mode 100644 index 0000000..916dcc1 --- /dev/null +++ b/Source/kwsys/testConfigure.cxx @@ -0,0 +1,30 @@ +/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying +file Copyright.txt or https://cmake.org/licensing#kwsys for details. */ +#include "kwsysPrivate.h" +#include KWSYS_HEADER(Configure.hxx) + +// Work-around CMake dependency scanning limitation. This must +// duplicate the above list of headers. +#if 0 +#include "Configure.hxx.in" +#endif + +static bool testFallthrough(int n) +{ + int r = 0; + switch (n) { + case 1: + ++r; + KWSYS_FALLTHROUGH; + default: + ++r; + } + return r == 2; +} + +int testConfigure(int, char* []) +{ + bool res = true; + res = testFallthrough(1) && res; + return res ? 0 : 1; +} diff --git a/Tests/Server/cmakelib.py b/Tests/Server/cmakelib.py index 39e3618..6e8761a 100644 --- a/Tests/Server/cmakelib.py +++ b/Tests/Server/cmakelib.py @@ -100,6 +100,14 @@ def waitForRawMessage(cmakeCommand): return jsonPayload stdoutdata = stdoutdata[(end+len(']== "CMake Server" ==]')):] +# Python2 has no problem writing the output of encodes directly, +# but Python3 returns only 'int's for encode and so must be turned +# into bytes. We use the existence of 'to_bytes' on an int to +# determine which behavior is appropriate. It might be more clear +# to do this in the code which uses the flag, but introducing +# this lookup cost at every byte sent isn't ideal. +has_to_bytes = "to_bytes" in dir(10) + def writeRawData(cmakeCommand, content): writeRawData.counter += 1 payload = """ @@ -116,7 +124,25 @@ def writeRawData(cmakeCommand, content): if print_communication: printClient(content, "(Use \\r\\n:", rn, ")") - cmakeCommand.write(payload.encode('utf-8')) + # To stress test how cmake deals with fragmentation in the + # communication channel, we send only one byte at a time. + # Certain communication methods / platforms might still buffer + # it all into one message since its so close together, but in + # general this will catch places where we assume full buffers + # come in all at once. + encoded_payload = payload.encode('utf-8') + + # Python version 3+ can't write ints directly; but 'to_bytes' + # for int was only added in python 3.2. If this is a 3+ version + # of python without that conversion function; just write the whole + # thing out at once. + if sys.version_info[0] > 2 and not has_to_bytes: + cmakeCommand.write(encoded_payload) + else: + for c in encoded_payload: + if has_to_bytes: + c = c.to_bytes(1, byteorder='big') + cmakeCommand.write(c) writeRawData.counter = 0 @@ -1069,6 +1069,7 @@ TMPFILE=`cmake_tmp_file` echo ' #include <iostream> #include <memory> +#include <unordered_map> #if __cplusplus < 201103L #error "Compiler is not in a mode aware of C++11." |