diff options
60 files changed, 1675 insertions, 1644 deletions
diff --git a/Source/kwsys/Base64.c b/Source/kwsys/Base64.c index 99f008e595..bf876f2d5e 100644 --- a/Source/kwsys/Base64.c +++ b/Source/kwsys/Base64.c @@ -6,7 +6,7 @@ /* Work-around CMake dependency scanning limitation. This must duplicate the above list of headers. */ #if 0 -#include "Base64.h.in" +# include "Base64.h.in" #endif static const unsigned char kwsysBase64EncodeTable[65] = diff --git a/Source/kwsys/Base64.h.in b/Source/kwsys/Base64.h.in index 35367574ae..729f972978 100644 --- a/Source/kwsys/Base64.h.in +++ b/Source/kwsys/Base64.h.in @@ -12,17 +12,17 @@ not visible to user code. Use kwsysHeaderDump.pl to reproduce these macros after making changes to the interface. */ #if !defined(KWSYS_NAMESPACE) -#define kwsys_ns(x) @KWSYS_NAMESPACE@##x -#define kwsysEXPORT @KWSYS_NAMESPACE@_EXPORT +# define kwsys_ns(x) @KWSYS_NAMESPACE@##x +# define kwsysEXPORT @KWSYS_NAMESPACE@_EXPORT #endif #if !@KWSYS_NAMESPACE@_NAME_IS_KWSYS -#define kwsysBase64 kwsys_ns(Base64) -#define kwsysBase64_Decode kwsys_ns(Base64_Decode) -#define kwsysBase64_Decode3 kwsys_ns(Base64_Decode3) -#define kwsysBase64_Encode kwsys_ns(Base64_Encode) -#define kwsysBase64_Encode1 kwsys_ns(Base64_Encode1) -#define kwsysBase64_Encode2 kwsys_ns(Base64_Encode2) -#define kwsysBase64_Encode3 kwsys_ns(Base64_Encode3) +# define kwsysBase64 kwsys_ns(Base64) +# define kwsysBase64_Decode kwsys_ns(Base64_Decode) +# define kwsysBase64_Decode3 kwsys_ns(Base64_Decode3) +# define kwsysBase64_Encode kwsys_ns(Base64_Encode) +# define kwsysBase64_Encode1 kwsys_ns(Base64_Encode1) +# define kwsysBase64_Encode2 kwsys_ns(Base64_Encode2) +# define kwsysBase64_Encode3 kwsys_ns(Base64_Encode3) #endif #if defined(__cplusplus) @@ -94,17 +94,17 @@ kwsysEXPORT size_t kwsysBase64_Decode(const unsigned char* input, /* If we are building a kwsys .c or .cxx file, let it use these macros. Otherwise, undefine them to keep the namespace clean. */ #if !defined(KWSYS_NAMESPACE) -#undef kwsys_ns -#undef kwsysEXPORT -#if !@KWSYS_NAMESPACE@_NAME_IS_KWSYS -#undef kwsysBase64 -#undef kwsysBase64_Decode -#undef kwsysBase64_Decode3 -#undef kwsysBase64_Encode -#undef kwsysBase64_Encode1 -#undef kwsysBase64_Encode2 -#undef kwsysBase64_Encode3 -#endif +# undef kwsys_ns +# undef kwsysEXPORT +# if !@KWSYS_NAMESPACE@_NAME_IS_KWSYS +# undef kwsysBase64 +# undef kwsysBase64_Decode +# undef kwsysBase64_Decode3 +# undef kwsysBase64_Encode +# undef kwsysBase64_Encode1 +# undef kwsysBase64_Encode2 +# undef kwsysBase64_Encode3 +# endif #endif #endif diff --git a/Source/kwsys/CONTRIBUTING.rst b/Source/kwsys/CONTRIBUTING.rst index 70a313e058..32e7b83c5b 100644 --- a/Source/kwsys/CONTRIBUTING.rst +++ b/Source/kwsys/CONTRIBUTING.rst @@ -27,7 +27,7 @@ copies of KWSys within dependent projects can be updated to get the changes. Code Style ========== -We use `clang-format`_ version **3.8** to define our style for C++ code in +We use `clang-format`_ version **6.0** to define our style for C++ code in the KWSys source tree. See the `.clang-format`_ configuration file for our style settings. Use the `clang-format.bash`_ script to format source code. It automatically runs ``clang-format`` on the set of source files diff --git a/Source/kwsys/CommandLineArguments.cxx b/Source/kwsys/CommandLineArguments.cxx index a6387eaba9..a97f7a8365 100644 --- a/Source/kwsys/CommandLineArguments.cxx +++ b/Source/kwsys/CommandLineArguments.cxx @@ -9,9 +9,9 @@ // Work-around CMake dependency scanning limitation. This must // duplicate the above list of headers. #if 0 -#include "CommandLineArguments.hxx.in" -#include "Configure.hxx.in" -#include "String.hxx.in" +# include "CommandLineArguments.hxx.in" +# include "Configure.hxx.in" +# include "String.hxx.in" #endif #include <iostream> @@ -25,18 +25,18 @@ #include <string.h> #ifdef _MSC_VER -#pragma warning(disable : 4786) +# pragma warning(disable : 4786) #endif #if defined(__sgi) && !defined(__GNUC__) -#pragma set woff 1375 /* base class destructor not virtual */ +# pragma set woff 1375 /* base class destructor not virtual */ #endif #if 0 -#define CommandLineArguments_DEBUG(x) \ - std::cout << __LINE__ << " CLA: " << x << std::endl +# define CommandLineArguments_DEBUG(x) \ + std::cout << __LINE__ << " CLA: " << x << std::endl #else -#define CommandLineArguments_DEBUG(x) +# define CommandLineArguments_DEBUG(x) #endif namespace KWSYS_NAMESPACE { diff --git a/Source/kwsys/Configure.h.in b/Source/kwsys/Configure.h.in index 224047a7b9..bec1abca43 100644 --- a/Source/kwsys/Configure.h.in +++ b/Source/kwsys/Configure.h.in @@ -7,22 +7,22 @@ namespace. When not building a kwsys source file these macros are temporarily defined inside the headers that use them. */ #if defined(KWSYS_NAMESPACE) -#define kwsys_ns(x) @KWSYS_NAMESPACE@##x -#define kwsysEXPORT @KWSYS_NAMESPACE@_EXPORT +# define kwsys_ns(x) @KWSYS_NAMESPACE@##x +# define kwsysEXPORT @KWSYS_NAMESPACE@_EXPORT #endif /* Disable some warnings inside kwsys source files. */ #if defined(KWSYS_NAMESPACE) -#if defined(__BORLANDC__) -#pragma warn - 8027 /* function not inlined. */ -#endif -#if defined(__INTEL_COMPILER) -#pragma warning(disable : 1572) /* floating-point equality test */ -#endif -#if defined(__sgi) && !defined(__GNUC__) -#pragma set woff 3970 /* pointer to int conversion */ -#pragma set woff 3968 /* 64 bit conversion */ -#endif +# if defined(__BORLANDC__) +# pragma warn - 8027 /* function not inlined. */ +# endif +# if defined(__INTEL_COMPILER) +# pragma warning(disable : 1572) /* floating-point equality test */ +# endif +# if defined(__sgi) && !defined(__GNUC__) +# pragma set woff 3970 /* pointer to int conversion */ +# pragma set woff 3968 /* 64 bit conversion */ +# endif #endif /* Whether kwsys namespace is "kwsys". */ @@ -33,81 +33,83 @@ /* Whether Large File Support is available. */ #if @KWSYS_NAMESPACE@_LFS_REQUESTED -#define @KWSYS_NAMESPACE@_LFS_AVAILABLE @KWSYS_LFS_AVAILABLE@ +# define @KWSYS_NAMESPACE@_LFS_AVAILABLE @KWSYS_LFS_AVAILABLE@ #endif /* Setup Large File Support if requested. */ #if @KWSYS_NAMESPACE@_LFS_REQUESTED /* Since LFS is requested this header must be included before system headers whether or not LFS is available. */ -#if 0 && (defined(_SYS_TYPES_H) || defined(_SYS_TYPES_INCLUDED)) -#error "@KWSYS_NAMESPACE@/Configure.h must be included before sys/types.h" -#endif +# if 0 && (defined(_SYS_TYPES_H) || defined(_SYS_TYPES_INCLUDED)) +# error "@KWSYS_NAMESPACE@/Configure.h must be included before sys/types.h" +# endif /* Enable the large file API if it is available. */ -#if @KWSYS_NAMESPACE@_LFS_AVAILABLE && \ - !defined(@KWSYS_NAMESPACE@_LFS_NO_DEFINES) -#if !defined(_LARGEFILE_SOURCE) && \ - !defined(@KWSYS_NAMESPACE@_LFS_NO_DEFINE_LARGEFILE_SOURCE) -#define _LARGEFILE_SOURCE -#endif -#if !defined(_LARGEFILE64_SOURCE) && \ - !defined(@KWSYS_NAMESPACE@_LFS_NO_DEFINE_LARGEFILE64_SOURCE) -#define _LARGEFILE64_SOURCE -#endif -#if !defined(_LARGE_FILES) && \ - !defined(@KWSYS_NAMESPACE@_LFS_NO_DEFINE_LARGE_FILES) -#define _LARGE_FILES -#endif -#if !defined(_FILE_OFFSET_BITS) && \ - !defined(@KWSYS_NAMESPACE@_LFS_NO_DEFINE_FILE_OFFSET_BITS) -#define _FILE_OFFSET_BITS 64 -#endif -#endif +# if @KWSYS_NAMESPACE@_LFS_AVAILABLE && \ + !defined(@KWSYS_NAMESPACE@_LFS_NO_DEFINES) +# if !defined(_LARGEFILE_SOURCE) && \ + !defined(@KWSYS_NAMESPACE@_LFS_NO_DEFINE_LARGEFILE_SOURCE) +# define _LARGEFILE_SOURCE +# endif +# if !defined(_LARGEFILE64_SOURCE) && \ + !defined(@KWSYS_NAMESPACE@_LFS_NO_DEFINE_LARGEFILE64_SOURCE) +# define _LARGEFILE64_SOURCE +# endif +# if !defined(_LARGE_FILES) && \ + !defined(@KWSYS_NAMESPACE@_LFS_NO_DEFINE_LARGE_FILES) +# define _LARGE_FILES +# endif +# if !defined(_FILE_OFFSET_BITS) && \ + !defined(@KWSYS_NAMESPACE@_LFS_NO_DEFINE_FILE_OFFSET_BITS) +# define _FILE_OFFSET_BITS 64 +# endif +# endif #endif /* Setup the export macro. */ #if @KWSYS_BUILD_SHARED@ -#if defined(_WIN32) || defined(__CYGWIN__) -#if defined(@KWSYS_NAMESPACE@_EXPORTS) -#define @KWSYS_NAMESPACE@_EXPORT __declspec(dllexport) +# if defined(_WIN32) || defined(__CYGWIN__) +# if defined(@KWSYS_NAMESPACE@_EXPORTS) +# define @KWSYS_NAMESPACE@_EXPORT __declspec(dllexport) +# else +# define @KWSYS_NAMESPACE@_EXPORT __declspec(dllimport) +# endif +# elif __GNUC__ >= 4 +# define @KWSYS_NAMESPACE@_EXPORT __attribute__((visibility("default"))) +# else +# define @KWSYS_NAMESPACE@_EXPORT +# endif #else -#define @KWSYS_NAMESPACE@_EXPORT __declspec(dllimport) -#endif -#elif __GNUC__ >= 4 -#define @KWSYS_NAMESPACE@_EXPORT __attribute__((visibility("default"))) -#else -#define @KWSYS_NAMESPACE@_EXPORT -#endif -#else -#define @KWSYS_NAMESPACE@_EXPORT +# define @KWSYS_NAMESPACE@_EXPORT #endif /* Enable warnings that are off by default but are useful. */ #if !defined(@KWSYS_NAMESPACE@_NO_WARNING_ENABLE) -#if defined(_MSC_VER) -#pragma warning(default : 4263) /* no override, call convention differs */ -#endif +# if defined(_MSC_VER) +# pragma warning(default : 4263) /* no override, call convention differs \ + */ +# endif #endif /* Disable warnings that are on by default but occur in valid code. */ #if !defined(@KWSYS_NAMESPACE@_NO_WARNING_DISABLE) -#if defined(_MSC_VER) -#pragma warning(disable : 4097) /* typedef is synonym for class */ -#pragma warning(disable : 4127) /* conditional expression is constant */ -#pragma warning(disable : 4244) /* possible loss in conversion */ -#pragma warning(disable : 4251) /* missing DLL-interface */ -#pragma warning(disable : 4305) /* truncation from type1 to type2 */ -#pragma warning(disable : 4309) /* truncation of constant value */ -#pragma warning(disable : 4514) /* unreferenced inline function */ -#pragma warning(disable : 4706) /* assignment in conditional expression */ -#pragma warning(disable : 4710) /* function not inlined */ -#pragma warning(disable : 4786) /* identifier truncated in debug info */ -#endif -#if defined(__BORLANDC__) && !defined(__cplusplus) +# if defined(_MSC_VER) +# pragma warning(disable : 4097) /* typedef is synonym for class */ +# pragma warning(disable : 4127) /* conditional expression is constant */ +# pragma warning(disable : 4244) /* possible loss in conversion */ +# pragma warning(disable : 4251) /* missing DLL-interface */ +# pragma warning(disable : 4305) /* truncation from type1 to type2 */ +# pragma warning(disable : 4309) /* truncation of constant value */ +# pragma warning(disable : 4514) /* unreferenced inline function */ +# pragma warning(disable : 4706) /* assignment in conditional expression \ + */ +# pragma warning(disable : 4710) /* function not inlined */ +# pragma warning(disable : 4786) /* identifier truncated in debug info */ +# endif +# if defined(__BORLANDC__) && !defined(__cplusplus) /* Code has no effect; raised by winnt.h in C (not C++) when ignoring an unused parameter using "(param)" syntax (i.e. no cast to void). */ -#pragma warn - 8019 -#endif +# pragma warn - 8019 +# endif #endif /* MSVC 6.0 in release mode will warn about code it produces with its @@ -115,10 +117,10 @@ configuration. Real warnings will be revealed by a debug build or by other compilers. */ #if !defined(@KWSYS_NAMESPACE@_NO_WARNING_DISABLE_BOGUS) -#if defined(_MSC_VER) && (_MSC_VER < 1300) && defined(NDEBUG) -#pragma warning(disable : 4701) /* Variable may be used uninitialized. */ -#pragma warning(disable : 4702) /* Unreachable code. */ -#endif +# if defined(_MSC_VER) && (_MSC_VER < 1300) && defined(NDEBUG) +# pragma warning(disable : 4701) /* Variable may be used uninitialized. */ +# pragma warning(disable : 4702) /* Unreachable code. */ +# endif #endif #endif diff --git a/Source/kwsys/Configure.hxx.in b/Source/kwsys/Configure.hxx.in index 05afc7d12d..d1e7464ff5 100644 --- a/Source/kwsys/Configure.hxx.in +++ b/Source/kwsys/Configure.hxx.in @@ -13,32 +13,33 @@ @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) +# 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) +# define @KWSYS_NAMESPACE@__has_cpp_attribute(x) __has_cpp_attribute(x) #else -#define @KWSYS_NAMESPACE@__has_cpp_attribute(x) 0 +# define @KWSYS_NAMESPACE@__has_cpp_attribute(x) 0 #endif #if __cplusplus >= 201103L -#define @KWSYS_NAMESPACE@_NULLPTR nullptr +# define @KWSYS_NAMESPACE@_NULLPTR nullptr #else -#define @KWSYS_NAMESPACE@_NULLPTR 0 +# define @KWSYS_NAMESPACE@_NULLPTR 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 +# 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) +# define @KWSYS_NAMESPACE@_FALLTHROUGH static_cast<void>(0) #endif #undef @KWSYS_NAMESPACE@__has_cpp_attribute @@ -46,15 +47,15 @@ /* If building a C++ file in kwsys itself, give the source file access to the macros without a configured namespace. */ #if defined(KWSYS_NAMESPACE) -#if !@KWSYS_NAMESPACE@_NAME_IS_KWSYS -#define kwsys @KWSYS_NAMESPACE@ -#endif -#define KWSYS_NAME_IS_KWSYS @KWSYS_NAMESPACE@_NAME_IS_KWSYS -#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 -#define KWSYS_NULLPTR @KWSYS_NAMESPACE@_NULLPTR +# if !@KWSYS_NAMESPACE@_NAME_IS_KWSYS +# define kwsys @KWSYS_NAMESPACE@ +# endif +# define KWSYS_NAME_IS_KWSYS @KWSYS_NAMESPACE@_NAME_IS_KWSYS +# 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 +# define KWSYS_NULLPTR @KWSYS_NAMESPACE@_NULLPTR #endif #endif diff --git a/Source/kwsys/ConsoleBuf.hxx.in b/Source/kwsys/ConsoleBuf.hxx.in index cf68146c4b..73a1efb258 100644 --- a/Source/kwsys/ConsoleBuf.hxx.in +++ b/Source/kwsys/ConsoleBuf.hxx.in @@ -15,10 +15,10 @@ #include <string> #if defined(_WIN32) -#include <windows.h> -#if __cplusplus >= 201103L -#include <system_error> -#endif +# include <windows.h> +# if __cplusplus >= 201103L +# include <system_error> +# endif #endif namespace @KWSYS_NAMESPACE@ { @@ -231,12 +231,12 @@ private: (!input && m_hOutput == INVALID_HANDLE_VALUE)) { std::string errmsg = "GetStdHandle(" + handleName + ") returned INVALID_HANDLE_VALUE"; -#if __cplusplus >= 201103L +# if __cplusplus >= 201103L throw std::system_error(::GetLastError(), std::system_category(), errmsg); -#else +# else throw std::runtime_error(errmsg); -#endif +# endif } } UINT getConsolesCodepage() diff --git a/Source/kwsys/Directory.cxx b/Source/kwsys/Directory.cxx index a84be11861..31b1c15d08 100644 --- a/Source/kwsys/Directory.cxx +++ b/Source/kwsys/Directory.cxx @@ -10,9 +10,9 @@ // Work-around CMake dependency scanning limitation. This must // duplicate the above list of headers. #if 0 -#include "Configure.hxx.in" -#include "Directory.hxx.in" -#include "Encoding.hxx.in" +# include "Configure.hxx.in" +# include "Directory.hxx.in" +# include "Encoding.hxx.in" #endif #include <string> @@ -69,37 +69,37 @@ void Directory::Clear() // First Windows platforms #if defined(_WIN32) && !defined(__CYGWIN__) -#include <windows.h> +# include <windows.h> -#include <ctype.h> -#include <fcntl.h> -#include <io.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <sys/stat.h> -#include <sys/types.h> +# include <ctype.h> +# include <fcntl.h> +# include <io.h> +# include <stdio.h> +# include <stdlib.h> +# include <string.h> +# include <sys/stat.h> +# include <sys/types.h> // Wide function names can vary depending on compiler: -#ifdef __BORLANDC__ -#define _wfindfirst_func __wfindfirst -#define _wfindnext_func __wfindnext -#else -#define _wfindfirst_func _wfindfirst -#define _wfindnext_func _wfindnext -#endif +# ifdef __BORLANDC__ +# define _wfindfirst_func __wfindfirst +# define _wfindnext_func __wfindnext +# else +# define _wfindfirst_func _wfindfirst +# define _wfindnext_func _wfindnext +# endif namespace KWSYS_NAMESPACE { bool Directory::Load(const std::string& name) { this->Clear(); -#if (defined(_MSC_VER) && _MSC_VER < 1300) || defined(__BORLANDC__) +# if (defined(_MSC_VER) && _MSC_VER < 1300) || defined(__BORLANDC__) // Older Visual C++ and Embarcadero compilers. long srchHandle; -#else // Newer Visual C++ +# else // Newer Visual C++ intptr_t srchHandle; -#endif +# endif char* buf; size_t n = name.size(); if (*name.rbegin() == '/' || *name.rbegin() == '\\') { @@ -136,12 +136,12 @@ bool Directory::Load(const std::string& name) unsigned long Directory::GetNumberOfFilesInDirectory(const std::string& name) { -#if (defined(_MSC_VER) && _MSC_VER < 1300) || defined(__BORLANDC__) +# if (defined(_MSC_VER) && _MSC_VER < 1300) || defined(__BORLANDC__) // Older Visual C++ and Embarcadero compilers. long srchHandle; -#else // Newer Visual C++ +# else // Newer Visual C++ intptr_t srchHandle; -#endif +# endif char* buf; size_t n = name.size(); if (*name.rbegin() == '/') { @@ -177,23 +177,23 @@ unsigned long Directory::GetNumberOfFilesInDirectory(const std::string& name) // Now the POSIX style directory access -#include <sys/types.h> +# include <sys/types.h> -#include <dirent.h> +# include <dirent.h> // PGI with glibc has trouble with dirent and large file support: // http://www.pgroup.com/userforum/viewtopic.php? // p=1992&sid=f16167f51964f1a68fe5041b8eb213b6 // Work around the problem by mapping dirent the same way as readdir. -#if defined(__PGI) && defined(__GLIBC__) -#define kwsys_dirent_readdir dirent -#define kwsys_dirent_readdir64 dirent64 -#define kwsys_dirent kwsys_dirent_lookup(readdir) -#define kwsys_dirent_lookup(x) kwsys_dirent_lookup_delay(x) -#define kwsys_dirent_lookup_delay(x) kwsys_dirent_##x -#else -#define kwsys_dirent dirent -#endif +# if defined(__PGI) && defined(__GLIBC__) +# define kwsys_dirent_readdir dirent +# define kwsys_dirent_readdir64 dirent64 +# define kwsys_dirent kwsys_dirent_lookup(readdir) +# define kwsys_dirent_lookup(x) kwsys_dirent_lookup_delay(x) +# define kwsys_dirent_lookup_delay(x) kwsys_dirent_##x +# else +# define kwsys_dirent dirent +# endif namespace KWSYS_NAMESPACE { diff --git a/Source/kwsys/DynamicLoader.cxx b/Source/kwsys/DynamicLoader.cxx index 9b7d9bfc76..a85690f7cb 100644 --- a/Source/kwsys/DynamicLoader.cxx +++ b/Source/kwsys/DynamicLoader.cxx @@ -8,8 +8,8 @@ // Work-around CMake dependency scanning limitation. This must // duplicate the above list of headers. #if 0 -#include "Configure.hxx.in" -#include "DynamicLoader.hxx.in" +# include "Configure.hxx.in" +# include "DynamicLoader.hxx.in" #endif // This file actually contains several different implementations: @@ -27,7 +27,7 @@ #if !KWSYS_SUPPORTS_SHARED_LIBS // Implementation for environments without dynamic libs -#include <string.h> // for strerror() +# include <string.h> // for strerror() namespace KWSYS_NAMESPACE { @@ -61,8 +61,8 @@ const char* DynamicLoader::LastError() #elif defined(__hpux) // Implementation for HPUX machines -#include <dl.h> -#include <errno.h> +# include <dl.h> +# include <errno.h> namespace KWSYS_NAMESPACE { @@ -124,8 +124,8 @@ const char* DynamicLoader::LastError() #elif defined(__APPLE__) && (MAC_OS_X_VERSION_MAX_ALLOWED < 1030) // Implementation for Mac OS X 10.2.x and earlier -#include <mach-o/dyld.h> -#include <string.h> // for strlen +# include <mach-o/dyld.h> +# include <string.h> // for strlen namespace KWSYS_NAMESPACE { @@ -140,9 +140,9 @@ DynamicLoader::LibraryHandle DynamicLoader::OpenLibrary( if (rc != NSObjectFileImageSuccess) { return 0; } - NSModule handle = - NSLinkModule(image, libname.c_str(), NSLINKMODULE_OPTION_BINDNOW | - NSLINKMODULE_OPTION_RETURN_ON_ERROR); + NSModule handle = NSLinkModule(image, libname.c_str(), + NSLINKMODULE_OPTION_BINDNOW | + NSLINKMODULE_OPTION_RETURN_ON_ERROR); NSDestroyObjectFileImage(image); return handle; } @@ -183,7 +183,7 @@ const char* DynamicLoader::LastError() #elif defined(_WIN32) && !defined(__CYGWIN__) // Implementation for Windows win32 code but not cygwin -#include <windows.h> +# include <windows.h> namespace KWSYS_NAMESPACE { @@ -231,20 +231,20 @@ DynamicLoader::SymbolPointer DynamicLoader::GetSymbolAddress( // Note that the "@X" part of the name above is the total size (in // bytes) of the arguments on the stack. void* result; -#if defined(__BORLANDC__) || defined(__WATCOMC__) +# if defined(__BORLANDC__) || defined(__WATCOMC__) // Need to prepend symbols with '_' std::string ssym = '_' + sym; const char* rsym = ssym.c_str(); -#else +# else const char* rsym = sym.c_str(); -#endif +# endif result = (void*)GetProcAddress(lib, rsym); // Hack to cast pointer-to-data to pointer-to-function. -#ifdef __WATCOMC__ +# ifdef __WATCOMC__ return *(DynamicLoader::SymbolPointer*)(&result); -#else +# else return *reinterpret_cast<DynamicLoader::SymbolPointer*>(&result); -#endif +# endif } const char* DynamicLoader::LastError() @@ -272,10 +272,10 @@ const char* DynamicLoader::LastError() #elif defined(__BEOS__) // Implementation for BeOS / Haiku -#include <string.h> // for strerror() +# include <string.h> // for strerror() -#include <be/kernel/image.h> -#include <be/support/Errors.h> +# include <be/kernel/image.h> +# include <be/support/Errors.h> namespace KWSYS_NAMESPACE { @@ -351,11 +351,11 @@ const char* DynamicLoader::LastError() #elif defined(__MINT__) // Implementation for FreeMiNT on Atari -#define _GNU_SOURCE /* for program_invocation_name */ -#include <dld.h> -#include <errno.h> -#include <malloc.h> -#include <string.h> +# define _GNU_SOURCE /* for program_invocation_name */ +# include <dld.h> +# include <errno.h> +# include <malloc.h> +# include <string.h> namespace KWSYS_NAMESPACE { @@ -399,7 +399,7 @@ const char* DynamicLoader::LastError() #else // Default implementation for *NIX systems (including Mac OS X 10.3 and // later) which use dlopen -#include <dlfcn.h> +# include <dlfcn.h> namespace KWSYS_NAMESPACE { diff --git a/Source/kwsys/DynamicLoader.hxx.in b/Source/kwsys/DynamicLoader.hxx.in index dc3469266a..08f2790af2 100644 --- a/Source/kwsys/DynamicLoader.hxx.in +++ b/Source/kwsys/DynamicLoader.hxx.in @@ -8,16 +8,16 @@ #include <string> #if defined(__hpux) -#include <dl.h> +# include <dl.h> #elif defined(_WIN32) && !defined(__CYGWIN__) -#include <windows.h> +# include <windows.h> #elif defined(__APPLE__) -#include <AvailabilityMacros.h> -#if MAC_OS_X_VERSION_MAX_ALLOWED < 1030 -#include <mach-o/dyld.h> -#endif +# include <AvailabilityMacros.h> +# if MAC_OS_X_VERSION_MAX_ALLOWED < 1030 +# include <mach-o/dyld.h> +# endif #elif defined(__BEOS__) -#include <be/kernel/image.h> +# include <be/kernel/image.h> #endif namespace @KWSYS_NAMESPACE@ { @@ -52,11 +52,11 @@ public: #elif defined(_WIN32) && !defined(__CYGWIN__) typedef HMODULE LibraryHandle; #elif defined(__APPLE__) -#if MAC_OS_X_VERSION_MAX_ALLOWED < 1030 +# if MAC_OS_X_VERSION_MAX_ALLOWED < 1030 typedef NSModule LibraryHandle; -#else +# else typedef void* LibraryHandle; -#endif +# endif #elif defined(__BEOS__) typedef image_id LibraryHandle; #else // POSIX diff --git a/Source/kwsys/Encoding.h.in b/Source/kwsys/Encoding.h.in index 7b6ed10f8b..86a26692ab 100644 --- a/Source/kwsys/Encoding.h.in +++ b/Source/kwsys/Encoding.h.in @@ -12,15 +12,15 @@ not visible to user code. Use kwsysHeaderDump.pl to reproduce these macros after making changes to the interface. */ #if !defined(KWSYS_NAMESPACE) -#define kwsys_ns(x) @KWSYS_NAMESPACE@##x -#define kwsysEXPORT @KWSYS_NAMESPACE@_EXPORT +# define kwsys_ns(x) @KWSYS_NAMESPACE@##x +# define kwsysEXPORT @KWSYS_NAMESPACE@_EXPORT #endif #if !@KWSYS_NAMESPACE@_NAME_IS_KWSYS -#define kwsysEncoding kwsys_ns(Encoding) -#define kwsysEncoding_mbstowcs kwsys_ns(Encoding_mbstowcs) -#define kwsysEncoding_DupToWide kwsys_ns(Encoding_DupToWide) -#define kwsysEncoding_wcstombs kwsys_ns(Encoding_wcstombs) -#define kwsysEncoding_DupToNarrow kwsys_ns(Encoding_DupToNarrow) +# define kwsysEncoding kwsys_ns(Encoding) +# define kwsysEncoding_mbstowcs kwsys_ns(Encoding_mbstowcs) +# define kwsysEncoding_DupToWide kwsys_ns(Encoding_DupToWide) +# define kwsysEncoding_wcstombs kwsys_ns(Encoding_wcstombs) +# define kwsysEncoding_DupToNarrow kwsys_ns(Encoding_DupToNarrow) #endif #if defined(__cplusplus) @@ -55,15 +55,15 @@ kwsysEXPORT char* kwsysEncoding_DupToNarrow(const wchar_t* str); /* If we are building a kwsys .c or .cxx file, let it use these macros. Otherwise, undefine them to keep the namespace clean. */ #if !defined(KWSYS_NAMESPACE) -#undef kwsys_ns -#undef kwsysEXPORT -#if !defined(KWSYS_NAMESPACE) && !@KWSYS_NAMESPACE@_NAME_IS_KWSYS -#undef kwsysEncoding -#undef kwsysEncoding_mbstowcs -#undef kwsysEncoding_DupToWide -#undef kwsysEncoding_wcstombs -#undef kwsysEncoding_DupToNarrow -#endif +# undef kwsys_ns +# undef kwsysEXPORT +# if !defined(KWSYS_NAMESPACE) && !@KWSYS_NAMESPACE@_NAME_IS_KWSYS +# undef kwsysEncoding +# undef kwsysEncoding_mbstowcs +# undef kwsysEncoding_DupToWide +# undef kwsysEncoding_wcstombs +# undef kwsysEncoding_DupToNarrow +# endif #endif #endif diff --git a/Source/kwsys/Encoding.hxx.in b/Source/kwsys/Encoding.hxx.in index 09691fd3f4..b06752115c 100644 --- a/Source/kwsys/Encoding.hxx.in +++ b/Source/kwsys/Encoding.hxx.in @@ -41,9 +41,9 @@ public: std::vector<char*> argv_; }; -/** - * Convert between char and wchar_t - */ + /** + * Convert between char and wchar_t + */ #if @KWSYS_NAMESPACE@_STL_HAS_WSTRING @@ -59,7 +59,7 @@ public: static std::string ToNarrow(const std::wstring& str); static std::string ToNarrow(const wchar_t* str); -#if defined(_WIN32) +# if defined(_WIN32) /** * Convert the path to an extended length path to avoid MAX_PATH length * limitations on Windows. If the input is a local path the result will be @@ -68,7 +68,7 @@ public: * absolute paths with Windows-style backslashes. **/ static std::wstring ToWindowsExtendedPath(std::string const&); -#endif +# endif #endif // @KWSYS_NAMESPACE@_STL_HAS_WSTRING diff --git a/Source/kwsys/EncodingC.c b/Source/kwsys/EncodingC.c index c1315b2d53..e12236afe5 100644 --- a/Source/kwsys/EncodingC.c +++ b/Source/kwsys/EncodingC.c @@ -6,13 +6,13 @@ /* Work-around CMake dependency scanning limitation. This must duplicate the above list of headers. */ #if 0 -#include "Encoding.h.in" +# include "Encoding.h.in" #endif #include <stdlib.h> #ifdef _WIN32 -#include <windows.h> +# include <windows.h> #endif size_t kwsysEncoding_mbstowcs(wchar_t* dest, const char* str, size_t n) diff --git a/Source/kwsys/EncodingCXX.cxx b/Source/kwsys/EncodingCXX.cxx index a1fe040d25..251deef3d5 100644 --- a/Source/kwsys/EncodingCXX.cxx +++ b/Source/kwsys/EncodingCXX.cxx @@ -1,9 +1,9 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing#kwsys for details. */ #ifdef __osf__ -#define _OSF_SOURCE -#define _POSIX_C_SOURCE 199506L -#define _XOPEN_SOURCE_EXTENDED +# define _OSF_SOURCE +# define _POSIX_C_SOURCE 199506L +# define _XOPEN_SOURCE_EXTENDED #endif #include "kwsysPrivate.h" @@ -13,8 +13,8 @@ // Work-around CMake dependency scanning limitation. This must // duplicate the above list of headers. #if 0 -#include "Encoding.h.in" -#include "Encoding.hxx.in" +# include "Encoding.h.in" +# include "Encoding.hxx.in" #endif #include <stdlib.h> @@ -22,15 +22,15 @@ #include <vector> #ifdef _MSC_VER -#pragma warning(disable : 4786) +# pragma warning(disable : 4786) #endif // Windows API. #if defined(_WIN32) -#include <windows.h> +# include <windows.h> -#include <ctype.h> -#include <shellapi.h> +# include <ctype.h> +# include <shellapi.h> #endif namespace KWSYS_NAMESPACE { @@ -127,7 +127,7 @@ char const* const* Encoding::CommandLineArguments::argv() const std::wstring Encoding::ToWide(const std::string& str) { std::wstring wstr; -#if defined(_WIN32) +# if defined(_WIN32) const int wlength = MultiByteToWideChar( KWSYS_ENCODING_DEFAULT_CODEPAGE, 0, str.data(), int(str.size()), NULL, 0); if (wlength > 0) { @@ -139,7 +139,7 @@ std::wstring Encoding::ToWide(const std::string& str) } delete[] wdata; } -#else +# else size_t pos = 0; size_t nullPos = 0; do { @@ -152,14 +152,14 @@ std::wstring Encoding::ToWide(const std::string& str) wstr += wchar_t('\0'); } } while (nullPos != std::string::npos); -#endif +# endif return wstr; } std::string Encoding::ToNarrow(const std::wstring& str) { std::string nstr; -#if defined(_WIN32) +# if defined(_WIN32) int length = WideCharToMultiByte(KWSYS_ENCODING_DEFAULT_CODEPAGE, 0, str.c_str(), int(str.size()), NULL, 0, NULL, NULL); @@ -173,7 +173,7 @@ std::string Encoding::ToNarrow(const std::wstring& str) } delete[] data; } -#else +# else size_t pos = 0; size_t nullPos = 0; do { @@ -186,7 +186,7 @@ std::string Encoding::ToNarrow(const std::wstring& str) nstr += '\0'; } } while (nullPos != std::string::npos); -#endif +# endif return nstr; } @@ -216,7 +216,7 @@ std::string Encoding::ToNarrow(const wchar_t* wcstr) return str; } -#if defined(_WIN32) +# if defined(_WIN32) // Convert local paths to UNC style paths std::wstring Encoding::ToWindowsExtendedPath(std::string const& source) { @@ -270,7 +270,7 @@ std::wstring Encoding::ToWindowsExtendedPath(std::string const& source) // unchanged return Encoding::ToWide(source); } -#endif +# endif #endif // KWSYS_STL_HAS_WSTRING diff --git a/Source/kwsys/FStream.cxx b/Source/kwsys/FStream.cxx index 3c44a6fa01..5e4133ac56 100644 --- a/Source/kwsys/FStream.cxx +++ b/Source/kwsys/FStream.cxx @@ -6,7 +6,7 @@ // Work-around CMake dependency scanning limitation. This must // duplicate the above list of headers. #if 0 -#include "FStream.hxx.in" +# include "FStream.hxx.in" #endif namespace KWSYS_NAMESPACE { diff --git a/Source/kwsys/FStream.hxx.in b/Source/kwsys/FStream.hxx.in index a4c65fe30c..d79bbdf16b 100644 --- a/Source/kwsys/FStream.hxx.in +++ b/Source/kwsys/FStream.hxx.in @@ -9,26 +9,26 @@ #include <fstream> #if defined(_WIN32) -#if !defined(_MSC_VER) && @KWSYS_NAMESPACE@_CXX_HAS_EXT_STDIO_FILEBUF_H -#include <ext/stdio_filebuf.h> -#endif +# if !defined(_MSC_VER) && @KWSYS_NAMESPACE@_CXX_HAS_EXT_STDIO_FILEBUF_H +# include <ext/stdio_filebuf.h> +# endif #endif namespace @KWSYS_NAMESPACE@ { #if defined(_WIN32) && \ (defined(_MSC_VER) || @KWSYS_NAMESPACE@_CXX_HAS_EXT_STDIO_FILEBUF_H) -#if defined(_NOEXCEPT) -#define @KWSYS_NAMESPACE@_FStream_NOEXCEPT _NOEXCEPT -#else -#define @KWSYS_NAMESPACE@_FStream_NOEXCEPT -#endif +# if defined(_NOEXCEPT) +# define @KWSYS_NAMESPACE@_FStream_NOEXCEPT _NOEXCEPT +# else +# define @KWSYS_NAMESPACE@_FStream_NOEXCEPT +# endif -#if defined(_MSC_VER) +# if defined(_MSC_VER) template <typename CharType, typename Traits> class basic_filebuf : public std::basic_filebuf<CharType, Traits> { -#if _MSC_VER >= 1400 +# if _MSC_VER >= 1400 public: typedef std::basic_filebuf<CharType, Traits> my_base_type; basic_filebuf* open(char const* s, std::ios_base::openmode mode) @@ -36,10 +36,10 @@ public: const std::wstring wstr = Encoding::ToWindowsExtendedPath(s); return static_cast<basic_filebuf*>(my_base_type::open(wstr.c_str(), mode)); } -#endif +# endif }; -#else +# else inline std::wstring getcmode(const std::ios_base::openmode mode) { @@ -67,17 +67,17 @@ inline std::wstring getcmode(const std::ios_base::openmode mode) return cmode; }; -#endif +# endif template <typename CharType, typename Traits = std::char_traits<CharType> > class basic_efilebuf { public: -#if defined(_MSC_VER) +# if defined(_MSC_VER) typedef basic_filebuf<CharType, Traits> internal_buffer_type; -#else +# else typedef __gnu_cxx::stdio_filebuf<CharType, Traits> internal_buffer_type; -#endif +# endif basic_efilebuf() : file_(0) @@ -90,9 +90,9 @@ public: if (is_open() || file_) { return false; } -#if defined(_MSC_VER) +# if defined(_MSC_VER) const bool success = buf_->open(file_name, mode) != 0; -#else +# else const std::wstring wstr = Encoding::ToWindowsExtendedPath(file_name); bool success = false; std::wstring cmode = getcmode(mode); @@ -104,7 +104,7 @@ public: buf_ = new internal_buffer_type(file_, mode); success = true; } -#endif +# endif return success; } @@ -129,12 +129,12 @@ public: bool success = false; if (buf_) { success = buf_->close() != 0; -#if !defined(_MSC_VER) +# if !defined(_MSC_VER) if (file_) { success = fclose(file_) == 0 ? success : false; file_ = 0; } -#endif +# endif } return success; } @@ -142,11 +142,11 @@ public: static void _set_state(bool success, std::basic_ios<CharType, Traits>* ios, basic_efilebuf* efilebuf) { -#if !defined(_MSC_VER) +# if !defined(_MSC_VER) ios->rdbuf(efilebuf->buf_); -#else +# else static_cast<void>(efilebuf); -#endif +# endif if (!success) { ios->setstate(std::ios_base::failbit); } else { @@ -167,8 +167,9 @@ protected: }; template <typename CharType, typename Traits = std::char_traits<CharType> > -class basic_ifstream : public std::basic_istream<CharType, Traits>, - public basic_efilebuf<CharType, Traits> +class basic_ifstream + : public std::basic_istream<CharType, Traits> + , public basic_efilebuf<CharType, Traits> { public: typedef typename basic_efilebuf<CharType, Traits>::internal_buffer_type @@ -207,8 +208,9 @@ public: }; template <typename CharType, typename Traits = std::char_traits<CharType> > -class basic_ofstream : public std::basic_ostream<CharType, Traits>, - public basic_efilebuf<CharType, Traits> +class basic_ofstream + : public std::basic_ostream<CharType, Traits> + , public basic_efilebuf<CharType, Traits> { using basic_efilebuf<CharType, Traits>::is_open; @@ -248,7 +250,7 @@ public: typedef basic_ifstream<char> ifstream; typedef basic_ofstream<char> ofstream; -#undef @KWSYS_NAMESPACE@_FStream_NOEXCEPT +# undef @KWSYS_NAMESPACE@_FStream_NOEXCEPT #else using std::ofstream; using std::ifstream; diff --git a/Source/kwsys/Glob.cxx b/Source/kwsys/Glob.cxx index 2b6db78cf8..6952d24ae6 100644 --- a/Source/kwsys/Glob.cxx +++ b/Source/kwsys/Glob.cxx @@ -12,11 +12,11 @@ // Work-around CMake dependency scanning limitation. This must // duplicate the above list of headers. #if 0 -#include "Configure.hxx.in" -#include "Directory.hxx.in" -#include "Glob.hxx.in" -#include "RegularExpression.hxx.in" -#include "SystemTools.hxx.in" +# include "Configure.hxx.in" +# include "Directory.hxx.in" +# include "Glob.hxx.in" +# include "RegularExpression.hxx.in" +# include "SystemTools.hxx.in" #endif #include <algorithm> @@ -29,12 +29,12 @@ namespace KWSYS_NAMESPACE { #if defined(_WIN32) || defined(__APPLE__) || defined(__CYGWIN__) // On Windows and Apple, no difference between lower and upper case -#define KWSYS_GLOB_CASE_INDEPENDENT +# define KWSYS_GLOB_CASE_INDEPENDENT #endif #if defined(_WIN32) || defined(__CYGWIN__) // Handle network paths -#define KWSYS_GLOB_SUPPORT_NETWORK_PATHS +# define KWSYS_GLOB_SUPPORT_NETWORK_PATHS #endif class GlobInternals @@ -217,9 +217,10 @@ bool Glob::RecurseDirectory(std::string::size_type start, if (!realPathErrorMessage.empty()) { if (messages) { - messages->push_back(Message( - Glob::error, "Canonical path generation from path '" + dir + - "' failed! Reason: '" + realPathErrorMessage + "'")); + messages->push_back( + Message(Glob::error, + "Canonical path generation from path '" + dir + + "' failed! Reason: '" + realPathErrorMessage + "'")); } return false; } diff --git a/Source/kwsys/IOStream.cxx b/Source/kwsys/IOStream.cxx index 01ada1f2fc..e21f87d453 100644 --- a/Source/kwsys/IOStream.cxx +++ b/Source/kwsys/IOStream.cxx @@ -10,21 +10,21 @@ // Work-around CMake dependency scanning limitation. This must // duplicate the above list of headers. #if 0 -#include "Configure.hxx.in" -#include "IOStream.hxx.in" +# include "Configure.hxx.in" +# include "IOStream.hxx.in" #endif // Implement the rest of this file only if it is needed. #if KWSYS_IOS_NEED_OPERATORS_LL -#include <stdio.h> // sscanf, sprintf -#include <string.h> // memchr +# include <stdio.h> // sscanf, sprintf +# include <string.h> // memchr -#if defined(_MAX_INT_DIG) -#define KWSYS_IOS_INT64_MAX_DIG _MAX_INT_DIG -#else -#define KWSYS_IOS_INT64_MAX_DIG 32 -#endif +# if defined(_MAX_INT_DIG) +# define KWSYS_IOS_INT64_MAX_DIG _MAX_INT_DIG +# else +# define KWSYS_IOS_INT64_MAX_DIG 32 +# endif namespace KWSYS_NAMESPACE { @@ -118,13 +118,13 @@ std::istream& IOStreamScanTemplate(std::istream& is, T& value, char type) try { // Copy the string to a buffer and construct the format string. char buffer[KWSYS_IOS_INT64_MAX_DIG]; -#if defined(_MSC_VER) +# if defined(_MSC_VER) char format[] = "%I64_"; const int typeIndex = 4; -#else +# else char format[] = "%ll_"; const int typeIndex = 3; -#endif +# endif switch (IOStreamScanStream(is, buffer)) { case 8: format[typeIndex] = 'o'; @@ -177,14 +177,14 @@ std::ostream& IOStreamPrintTemplate(std::ostream& os, T value, char type) if (os.flags() & std::ios_base::showbase) { *f++ = '#'; } -#if defined(_MSC_VER) +# if defined(_MSC_VER) *f++ = 'I'; *f++ = '6'; *f++ = '4'; -#else +# else *f++ = 'l'; *f++ = 'l'; -#endif +# endif long bflags = os.flags() & std::ios_base::basefield; if (bflags == std::ios_base::oct) { *f++ = 'o'; @@ -209,7 +209,7 @@ std::ostream& IOStreamPrintTemplate(std::ostream& os, T value, char type) return os; } -#if !KWSYS_IOS_HAS_ISTREAM_LONG_LONG +# if !KWSYS_IOS_HAS_ISTREAM_LONG_LONG // Implement input stream operator for IOStreamSLL. std::istream& IOStreamScan(std::istream& is, IOStreamSLL& value) { @@ -221,9 +221,9 @@ std::istream& IOStreamScan(std::istream& is, IOStreamULL& value) { return IOStreamScanTemplate(is, value, 'u'); } -#endif +# endif -#if !KWSYS_IOS_HAS_OSTREAM_LONG_LONG +# if !KWSYS_IOS_HAS_OSTREAM_LONG_LONG // Implement output stream operator for IOStreamSLL. std::ostream& IOStreamPrint(std::ostream& os, IOStreamSLL value) { @@ -235,7 +235,7 @@ std::ostream& IOStreamPrint(std::ostream& os, IOStreamULL value) { return IOStreamPrintTemplate(os, value, 'u'); } -#endif +# endif } // namespace KWSYS_NAMESPACE diff --git a/Source/kwsys/IOStream.hxx.in b/Source/kwsys/IOStream.hxx.in index de3a2e6344..db8a23ef56 100644 --- a/Source/kwsys/IOStream.hxx.in +++ b/Source/kwsys/IOStream.hxx.in @@ -7,7 +7,7 @@ /* Define these macros temporarily to keep the code readable. */ #if !defined(KWSYS_NAMESPACE) && !@KWSYS_NAMESPACE@_NAME_IS_KWSYS -#define kwsysEXPORT @KWSYS_NAMESPACE@_EXPORT +# define kwsysEXPORT @KWSYS_NAMESPACE@_EXPORT #endif /* Whether istream supports long long. */ @@ -21,27 +21,27 @@ /* Determine whether we need to define the streaming operators for long long or __int64. */ #if @KWSYS_USE_LONG_LONG@ -#if !@KWSYS_NAMESPACE@_IOS_HAS_ISTREAM_LONG_LONG || \ - !@KWSYS_NAMESPACE@_IOS_HAS_OSTREAM_LONG_LONG -#define @KWSYS_NAMESPACE@_IOS_NEED_OPERATORS_LL 1 +# if !@KWSYS_NAMESPACE@_IOS_HAS_ISTREAM_LONG_LONG || \ + !@KWSYS_NAMESPACE@_IOS_HAS_OSTREAM_LONG_LONG +# define @KWSYS_NAMESPACE@_IOS_NEED_OPERATORS_LL 1 namespace @KWSYS_NAMESPACE@ { typedef long long IOStreamSLL; typedef unsigned long long IOStreamULL; } -#endif +# endif #elif defined(_MSC_VER) && _MSC_VER < 1300 -#define @KWSYS_NAMESPACE@_IOS_NEED_OPERATORS_LL 1 +# define @KWSYS_NAMESPACE@_IOS_NEED_OPERATORS_LL 1 namespace @KWSYS_NAMESPACE@ { typedef __int64 IOStreamSLL; typedef unsigned __int64 IOStreamULL; } #endif #if !defined(@KWSYS_NAMESPACE@_IOS_NEED_OPERATORS_LL) -#define @KWSYS_NAMESPACE@_IOS_NEED_OPERATORS_LL 0 +# define @KWSYS_NAMESPACE@_IOS_NEED_OPERATORS_LL 0 #endif #if @KWSYS_NAMESPACE@_IOS_NEED_OPERATORS_LL -#if !@KWSYS_NAMESPACE@_IOS_HAS_ISTREAM_LONG_LONG +# if !@KWSYS_NAMESPACE@_IOS_HAS_ISTREAM_LONG_LONG /* Input stream operator implementation functions. */ namespace @KWSYS_NAMESPACE@ { @@ -50,31 +50,31 @@ kwsysEXPORT std::istream& IOStreamScan(std::istream&, IOStreamULL&); } /* Provide input stream operator for long long. */ -#if !defined(@KWSYS_NAMESPACE@_IOS_NO_ISTREAM_LONG_LONG) && \ - !defined(KWSYS_IOS_ISTREAM_LONG_LONG_DEFINED) -#define KWSYS_IOS_ISTREAM_LONG_LONG_DEFINED -#define @KWSYS_NAMESPACE@_IOS_ISTREAM_LONG_LONG_DEFINED +# if !defined(@KWSYS_NAMESPACE@_IOS_NO_ISTREAM_LONG_LONG) && \ + !defined(KWSYS_IOS_ISTREAM_LONG_LONG_DEFINED) +# define KWSYS_IOS_ISTREAM_LONG_LONG_DEFINED +# define @KWSYS_NAMESPACE@_IOS_ISTREAM_LONG_LONG_DEFINED inline std::istream& operator>>(std::istream& is, @KWSYS_NAMESPACE@::IOStreamSLL& value) { return @KWSYS_NAMESPACE@::IOStreamScan(is, value); } -#endif +# endif /* Provide input stream operator for unsigned long long. */ -#if !defined(@KWSYS_NAMESPACE@_IOS_NO_ISTREAM_UNSIGNED_LONG_LONG) && \ - !defined(KWSYS_IOS_ISTREAM_UNSIGNED_LONG_LONG_DEFINED) -#define KWSYS_IOS_ISTREAM_UNSIGNED_LONG_LONG_DEFINED -#define @KWSYS_NAMESPACE@_IOS_ISTREAM_UNSIGNED_LONG_LONG_DEFINED +# if !defined(@KWSYS_NAMESPACE@_IOS_NO_ISTREAM_UNSIGNED_LONG_LONG) && \ + !defined(KWSYS_IOS_ISTREAM_UNSIGNED_LONG_LONG_DEFINED) +# define KWSYS_IOS_ISTREAM_UNSIGNED_LONG_LONG_DEFINED +# define @KWSYS_NAMESPACE@_IOS_ISTREAM_UNSIGNED_LONG_LONG_DEFINED inline std::istream& operator>>(std::istream& is, @KWSYS_NAMESPACE@::IOStreamULL& value) { return @KWSYS_NAMESPACE@::IOStreamScan(is, value); } -#endif -#endif /* !@KWSYS_NAMESPACE@_IOS_HAS_ISTREAM_LONG_LONG */ +# endif +# endif /* !@KWSYS_NAMESPACE@_IOS_HAS_ISTREAM_LONG_LONG */ -#if !@KWSYS_NAMESPACE@_IOS_HAS_OSTREAM_LONG_LONG +# if !@KWSYS_NAMESPACE@_IOS_HAS_OSTREAM_LONG_LONG /* Output stream operator implementation functions. */ namespace @KWSYS_NAMESPACE@ { @@ -83,44 +83,44 @@ kwsysEXPORT std::ostream& IOStreamPrint(std::ostream&, IOStreamULL); } /* Provide output stream operator for long long. */ -#if !defined(@KWSYS_NAMESPACE@_IOS_NO_OSTREAM_LONG_LONG) && \ - !defined(KWSYS_IOS_OSTREAM_LONG_LONG_DEFINED) -#define KWSYS_IOS_OSTREAM_LONG_LONG_DEFINED -#define @KWSYS_NAMESPACE@_IOS_OSTREAM_LONG_LONG_DEFINED +# if !defined(@KWSYS_NAMESPACE@_IOS_NO_OSTREAM_LONG_LONG) && \ + !defined(KWSYS_IOS_OSTREAM_LONG_LONG_DEFINED) +# define KWSYS_IOS_OSTREAM_LONG_LONG_DEFINED +# define @KWSYS_NAMESPACE@_IOS_OSTREAM_LONG_LONG_DEFINED inline std::ostream& operator<<(std::ostream& os, @KWSYS_NAMESPACE@::IOStreamSLL value) { return @KWSYS_NAMESPACE@::IOStreamPrint(os, value); } -#endif +# endif /* Provide output stream operator for unsigned long long. */ -#if !defined(@KWSYS_NAMESPACE@_IOS_NO_OSTREAM_UNSIGNED_LONG_LONG) && \ - !defined(KWSYS_IOS_OSTREAM_UNSIGNED_LONG_LONG_DEFINED) -#define KWSYS_IOS_OSTREAM_UNSIGNED_LONG_LONG_DEFINED -#define @KWSYS_NAMESPACE@_IOS_OSTREAM_UNSIGNED_LONG_LONG_DEFINED +# if !defined(@KWSYS_NAMESPACE@_IOS_NO_OSTREAM_UNSIGNED_LONG_LONG) && \ + !defined(KWSYS_IOS_OSTREAM_UNSIGNED_LONG_LONG_DEFINED) +# define KWSYS_IOS_OSTREAM_UNSIGNED_LONG_LONG_DEFINED +# define @KWSYS_NAMESPACE@_IOS_OSTREAM_UNSIGNED_LONG_LONG_DEFINED inline std::ostream& operator<<(std::ostream& os, @KWSYS_NAMESPACE@::IOStreamULL value) { return @KWSYS_NAMESPACE@::IOStreamPrint(os, value); } -#endif -#endif /* !@KWSYS_NAMESPACE@_IOS_HAS_OSTREAM_LONG_LONG */ -#endif /* @KWSYS_NAMESPACE@_IOS_NEED_OPERATORS_LL */ +# endif +# endif /* !@KWSYS_NAMESPACE@_IOS_HAS_OSTREAM_LONG_LONG */ +#endif /* @KWSYS_NAMESPACE@_IOS_NEED_OPERATORS_LL */ /* Undefine temporary macros. */ #if !defined(KWSYS_NAMESPACE) && !@KWSYS_NAMESPACE@_NAME_IS_KWSYS -#undef kwsysEXPORT +# undef kwsysEXPORT #endif /* If building a C++ file in kwsys itself, give the source file access to the macros without a configured namespace. */ #if defined(KWSYS_NAMESPACE) -#define KWSYS_IOS_HAS_ISTREAM_LONG_LONG \ - @KWSYS_NAMESPACE@_IOS_HAS_ISTREAM_LONG_LONG -#define KWSYS_IOS_HAS_OSTREAM_LONG_LONG \ - @KWSYS_NAMESPACE@_IOS_HAS_OSTREAM_LONG_LONG -#define KWSYS_IOS_NEED_OPERATORS_LL @KWSYS_NAMESPACE@_IOS_NEED_OPERATORS_LL +# define KWSYS_IOS_HAS_ISTREAM_LONG_LONG \ + @KWSYS_NAMESPACE@_IOS_HAS_ISTREAM_LONG_LONG +# define KWSYS_IOS_HAS_OSTREAM_LONG_LONG \ + @KWSYS_NAMESPACE@_IOS_HAS_OSTREAM_LONG_LONG +# define KWSYS_IOS_NEED_OPERATORS_LL @KWSYS_NAMESPACE@_IOS_NEED_OPERATORS_LL #endif #endif diff --git a/Source/kwsys/MD5.c b/Source/kwsys/MD5.c index 3188fb67ac..97cf9ba68b 100644 --- a/Source/kwsys/MD5.c +++ b/Source/kwsys/MD5.c @@ -6,7 +6,7 @@ /* Work-around CMake dependency scanning limitation. This must duplicate the above list of headers. */ #if 0 -#include "MD5.h.in" +# include "MD5.h.in" #endif #include <stddef.h> /* size_t */ @@ -19,8 +19,8 @@ implementation file. */ #if defined(__clang__) && !defined(__INTEL_COMPILER) -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wcast-align" +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wcast-align" #endif /* @@ -98,9 +98,9 @@ typedef struct md5_state_s #undef BYTE_ORDER /* 1 = big-endian, -1 = little-endian, 0 = unknown */ #ifdef ARCH_IS_BIG_ENDIAN -#define BYTE_ORDER (ARCH_IS_BIG_ENDIAN ? 1 : -1) +# define BYTE_ORDER (ARCH_IS_BIG_ENDIAN ? 1 : -1) #else -#define BYTE_ORDER 0 +# define BYTE_ORDER 0 #endif #define T_MASK ((md5_word_t)~0) @@ -222,11 +222,11 @@ static void md5_process(md5_state_t* pms, const md5_byte_t* data /*[64]*/) const md5_byte_t* xp = data; int i; -#if BYTE_ORDER == 0 +# if BYTE_ORDER == 0 X = xbuf; /* (dynamic only) */ -#else -#define xbuf X /* (static only) */ -#endif +# else +# define xbuf X /* (static only) */ +# endif for (i = 0; i < 16; ++i, xp += 4) xbuf[i] = (md5_word_t)(xp[0] + (xp[1] << 8) + (xp[2] << 16) + (xp[3] << 24)); @@ -420,7 +420,7 @@ static void md5_finish(md5_state_t* pms, md5_byte_t digest[16]) } #if defined(__clang__) && !defined(__INTEL_COMPILER) -#pragma clang diagnostic pop +# pragma clang diagnostic pop #endif /* Wrap up the MD5 state in our opaque structure. */ diff --git a/Source/kwsys/MD5.h.in b/Source/kwsys/MD5.h.in index c257f7f9ae..7646f1297a 100644 --- a/Source/kwsys/MD5.h.in +++ b/Source/kwsys/MD5.h.in @@ -10,19 +10,19 @@ not visible to user code. Use kwsysHeaderDump.pl to reproduce these macros after making changes to the interface. */ #if !defined(KWSYS_NAMESPACE) -#define kwsys_ns(x) @KWSYS_NAMESPACE@##x -#define kwsysEXPORT @KWSYS_NAMESPACE@_EXPORT +# define kwsys_ns(x) @KWSYS_NAMESPACE@##x +# define kwsysEXPORT @KWSYS_NAMESPACE@_EXPORT #endif #if !@KWSYS_NAMESPACE@_NAME_IS_KWSYS -#define kwsysMD5 kwsys_ns(MD5) -#define kwsysMD5_s kwsys_ns(MD5_s) -#define kwsysMD5_New kwsys_ns(MD5_New) -#define kwsysMD5_Delete kwsys_ns(MD5_Delete) -#define kwsysMD5_Initialize kwsys_ns(MD5_Initialize) -#define kwsysMD5_Append kwsys_ns(MD5_Append) -#define kwsysMD5_Finalize kwsys_ns(MD5_Finalize) -#define kwsysMD5_FinalizeHex kwsys_ns(MD5_FinalizeHex) -#define kwsysMD5_DigestToHex kwsys_ns(MD5_DigestToHex) +# define kwsysMD5 kwsys_ns(MD5) +# define kwsysMD5_s kwsys_ns(MD5_s) +# define kwsysMD5_New kwsys_ns(MD5_New) +# define kwsysMD5_Delete kwsys_ns(MD5_Delete) +# define kwsysMD5_Initialize kwsys_ns(MD5_Initialize) +# define kwsysMD5_Append kwsys_ns(MD5_Append) +# define kwsysMD5_Finalize kwsys_ns(MD5_Finalize) +# define kwsysMD5_FinalizeHex kwsys_ns(MD5_FinalizeHex) +# define kwsysMD5_DigestToHex kwsys_ns(MD5_DigestToHex) #endif #if defined(__cplusplus) @@ -79,19 +79,19 @@ kwsysEXPORT void kwsysMD5_DigestToHex(unsigned char const digest[16], /* If we are building a kwsys .c or .cxx file, let it use these macros. Otherwise, undefine them to keep the namespace clean. */ #if !defined(KWSYS_NAMESPACE) -#undef kwsys_ns -#undef kwsysEXPORT -#if !@KWSYS_NAMESPACE@_NAME_IS_KWSYS -#undef kwsysMD5 -#undef kwsysMD5_s -#undef kwsysMD5_New -#undef kwsysMD5_Delete -#undef kwsysMD5_Initialize -#undef kwsysMD5_Append -#undef kwsysMD5_Finalize -#undef kwsysMD5_FinalizeHex -#undef kwsysMD5_DigestToHex -#endif +# undef kwsys_ns +# undef kwsysEXPORT +# if !@KWSYS_NAMESPACE@_NAME_IS_KWSYS +# undef kwsysMD5 +# undef kwsysMD5_s +# undef kwsysMD5_New +# undef kwsysMD5_Delete +# undef kwsysMD5_Initialize +# undef kwsysMD5_Append +# undef kwsysMD5_Finalize +# undef kwsysMD5_FinalizeHex +# undef kwsysMD5_DigestToHex +# endif #endif #endif diff --git a/Source/kwsys/Process.h.in b/Source/kwsys/Process.h.in index daf334a616..73ea9dbfcd 100644 --- a/Source/kwsys/Process.h.in +++ b/Source/kwsys/Process.h.in @@ -10,75 +10,79 @@ not visible to user code. Use kwsysHeaderDump.pl to reproduce these macros after making changes to the interface. */ #if !defined(KWSYS_NAMESPACE) -#define kwsys_ns(x) @KWSYS_NAMESPACE@##x -#define kwsysEXPORT @KWSYS_NAMESPACE@_EXPORT +# define kwsys_ns(x) @KWSYS_NAMESPACE@##x +# define kwsysEXPORT @KWSYS_NAMESPACE@_EXPORT #endif #if !@KWSYS_NAMESPACE@_NAME_IS_KWSYS -#define kwsysProcess kwsys_ns(Process) -#define kwsysProcess_s kwsys_ns(Process_s) -#define kwsysProcess_New kwsys_ns(Process_New) -#define kwsysProcess_Delete kwsys_ns(Process_Delete) -#define kwsysProcess_SetCommand kwsys_ns(Process_SetCommand) -#define kwsysProcess_AddCommand kwsys_ns(Process_AddCommand) -#define kwsysProcess_SetTimeout kwsys_ns(Process_SetTimeout) -#define kwsysProcess_SetWorkingDirectory kwsys_ns(Process_SetWorkingDirectory) -#define kwsysProcess_SetPipeFile kwsys_ns(Process_SetPipeFile) -#define kwsysProcess_SetPipeNative kwsys_ns(Process_SetPipeNative) -#define kwsysProcess_SetPipeShared kwsys_ns(Process_SetPipeShared) -#define kwsysProcess_Option_Detach kwsys_ns(Process_Option_Detach) -#define kwsysProcess_Option_HideWindow kwsys_ns(Process_Option_HideWindow) -#define kwsysProcess_Option_MergeOutput kwsys_ns(Process_Option_MergeOutput) -#define kwsysProcess_Option_Verbatim kwsys_ns(Process_Option_Verbatim) -#define kwsysProcess_Option_CreateProcessGroup \ - kwsys_ns(Process_Option_CreateProcessGroup) -#define kwsysProcess_GetOption kwsys_ns(Process_GetOption) -#define kwsysProcess_SetOption kwsys_ns(Process_SetOption) -#define kwsysProcess_Option_e kwsys_ns(Process_Option_e) -#define kwsysProcess_State_Starting kwsys_ns(Process_State_Starting) -#define kwsysProcess_State_Error kwsys_ns(Process_State_Error) -#define kwsysProcess_State_Exception kwsys_ns(Process_State_Exception) -#define kwsysProcess_State_Executing kwsys_ns(Process_State_Executing) -#define kwsysProcess_State_Exited kwsys_ns(Process_State_Exited) -#define kwsysProcess_State_Expired kwsys_ns(Process_State_Expired) -#define kwsysProcess_State_Killed kwsys_ns(Process_State_Killed) -#define kwsysProcess_State_Disowned kwsys_ns(Process_State_Disowned) -#define kwsysProcess_State_e kwsys_ns(Process_State_e) -#define kwsysProcess_Exception_None kwsys_ns(Process_Exception_None) -#define kwsysProcess_Exception_Fault kwsys_ns(Process_Exception_Fault) -#define kwsysProcess_Exception_Illegal kwsys_ns(Process_Exception_Illegal) -#define kwsysProcess_Exception_Interrupt kwsys_ns(Process_Exception_Interrupt) -#define kwsysProcess_Exception_Numerical kwsys_ns(Process_Exception_Numerical) -#define kwsysProcess_Exception_Other kwsys_ns(Process_Exception_Other) -#define kwsysProcess_Exception_e kwsys_ns(Process_Exception_e) -#define kwsysProcess_GetState kwsys_ns(Process_GetState) -#define kwsysProcess_GetExitException kwsys_ns(Process_GetExitException) -#define kwsysProcess_GetExitCode kwsys_ns(Process_GetExitCode) -#define kwsysProcess_GetExitValue kwsys_ns(Process_GetExitValue) -#define kwsysProcess_GetErrorString kwsys_ns(Process_GetErrorString) -#define kwsysProcess_GetExceptionString kwsys_ns(Process_GetExceptionString) -#define kwsysProcess_GetStateByIndex kwsys_ns(Process_GetStateByIndex) -#define kwsysProcess_GetExitExceptionByIndex \ - kwsys_ns(Process_GetExitExceptionByIndex) -#define kwsysProcess_GetExitCodeByIndex kwsys_ns(Process_GetExitCodeByIndex) -#define kwsysProcess_GetExitValueByIndex kwsys_ns(Process_GetExitValueByIndex) -#define kwsysProcess_GetExceptionStringByIndex \ - kwsys_ns(Process_GetExceptionStringByIndex) -#define kwsysProcess_GetExitCodeByIndex kwsys_ns(Process_GetExitCodeByIndex) -#define kwsysProcess_Execute kwsys_ns(Process_Execute) -#define kwsysProcess_Disown kwsys_ns(Process_Disown) -#define kwsysProcess_WaitForData kwsys_ns(Process_WaitForData) -#define kwsysProcess_Pipes_e kwsys_ns(Process_Pipes_e) -#define kwsysProcess_Pipe_None kwsys_ns(Process_Pipe_None) -#define kwsysProcess_Pipe_STDIN kwsys_ns(Process_Pipe_STDIN) -#define kwsysProcess_Pipe_STDOUT kwsys_ns(Process_Pipe_STDOUT) -#define kwsysProcess_Pipe_STDERR kwsys_ns(Process_Pipe_STDERR) -#define kwsysProcess_Pipe_Timeout kwsys_ns(Process_Pipe_Timeout) -#define kwsysProcess_Pipe_Handle kwsys_ns(Process_Pipe_Handle) -#define kwsysProcess_WaitForExit kwsys_ns(Process_WaitForExit) -#define kwsysProcess_Interrupt kwsys_ns(Process_Interrupt) -#define kwsysProcess_Kill kwsys_ns(Process_Kill) -#define kwsysProcess_KillPID kwsys_ns(Process_KillPID) -#define kwsysProcess_ResetStartTime kwsys_ns(Process_ResetStartTime) +# define kwsysProcess kwsys_ns(Process) +# define kwsysProcess_s kwsys_ns(Process_s) +# define kwsysProcess_New kwsys_ns(Process_New) +# define kwsysProcess_Delete kwsys_ns(Process_Delete) +# define kwsysProcess_SetCommand kwsys_ns(Process_SetCommand) +# define kwsysProcess_AddCommand kwsys_ns(Process_AddCommand) +# define kwsysProcess_SetTimeout kwsys_ns(Process_SetTimeout) +# define kwsysProcess_SetWorkingDirectory \ + kwsys_ns(Process_SetWorkingDirectory) +# define kwsysProcess_SetPipeFile kwsys_ns(Process_SetPipeFile) +# define kwsysProcess_SetPipeNative kwsys_ns(Process_SetPipeNative) +# define kwsysProcess_SetPipeShared kwsys_ns(Process_SetPipeShared) +# define kwsysProcess_Option_Detach kwsys_ns(Process_Option_Detach) +# define kwsysProcess_Option_HideWindow kwsys_ns(Process_Option_HideWindow) +# define kwsysProcess_Option_MergeOutput kwsys_ns(Process_Option_MergeOutput) +# define kwsysProcess_Option_Verbatim kwsys_ns(Process_Option_Verbatim) +# define kwsysProcess_Option_CreateProcessGroup \ + kwsys_ns(Process_Option_CreateProcessGroup) +# define kwsysProcess_GetOption kwsys_ns(Process_GetOption) +# define kwsysProcess_SetOption kwsys_ns(Process_SetOption) +# define kwsysProcess_Option_e kwsys_ns(Process_Option_e) +# define kwsysProcess_State_Starting kwsys_ns(Process_State_Starting) +# define kwsysProcess_State_Error kwsys_ns(Process_State_Error) +# define kwsysProcess_State_Exception kwsys_ns(Process_State_Exception) +# define kwsysProcess_State_Executing kwsys_ns(Process_State_Executing) +# define kwsysProcess_State_Exited kwsys_ns(Process_State_Exited) +# define kwsysProcess_State_Expired kwsys_ns(Process_State_Expired) +# define kwsysProcess_State_Killed kwsys_ns(Process_State_Killed) +# define kwsysProcess_State_Disowned kwsys_ns(Process_State_Disowned) +# define kwsysProcess_State_e kwsys_ns(Process_State_e) +# define kwsysProcess_Exception_None kwsys_ns(Process_Exception_None) +# define kwsysProcess_Exception_Fault kwsys_ns(Process_Exception_Fault) +# define kwsysProcess_Exception_Illegal kwsys_ns(Process_Exception_Illegal) +# define kwsysProcess_Exception_Interrupt \ + kwsys_ns(Process_Exception_Interrupt) +# define kwsysProcess_Exception_Numerical \ + kwsys_ns(Process_Exception_Numerical) +# define kwsysProcess_Exception_Other kwsys_ns(Process_Exception_Other) +# define kwsysProcess_Exception_e kwsys_ns(Process_Exception_e) +# define kwsysProcess_GetState kwsys_ns(Process_GetState) +# define kwsysProcess_GetExitException kwsys_ns(Process_GetExitException) +# define kwsysProcess_GetExitCode kwsys_ns(Process_GetExitCode) +# define kwsysProcess_GetExitValue kwsys_ns(Process_GetExitValue) +# define kwsysProcess_GetErrorString kwsys_ns(Process_GetErrorString) +# define kwsysProcess_GetExceptionString kwsys_ns(Process_GetExceptionString) +# define kwsysProcess_GetStateByIndex kwsys_ns(Process_GetStateByIndex) +# define kwsysProcess_GetExitExceptionByIndex \ + kwsys_ns(Process_GetExitExceptionByIndex) +# define kwsysProcess_GetExitCodeByIndex kwsys_ns(Process_GetExitCodeByIndex) +# define kwsysProcess_GetExitValueByIndex \ + kwsys_ns(Process_GetExitValueByIndex) +# define kwsysProcess_GetExceptionStringByIndex \ + kwsys_ns(Process_GetExceptionStringByIndex) +# define kwsysProcess_GetExitCodeByIndex kwsys_ns(Process_GetExitCodeByIndex) +# define kwsysProcess_Execute kwsys_ns(Process_Execute) +# define kwsysProcess_Disown kwsys_ns(Process_Disown) +# define kwsysProcess_WaitForData kwsys_ns(Process_WaitForData) +# define kwsysProcess_Pipes_e kwsys_ns(Process_Pipes_e) +# define kwsysProcess_Pipe_None kwsys_ns(Process_Pipe_None) +# define kwsysProcess_Pipe_STDIN kwsys_ns(Process_Pipe_STDIN) +# define kwsysProcess_Pipe_STDOUT kwsys_ns(Process_Pipe_STDOUT) +# define kwsysProcess_Pipe_STDERR kwsys_ns(Process_Pipe_STDERR) +# define kwsysProcess_Pipe_Timeout kwsys_ns(Process_Pipe_Timeout) +# define kwsysProcess_Pipe_Handle kwsys_ns(Process_Pipe_Handle) +# define kwsysProcess_WaitForExit kwsys_ns(Process_WaitForExit) +# define kwsysProcess_Interrupt kwsys_ns(Process_Interrupt) +# define kwsysProcess_Kill kwsys_ns(Process_Kill) +# define kwsysProcess_KillPID kwsys_ns(Process_KillPID) +# define kwsysProcess_ResetStartTime kwsys_ns(Process_ResetStartTime) #endif #if defined(__cplusplus) @@ -307,13 +311,13 @@ kwsysEXPORT const char* kwsysProcess_GetErrorString(kwsysProcess* cp); kwsysEXPORT const char* kwsysProcess_GetExceptionString(kwsysProcess* cp); /** -* Get the current state of the Process instance. Possible states are: -* -* kwsysProcess_StateByIndex_Starting = Execute has not yet been called. -* kwsysProcess_StateByIndex_Exception = Child process exited abnormally. -* kwsysProcess_StateByIndex_Exited = Child process exited normally. -* kwsysProcess_StateByIndex_Error = Error getting the child return code. -*/ + * Get the current state of the Process instance. Possible states are: + * + * kwsysProcess_StateByIndex_Starting = Execute has not yet been called. + * kwsysProcess_StateByIndex_Exception = Child process exited abnormally. + * kwsysProcess_StateByIndex_Exited = Child process exited normally. + * kwsysProcess_StateByIndex_Error = Error getting the child return code. + */ kwsysEXPORT int kwsysProcess_GetStateByIndex(kwsysProcess* cp, int idx); enum kwsysProcess_StateByIndex_e { @@ -324,46 +328,46 @@ enum kwsysProcess_StateByIndex_e }; /** -* When GetState returns "Exception", this method returns a -* platform-independent description of the exceptional behavior that -* caused the child to terminate abnormally. Possible exceptions are: -* -* kwsysProcess_Exception_None = No exceptional behavior occurred. -* kwsysProcess_Exception_Fault = Child crashed with a memory fault. -* kwsysProcess_Exception_Illegal = Child crashed with an illegal -* instruction. -* kwsysProcess_Exception_Interrupt = Child was interrupted by user -* (Cntl-C/Break). -* kwsysProcess_Exception_Numerical = Child crashed with a numerical -* exception. -* kwsysProcess_Exception_Other = Child terminated for another reason. -*/ + * When GetState returns "Exception", this method returns a + * platform-independent description of the exceptional behavior that + * caused the child to terminate abnormally. Possible exceptions are: + * + * kwsysProcess_Exception_None = No exceptional behavior occurred. + * kwsysProcess_Exception_Fault = Child crashed with a memory fault. + * kwsysProcess_Exception_Illegal = Child crashed with an illegal + * instruction. + * kwsysProcess_Exception_Interrupt = Child was interrupted by user + * (Cntl-C/Break). + * kwsysProcess_Exception_Numerical = Child crashed with a numerical + * exception. + * kwsysProcess_Exception_Other = Child terminated for another reason. + */ kwsysEXPORT int kwsysProcess_GetExitExceptionByIndex(kwsysProcess* cp, int idx); /** -* When GetState returns "Exited" or "Exception", this method returns -* the platform-specific raw exit code of the process. UNIX platforms -* should use WIFEXITED/WEXITSTATUS and WIFSIGNALED/WTERMSIG to access -* this value. Windows users should compare the value to the various -* EXCEPTION_* values. -* -* If GetState returns "Exited", use GetExitValue to get the -* platform-independent child return value. -*/ + * When GetState returns "Exited" or "Exception", this method returns + * the platform-specific raw exit code of the process. UNIX platforms + * should use WIFEXITED/WEXITSTATUS and WIFSIGNALED/WTERMSIG to access + * this value. Windows users should compare the value to the various + * EXCEPTION_* values. + * + * If GetState returns "Exited", use GetExitValue to get the + * platform-independent child return value. + */ kwsysEXPORT int kwsysProcess_GetExitCodeByIndex(kwsysProcess* cp, int idx); /** -* When GetState returns "Exited", this method returns the child's -* platform-independent exit code (such as the value returned by the -* child's main). -*/ + * When GetState returns "Exited", this method returns the child's + * platform-independent exit code (such as the value returned by the + * child's main). + */ kwsysEXPORT int kwsysProcess_GetExitValueByIndex(kwsysProcess* cp, int idx); /** -* When GetState returns "Exception", this method returns a string -* describing the problem. Otherwise, it returns NULL. -*/ + * When GetState returns "Exception", this method returns a string + * describing the problem. Otherwise, it returns NULL. + */ kwsysEXPORT const char* kwsysProcess_GetExceptionStringByIndex( kwsysProcess* cp, int idx); @@ -476,65 +480,65 @@ kwsysEXPORT void kwsysProcess_ResetStartTime(kwsysProcess* cp); /* If we are building a kwsys .c or .cxx file, let it use these macros. Otherwise, undefine them to keep the namespace clean. */ #if !defined(KWSYS_NAMESPACE) -#undef kwsys_ns -#undef kwsysEXPORT -#if !@KWSYS_NAMESPACE@_NAME_IS_KWSYS -#undef kwsysProcess -#undef kwsysProcess_s -#undef kwsysProcess_New -#undef kwsysProcess_Delete -#undef kwsysProcess_SetCommand -#undef kwsysProcess_AddCommand -#undef kwsysProcess_SetTimeout -#undef kwsysProcess_SetWorkingDirectory -#undef kwsysProcess_SetPipeFile -#undef kwsysProcess_SetPipeNative -#undef kwsysProcess_SetPipeShared -#undef kwsysProcess_Option_Detach -#undef kwsysProcess_Option_HideWindow -#undef kwsysProcess_Option_MergeOutput -#undef kwsysProcess_Option_Verbatim -#undef kwsysProcess_Option_CreateProcessGroup -#undef kwsysProcess_GetOption -#undef kwsysProcess_SetOption -#undef kwsysProcess_Option_e -#undef kwsysProcess_State_Starting -#undef kwsysProcess_State_Error -#undef kwsysProcess_State_Exception -#undef kwsysProcess_State_Executing -#undef kwsysProcess_State_Exited -#undef kwsysProcess_State_Expired -#undef kwsysProcess_State_Killed -#undef kwsysProcess_State_Disowned -#undef kwsysProcess_GetState -#undef kwsysProcess_State_e -#undef kwsysProcess_Exception_None -#undef kwsysProcess_Exception_Fault -#undef kwsysProcess_Exception_Illegal -#undef kwsysProcess_Exception_Interrupt -#undef kwsysProcess_Exception_Numerical -#undef kwsysProcess_Exception_Other -#undef kwsysProcess_GetExitException -#undef kwsysProcess_Exception_e -#undef kwsysProcess_GetExitCode -#undef kwsysProcess_GetExitValue -#undef kwsysProcess_GetErrorString -#undef kwsysProcess_GetExceptionString -#undef kwsysProcess_Execute -#undef kwsysProcess_Disown -#undef kwsysProcess_WaitForData -#undef kwsysProcess_Pipes_e -#undef kwsysProcess_Pipe_None -#undef kwsysProcess_Pipe_STDIN -#undef kwsysProcess_Pipe_STDOUT -#undef kwsysProcess_Pipe_STDERR -#undef kwsysProcess_Pipe_Timeout -#undef kwsysProcess_Pipe_Handle -#undef kwsysProcess_WaitForExit -#undef kwsysProcess_Interrupt -#undef kwsysProcess_Kill -#undef kwsysProcess_ResetStartTime -#endif +# undef kwsys_ns +# undef kwsysEXPORT +# if !@KWSYS_NAMESPACE@_NAME_IS_KWSYS +# undef kwsysProcess +# undef kwsysProcess_s +# undef kwsysProcess_New +# undef kwsysProcess_Delete +# undef kwsysProcess_SetCommand +# undef kwsysProcess_AddCommand +# undef kwsysProcess_SetTimeout +# undef kwsysProcess_SetWorkingDirectory +# undef kwsysProcess_SetPipeFile +# undef kwsysProcess_SetPipeNative +# undef kwsysProcess_SetPipeShared +# undef kwsysProcess_Option_Detach +# undef kwsysProcess_Option_HideWindow +# undef kwsysProcess_Option_MergeOutput +# undef kwsysProcess_Option_Verbatim +# undef kwsysProcess_Option_CreateProcessGroup +# undef kwsysProcess_GetOption +# undef kwsysProcess_SetOption +# undef kwsysProcess_Option_e +# undef kwsysProcess_State_Starting +# undef kwsysProcess_State_Error +# undef kwsysProcess_State_Exception +# undef kwsysProcess_State_Executing +# undef kwsysProcess_State_Exited +# undef kwsysProcess_State_Expired +# undef kwsysProcess_State_Killed +# undef kwsysProcess_State_Disowned +# undef kwsysProcess_GetState +# undef kwsysProcess_State_e +# undef kwsysProcess_Exception_None +# undef kwsysProcess_Exception_Fault +# undef kwsysProcess_Exception_Illegal +# undef kwsysProcess_Exception_Interrupt +# undef kwsysProcess_Exception_Numerical +# undef kwsysProcess_Exception_Other +# undef kwsysProcess_GetExitException +# undef kwsysProcess_Exception_e +# undef kwsysProcess_GetExitCode +# undef kwsysProcess_GetExitValue +# undef kwsysProcess_GetErrorString +# undef kwsysProcess_GetExceptionString +# undef kwsysProcess_Execute +# undef kwsysProcess_Disown +# undef kwsysProcess_WaitForData +# undef kwsysProcess_Pipes_e +# undef kwsysProcess_Pipe_None +# undef kwsysProcess_Pipe_STDIN +# undef kwsysProcess_Pipe_STDOUT +# undef kwsysProcess_Pipe_STDERR +# undef kwsysProcess_Pipe_Timeout +# undef kwsysProcess_Pipe_Handle +# undef kwsysProcess_WaitForExit +# undef kwsysProcess_Interrupt +# undef kwsysProcess_Kill +# undef kwsysProcess_ResetStartTime +# endif #endif #endif diff --git a/Source/kwsys/ProcessUNIX.c b/Source/kwsys/ProcessUNIX.c index 1e80b39cba..094c2ee23e 100644 --- a/Source/kwsys/ProcessUNIX.c +++ b/Source/kwsys/ProcessUNIX.c @@ -7,8 +7,8 @@ /* Work-around CMake dependency scanning limitation. This must duplicate the above list of headers. */ #if 0 -#include "Process.h.in" -#include "System.h.in" +# include "Process.h.in" +# include "System.h.in" #endif /* @@ -40,7 +40,7 @@ do. #if defined(__CYGWIN__) /* Increase the file descriptor limit for select() before including related system headers. (Default: 64) */ -#define FD_SETSIZE 16384 +# define FD_SETSIZE 16384 #endif #include <assert.h> /* assert */ @@ -61,9 +61,9 @@ do. #include <unistd.h> /* pipe, close, fork, execvp, select, _exit */ #if defined(__VMS) -#define KWSYSPE_VMS_NONBLOCK , O_NONBLOCK +# define KWSYSPE_VMS_NONBLOCK , O_NONBLOCK #else -#define KWSYSPE_VMS_NONBLOCK +# define KWSYSPE_VMS_NONBLOCK #endif #if defined(KWSYS_C_HAS_PTRDIFF_T) && KWSYS_C_HAS_PTRDIFF_T @@ -80,13 +80,13 @@ typedef int kwsysProcess_ssize_t; #if defined(__BEOS__) && !defined(__ZETA__) /* BeOS 5 doesn't have usleep(), but it has snooze(), which is identical. */ -#include <be/kernel/OS.h> +# include <be/kernel/OS.h> static inline void kwsysProcess_usleep(unsigned int msec) { snooze(msec); } #else -#define kwsysProcess_usleep usleep +# define kwsysProcess_usleep usleep #endif /* @@ -101,12 +101,12 @@ static inline void kwsysProcess_usleep(unsigned int msec) */ #if !defined(__BEOS__) && !defined(__VMS) && !defined(__MINT__) && \ !defined(KWSYSPE_USE_SELECT) -#define KWSYSPE_USE_SELECT 1 +# define KWSYSPE_USE_SELECT 1 #endif /* Some platforms do not have siginfo on their signal handlers. */ #if defined(SA_SIGINFO) && !defined(__BEOS__) -#define KWSYSPE_USE_SIGINFO 1 +# define KWSYSPE_USE_SIGINFO 1 #endif /* The number of pipes for the child's output. The standard stdout @@ -1266,21 +1266,21 @@ static int kwsysProcessWaitForPipe(kwsysProcess* cp, char** data, int* length, } else if (n == 0) /* EOF */ { /* We are done reading from this pipe. */ -#if defined(__VMS) +# if defined(__VMS) if (!cp->CommandsLeft) -#endif +# endif { kwsysProcessCleanupDescriptor(&cp->PipeReadEnds[i]); --cp->PipesLeft; } } else if (n < 0) /* error */ { -#if defined(__VMS) +# if defined(__VMS) if (!cp->CommandsLeft) { kwsysProcessCleanupDescriptor(&cp->PipeReadEnds[i]); --cp->PipesLeft; } else -#endif +# endif if ((errno != EINTR) && (errno != EAGAIN)) { strncpy(cp->ErrorMessage, strerror(errno), KWSYSPE_PIPE_BUFFER_SIZE); /* Kill the children now. */ @@ -1471,12 +1471,12 @@ static void kwsysProcessVolatileFree(volatile void* p) /* clang has made it impossible to free memory that points to volatile without first using special pragmas to disable a warning... */ #if defined(__clang__) && !defined(__INTEL_COMPILER) -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wcast-qual" +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wcast-qual" #endif free((void*)p); /* The cast will silence most compilers, but not clang. */ #if defined(__clang__) && !defined(__INTEL_COMPILER) -#pragma clang diagnostic pop +# pragma clang diagnostic pop #endif } @@ -2098,11 +2098,11 @@ static void kwsysProcessSetExitExceptionByIndex(kwsysProcess* cp, int sig, break; #endif #ifdef SIGBUS -#if !defined(SIGSEGV) || SIGBUS != SIGSEGV +# if !defined(SIGSEGV) || SIGBUS != SIGSEGV case SIGBUS: KWSYSPE_CASE(Fault, "Bus error"); break; -#endif +# endif #endif #ifdef SIGFPE case SIGFPE: @@ -2150,11 +2150,11 @@ static void kwsysProcessSetExitExceptionByIndex(kwsysProcess* cp, int sig, break; #endif #ifdef SIGIOT -#if !defined(SIGABRT) || SIGIOT != SIGABRT +# if !defined(SIGABRT) || SIGIOT != SIGABRT case SIGIOT: KWSYSPE_CASE(Other, "SIGIOT"); break; -#endif +# endif #endif #ifdef SIGUSR1 case SIGUSR1: @@ -2251,11 +2251,11 @@ static void kwsysProcessSetExitExceptionByIndex(kwsysProcess* cp, int sig, break; #endif #ifdef SIGIO -#if !defined(SIGPOLL) || SIGIO != SIGPOLL +# if !defined(SIGPOLL) || SIGIO != SIGPOLL case SIGIO: KWSYSPE_CASE(Other, "SIGIO"); break; -#endif +# endif #endif #ifdef SIGPWR case SIGPWR: @@ -2268,11 +2268,11 @@ static void kwsysProcessSetExitExceptionByIndex(kwsysProcess* cp, int sig, break; #endif #ifdef SIGUNUSED -#if !defined(SIGSYS) || SIGUNUSED != SIGSYS +# if !defined(SIGSYS) || SIGUNUSED != SIGSYS case SIGUNUSED: KWSYSPE_CASE(Other, "SIGUNUSED"); break; -#endif +# endif #endif default: cp->ProcessResults[idx].ExitException = kwsysProcess_Exception_Other; @@ -2468,21 +2468,21 @@ static pid_t kwsysProcessFork(kwsysProcess* cp, have two integers to store: the pid and then the ppid. */ #if defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) || \ defined(__OpenBSD__) || defined(__GLIBC__) || defined(__GNU__) -#define KWSYSPE_PS_COMMAND "ps axo pid,ppid" -#define KWSYSPE_PS_FORMAT "%d %d\n" +# define KWSYSPE_PS_COMMAND "ps axo pid,ppid" +# define KWSYSPE_PS_FORMAT "%d %d\n" #elif defined(__sun) && (defined(__SVR4) || defined(__svr4__)) /* Solaris */ -#define KWSYSPE_PS_COMMAND "ps -e -o pid,ppid" -#define KWSYSPE_PS_FORMAT "%d %d\n" +# define KWSYSPE_PS_COMMAND "ps -e -o pid,ppid" +# define KWSYSPE_PS_FORMAT "%d %d\n" #elif defined(__hpux) || defined(__sun__) || defined(__sgi) || \ defined(_AIX) || defined(__sparc) -#define KWSYSPE_PS_COMMAND "ps -ef" -#define KWSYSPE_PS_FORMAT "%*s %d %d %*[^\n]\n" +# define KWSYSPE_PS_COMMAND "ps -ef" +# define KWSYSPE_PS_FORMAT "%*s %d %d %*[^\n]\n" #elif defined(__QNX__) -#define KWSYSPE_PS_COMMAND "ps -Af" -#define KWSYSPE_PS_FORMAT "%*d %d %d %*[^\n]\n" +# define KWSYSPE_PS_COMMAND "ps -Af" +# define KWSYSPE_PS_FORMAT "%*d %d %d %*[^\n]\n" #elif defined(__CYGWIN__) -#define KWSYSPE_PS_COMMAND "ps aux" -#define KWSYSPE_PS_FORMAT "%d %d %*[^\n]\n" +# define KWSYSPE_PS_COMMAND "ps aux" +# define KWSYSPE_PS_FORMAT "%d %d %*[^\n]\n" #endif void kwsysProcess_KillPID(unsigned long process_id) @@ -2509,13 +2509,13 @@ static void kwsysProcessKill(pid_t process_id) #if defined(__linux__) || defined(__CYGWIN__) /* First try using the /proc filesystem. */ if ((procdir = opendir("/proc")) != NULL) { -#if defined(MAXPATHLEN) +# if defined(MAXPATHLEN) char fname[MAXPATHLEN]; -#elif defined(PATH_MAX) +# elif defined(PATH_MAX) char fname[PATH_MAX]; -#else +# else char fname[4096]; -#endif +# endif char buffer[KWSYSPE_PIPE_BUFFER_SIZE + 1]; struct dirent* d; @@ -2715,9 +2715,9 @@ static int kwsysProcessesAdd(kwsysProcess* cp) #if KWSYSPE_USE_SIGINFO newSigAction.sa_sigaction = kwsysProcessesSignalHandler; newSigAction.sa_flags = SA_NOCLDSTOP | SA_SIGINFO; -#ifdef SA_RESTART +# ifdef SA_RESTART newSigAction.sa_flags |= SA_RESTART; -#endif +# endif #else newSigAction.sa_handler = kwsysProcessesSignalHandler; newSigAction.sa_flags = SA_NOCLDSTOP; @@ -2804,7 +2804,7 @@ static void kwsysProcessesSignalHandler(int signum , siginfo_t* info, void* ucontext #endif - ) +) { int i, j, procStatus, old_errno = errno; #if KWSYSPE_USE_SIGINFO diff --git a/Source/kwsys/ProcessWin32.c b/Source/kwsys/ProcessWin32.c index 82fdc74786..9fa0cb12a8 100644 --- a/Source/kwsys/ProcessWin32.c +++ b/Source/kwsys/ProcessWin32.c @@ -7,8 +7,8 @@ /* Work-around CMake dependency scanning limitation. This must duplicate the above list of headers. */ #if 0 -#include "Encoding.h.in" -#include "Process.h.in" +# include "Encoding.h.in" +# include "Process.h.in" #endif /* @@ -22,35 +22,35 @@ a UNIX-style select system call. */ #ifdef _MSC_VER -#pragma warning(push, 1) +# pragma warning(push, 1) #endif #include <windows.h> /* Windows API */ #if defined(_MSC_VER) && _MSC_VER >= 1800 -#define KWSYS_WINDOWS_DEPRECATED_GetVersionEx +# define KWSYS_WINDOWS_DEPRECATED_GetVersionEx #endif #include <io.h> /* _unlink */ #include <stdio.h> /* sprintf */ #include <string.h> /* strlen, strdup */ #ifdef __WATCOMC__ -#define _unlink unlink +# define _unlink unlink #endif #ifndef _MAX_FNAME -#define _MAX_FNAME 4096 +# define _MAX_FNAME 4096 #endif #ifndef _MAX_PATH -#define _MAX_PATH 4096 +# define _MAX_PATH 4096 #endif #ifdef _MSC_VER -#pragma warning(pop) -#pragma warning(disable : 4514) -#pragma warning(disable : 4706) +# pragma warning(pop) +# pragma warning(disable : 4514) +# pragma warning(disable : 4706) #endif #if defined(__BORLANDC__) -#pragma warn - 8004 /* assigned a value that is never used */ -#pragma warn - 8060 /* Assignment inside if() condition. */ +# pragma warn - 8004 /* assigned a value that is never used */ +# pragma warn - 8060 /* Assignment inside if() condition. */ #endif /* There are pipes for the process pipeline's stdout and stderr. */ @@ -63,14 +63,14 @@ a UNIX-style select system call. /* Debug output macro. */ #if 0 -#define KWSYSPE_DEBUG(x) \ - ((void*)cp == (void*)0x00226DE0 \ - ? (fprintf(stderr, "%d/%p/%d ", (int)GetCurrentProcessId(), cp, \ - __LINE__), \ - fprintf x, fflush(stderr), 1) \ - : (1)) +# define KWSYSPE_DEBUG(x) \ + ((void*)cp == (void*)0x00226DE0 \ + ? (fprintf(stderr, "%d/%p/%d ", (int)GetCurrentProcessId(), cp, \ + __LINE__), \ + fprintf x, fflush(stderr), 1) \ + : (1)) #else -#define KWSYSPE_DEBUG(x) (void)1 +# define KWSYSPE_DEBUG(x) (void)1 #endif typedef LARGE_INTEGER kwsysProcessTime; @@ -355,16 +355,16 @@ kwsysProcess* kwsysProcess_New(void) ZeroMemory(&osv, sizeof(osv)); osv.dwOSVersionInfoSize = sizeof(osv); #ifdef KWSYS_WINDOWS_DEPRECATED_GetVersionEx -#pragma warning(push) -#ifdef __INTEL_COMPILER -#pragma warning(disable : 1478) -#else -#pragma warning(disable : 4996) -#endif +# pragma warning(push) +# ifdef __INTEL_COMPILER +# pragma warning(disable : 1478) +# else +# pragma warning(disable : 4996) +# endif #endif GetVersionEx(&osv); #ifdef KWSYS_WINDOWS_DEPRECATED_GetVersionEx -#pragma warning(pop) +# pragma warning(pop) #endif if (osv.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS) { /* Win9x no longer supported. */ @@ -2266,16 +2266,16 @@ static kwsysProcess_List* kwsysProcess_List_New(void) ZeroMemory(&osv, sizeof(osv)); osv.dwOSVersionInfoSize = sizeof(osv); #ifdef KWSYS_WINDOWS_DEPRECATED_GetVersionEx -#pragma warning(push) -#ifdef __INTEL_COMPILER -#pragma warning(disable : 1478) -#else -#pragma warning(disable : 4996) -#endif +# pragma warning(push) +# ifdef __INTEL_COMPILER +# pragma warning(disable : 1478) +# else +# pragma warning(disable : 4996) +# endif #endif GetVersionEx(&osv); #ifdef KWSYS_WINDOWS_DEPRECATED_GetVersionEx -#pragma warning(pop) +# pragma warning(pop) #endif self->NT4 = (osv.dwPlatformId == VER_PLATFORM_WIN32_NT && osv.dwMajorVersion < 5) ? 1 diff --git a/Source/kwsys/RegularExpression.cxx b/Source/kwsys/RegularExpression.cxx index 78cff1a01e..5f84b19463 100644 --- a/Source/kwsys/RegularExpression.cxx +++ b/Source/kwsys/RegularExpression.cxx @@ -25,7 +25,7 @@ // Work-around CMake dependency scanning limitation. This must // duplicate the above list of headers. #if 0 -#include "RegularExpression.hxx.in" +# include "RegularExpression.hxx.in" #endif #include <stdio.h> @@ -194,24 +194,29 @@ bool RegularExpression::deep_equal(const RegularExpression& rxp) const */ // definition number opnd? meaning -#define END 0 // no End of program. -#define BOL 1 // no Match "" at beginning of line. -#define EOL 2 // no Match "" at end of line. -#define ANY 3 // no Match any one character. -#define ANYOF 4 // str Match any character in this string. -#define ANYBUT 5 // str Match any character not in this - // string. -#define BRANCH 6 // node Match this alternative, or the +#define END 0 // no End of program. +#define BOL 1 // no Match "" at beginning of line. +#define EOL 2 // no Match "" at end of line. +#define ANY 3 // no Match any one character. +#define ANYOF 4 // str Match any character in this string. +#define ANYBUT \ + 5 // str Match any character not in this + // string. +#define BRANCH \ + 6 // node Match this alternative, or the // next... #define BACK 7 // no Match "", "next" ptr points backward. #define EXACTLY 8 // str Match this string. #define NOTHING 9 // no Match empty string. -#define STAR 10 // node Match this (simple) thing 0 or more - // times. -#define PLUS 11 // node Match this (simple) thing 1 or more - // times. -#define OPEN 20 // no Mark this point in input as start of - // #n. +#define STAR \ + 10 // node Match this (simple) thing 0 or more + // times. +#define PLUS \ + 11 // node Match this (simple) thing 1 or more + // times. +#define OPEN \ + 20 // no Mark this point in input as start of + // #n. // OPEN+1 is number 1, etc. #define CLOSE 30 // no Analogous to OPEN. diff --git a/Source/kwsys/RegularExpression.hxx.in b/Source/kwsys/RegularExpression.hxx.in index 92e4b36d29..b7b93f962d 100644 --- a/Source/kwsys/RegularExpression.hxx.in +++ b/Source/kwsys/RegularExpression.hxx.in @@ -29,7 +29,7 @@ /* Disable useless Borland warnings. KWSys tries not to force things on its includers, but there is no choice here. */ #if defined(__BORLANDC__) -#pragma warn - 8027 /* function not inlined. */ +# pragma warn - 8027 /* function not inlined. */ #endif namespace @KWSYS_NAMESPACE@ { @@ -138,8 +138,9 @@ inline std::string RegularExpressionMatch::match(int n) const if (this->startp[n] == 0) { return std::string(); } else { - return std::string(this->startp[n], static_cast<std::string::size_type>( - this->endp[n] - this->startp[n])); + return std::string( + this->startp[n], + static_cast<std::string::size_type>(this->endp[n] - this->startp[n])); } } diff --git a/Source/kwsys/SharedForward.h.in b/Source/kwsys/SharedForward.h.in index 0caf5e7c3f..5716cd4f1e 100644 --- a/Source/kwsys/SharedForward.h.in +++ b/Source/kwsys/SharedForward.h.in @@ -1,7 +1,7 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing#kwsys for details. */ #ifndef @KWSYS_NAMESPACE@_SharedForward_h -#define @KWSYS_NAMESPACE@_SharedForward_h +# define @KWSYS_NAMESPACE@_SharedForward_h /* This header is used to create a forwarding executable sets up the @@ -59,134 +59,134 @@ /* Disable -Wcast-qual warnings since they are too hard to fix in a cross-platform way. */ -#if defined(__clang__) && defined(__has_warning) -#if __has_warning("-Wcast-qual") -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wcast-qual" -#endif -#endif - -#if defined(__BORLANDC__) && !defined(__cplusplus) +# if defined(__clang__) && defined(__has_warning) +# if __has_warning("-Wcast-qual") +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wcast-qual" +# endif +# endif + +# if defined(__BORLANDC__) && !defined(__cplusplus) /* Code has no effect; raised by winnt.h in C (not C++) when ignoring an unused parameter using "(param)" syntax (i.e. no cast to void). */ -#pragma warn - 8019 -#endif +# pragma warn - 8019 +# endif /* Full path to the directory in which this executable is built. Do not include a trailing slash. */ -#if !defined(@KWSYS_NAMESPACE@_SHARED_FORWARD_DIR_BUILD) -#error "Must define @KWSYS_NAMESPACE@_SHARED_FORWARD_DIR_BUILD" -#endif -#if !defined(KWSYS_SHARED_FORWARD_DIR_BUILD) -#define KWSYS_SHARED_FORWARD_DIR_BUILD \ - @KWSYS_NAMESPACE@_SHARED_FORWARD_DIR_BUILD -#endif +# if !defined(@KWSYS_NAMESPACE@_SHARED_FORWARD_DIR_BUILD) +# error "Must define @KWSYS_NAMESPACE@_SHARED_FORWARD_DIR_BUILD" +# endif +# if !defined(KWSYS_SHARED_FORWARD_DIR_BUILD) +# define KWSYS_SHARED_FORWARD_DIR_BUILD \ + @KWSYS_NAMESPACE@_SHARED_FORWARD_DIR_BUILD +# endif /* Library search path for build tree. */ -#if !defined(@KWSYS_NAMESPACE@_SHARED_FORWARD_PATH_BUILD) -#error "Must define @KWSYS_NAMESPACE@_SHARED_FORWARD_PATH_BUILD" -#endif -#if !defined(KWSYS_SHARED_FORWARD_PATH_BUILD) -#define KWSYS_SHARED_FORWARD_PATH_BUILD \ - @KWSYS_NAMESPACE@_SHARED_FORWARD_PATH_BUILD -#endif +# if !defined(@KWSYS_NAMESPACE@_SHARED_FORWARD_PATH_BUILD) +# error "Must define @KWSYS_NAMESPACE@_SHARED_FORWARD_PATH_BUILD" +# endif +# if !defined(KWSYS_SHARED_FORWARD_PATH_BUILD) +# define KWSYS_SHARED_FORWARD_PATH_BUILD \ + @KWSYS_NAMESPACE@_SHARED_FORWARD_PATH_BUILD +# endif /* Library search path for install tree. */ -#if !defined(@KWSYS_NAMESPACE@_SHARED_FORWARD_PATH_INSTALL) -#error "Must define @KWSYS_NAMESPACE@_SHARED_FORWARD_PATH_INSTALL" -#endif -#if !defined(KWSYS_SHARED_FORWARD_PATH_INSTALL) -#define KWSYS_SHARED_FORWARD_PATH_INSTALL \ - @KWSYS_NAMESPACE@_SHARED_FORWARD_PATH_INSTALL -#endif +# if !defined(@KWSYS_NAMESPACE@_SHARED_FORWARD_PATH_INSTALL) +# error "Must define @KWSYS_NAMESPACE@_SHARED_FORWARD_PATH_INSTALL" +# endif +# if !defined(KWSYS_SHARED_FORWARD_PATH_INSTALL) +# define KWSYS_SHARED_FORWARD_PATH_INSTALL \ + @KWSYS_NAMESPACE@_SHARED_FORWARD_PATH_INSTALL +# endif /* The real executable to which to forward in the build tree. */ -#if !defined(@KWSYS_NAMESPACE@_SHARED_FORWARD_EXE_BUILD) -#error "Must define @KWSYS_NAMESPACE@_SHARED_FORWARD_EXE_BUILD" -#endif -#if !defined(KWSYS_SHARED_FORWARD_EXE_BUILD) -#define KWSYS_SHARED_FORWARD_EXE_BUILD \ - @KWSYS_NAMESPACE@_SHARED_FORWARD_EXE_BUILD -#endif +# if !defined(@KWSYS_NAMESPACE@_SHARED_FORWARD_EXE_BUILD) +# error "Must define @KWSYS_NAMESPACE@_SHARED_FORWARD_EXE_BUILD" +# endif +# if !defined(KWSYS_SHARED_FORWARD_EXE_BUILD) +# define KWSYS_SHARED_FORWARD_EXE_BUILD \ + @KWSYS_NAMESPACE@_SHARED_FORWARD_EXE_BUILD +# endif /* The real executable to which to forward in the install tree. */ -#if !defined(@KWSYS_NAMESPACE@_SHARED_FORWARD_EXE_INSTALL) -#error "Must define @KWSYS_NAMESPACE@_SHARED_FORWARD_EXE_INSTALL" -#endif -#if !defined(KWSYS_SHARED_FORWARD_EXE_INSTALL) -#define KWSYS_SHARED_FORWARD_EXE_INSTALL \ - @KWSYS_NAMESPACE@_SHARED_FORWARD_EXE_INSTALL -#endif +# if !defined(@KWSYS_NAMESPACE@_SHARED_FORWARD_EXE_INSTALL) +# error "Must define @KWSYS_NAMESPACE@_SHARED_FORWARD_EXE_INSTALL" +# endif +# if !defined(KWSYS_SHARED_FORWARD_EXE_INSTALL) +# define KWSYS_SHARED_FORWARD_EXE_INSTALL \ + @KWSYS_NAMESPACE@_SHARED_FORWARD_EXE_INSTALL +# endif /* The configuration name with which this executable was built (Debug/Release). */ -#if defined(@KWSYS_NAMESPACE@_SHARED_FORWARD_CONFIG_NAME) -#define KWSYS_SHARED_FORWARD_CONFIG_NAME \ - @KWSYS_NAMESPACE@_SHARED_FORWARD_CONFIG_NAME -#else -#undef KWSYS_SHARED_FORWARD_CONFIG_NAME -#endif +# if defined(@KWSYS_NAMESPACE@_SHARED_FORWARD_CONFIG_NAME) +# define KWSYS_SHARED_FORWARD_CONFIG_NAME \ + @KWSYS_NAMESPACE@_SHARED_FORWARD_CONFIG_NAME +# else +# undef KWSYS_SHARED_FORWARD_CONFIG_NAME +# endif /* Create command line option to replace executable. */ -#if defined(@KWSYS_NAMESPACE@_SHARED_FORWARD_OPTION_COMMAND) -#if !defined(KWSYS_SHARED_FORWARD_OPTION_COMMAND) -#define KWSYS_SHARED_FORWARD_OPTION_COMMAND \ - @KWSYS_NAMESPACE@_SHARED_FORWARD_OPTION_COMMAND -#endif -#else -#undef KWSYS_SHARED_FORWARD_OPTION_COMMAND -#endif +# if defined(@KWSYS_NAMESPACE@_SHARED_FORWARD_OPTION_COMMAND) +# if !defined(KWSYS_SHARED_FORWARD_OPTION_COMMAND) +# define KWSYS_SHARED_FORWARD_OPTION_COMMAND \ + @KWSYS_NAMESPACE@_SHARED_FORWARD_OPTION_COMMAND +# endif +# else +# undef KWSYS_SHARED_FORWARD_OPTION_COMMAND +# endif /* Create command line option to print environment setting and exit. */ -#if defined(@KWSYS_NAMESPACE@_SHARED_FORWARD_OPTION_PRINT) -#if !defined(KWSYS_SHARED_FORWARD_OPTION_PRINT) -#define KWSYS_SHARED_FORWARD_OPTION_PRINT \ - @KWSYS_NAMESPACE@_SHARED_FORWARD_OPTION_PRINT -#endif -#else -#undef KWSYS_SHARED_FORWARD_OPTION_PRINT -#endif +# if defined(@KWSYS_NAMESPACE@_SHARED_FORWARD_OPTION_PRINT) +# if !defined(KWSYS_SHARED_FORWARD_OPTION_PRINT) +# define KWSYS_SHARED_FORWARD_OPTION_PRINT \ + @KWSYS_NAMESPACE@_SHARED_FORWARD_OPTION_PRINT +# endif +# else +# undef KWSYS_SHARED_FORWARD_OPTION_PRINT +# endif /* Create command line option to run ldd or equivalent. */ -#if defined(@KWSYS_NAMESPACE@_SHARED_FORWARD_OPTION_LDD) -#if !defined(KWSYS_SHARED_FORWARD_OPTION_LDD) -#define KWSYS_SHARED_FORWARD_OPTION_LDD \ - @KWSYS_NAMESPACE@_SHARED_FORWARD_OPTION_LDD -#endif -#else -#undef KWSYS_SHARED_FORWARD_OPTION_LDD -#endif +# if defined(@KWSYS_NAMESPACE@_SHARED_FORWARD_OPTION_LDD) +# if !defined(KWSYS_SHARED_FORWARD_OPTION_LDD) +# define KWSYS_SHARED_FORWARD_OPTION_LDD \ + @KWSYS_NAMESPACE@_SHARED_FORWARD_OPTION_LDD +# endif +# else +# undef KWSYS_SHARED_FORWARD_OPTION_LDD +# endif /* Include needed system headers. */ -#include <errno.h> -#include <limits.h> -#include <stddef.h> /* size_t */ -#include <stdio.h> -#include <stdlib.h> -#include <string.h> +# include <errno.h> +# include <limits.h> +# include <stddef.h> /* size_t */ +# include <stdio.h> +# include <stdlib.h> +# include <string.h> -#if defined(_WIN32) && !defined(__CYGWIN__) -#include <windows.h> +# if defined(_WIN32) && !defined(__CYGWIN__) +# include <windows.h> -#include <io.h> -#include <process.h> -#define KWSYS_SHARED_FORWARD_ESCAPE_ARGV /* re-escape argv for execvp */ -#else -#include <sys/stat.h> -#include <unistd.h> -#endif +# include <io.h> +# include <process.h> +# define KWSYS_SHARED_FORWARD_ESCAPE_ARGV /* re-escape argv for execvp */ +# else +# include <sys/stat.h> +# include <unistd.h> +# endif /* Configuration for this platform. */ /* The path separator for this platform. */ -#if defined(_WIN32) && !defined(__CYGWIN__) -#define KWSYS_SHARED_FORWARD_PATH_SEP ';' -#define KWSYS_SHARED_FORWARD_PATH_SLASH '\\' -#else -#define KWSYS_SHARED_FORWARD_PATH_SEP ':' -#define KWSYS_SHARED_FORWARD_PATH_SLASH '/' -#endif +# if defined(_WIN32) && !defined(__CYGWIN__) +# define KWSYS_SHARED_FORWARD_PATH_SEP ';' +# define KWSYS_SHARED_FORWARD_PATH_SLASH '\\' +# else +# define KWSYS_SHARED_FORWARD_PATH_SEP ':' +# define KWSYS_SHARED_FORWARD_PATH_SLASH '/' +# endif static const char kwsys_shared_forward_path_sep[2] = { KWSYS_SHARED_FORWARD_PATH_SEP, 0 }; @@ -195,99 +195,101 @@ static const char kwsys_shared_forward_path_slash[2] = { }; /* The maximum length of a file name. */ -#if defined(PATH_MAX) -#define KWSYS_SHARED_FORWARD_MAXPATH PATH_MAX -#elif defined(MAXPATHLEN) -#define KWSYS_SHARED_FORWARD_MAXPATH MAXPATHLEN -#else -#define KWSYS_SHARED_FORWARD_MAXPATH 16384 -#endif +# if defined(PATH_MAX) +# define KWSYS_SHARED_FORWARD_MAXPATH PATH_MAX +# elif defined(MAXPATHLEN) +# define KWSYS_SHARED_FORWARD_MAXPATH MAXPATHLEN +# else +# define KWSYS_SHARED_FORWARD_MAXPATH 16384 +# endif /* Select the environment variable holding the shared library runtime search path for this platform and build configuration. Also select ldd command equivalent. */ /* Linux */ -#if defined(__linux) -#define KWSYS_SHARED_FORWARD_LDD "ldd" -#define KWSYS_SHARED_FORWARD_LDD_N 1 -#define KWSYS_SHARED_FORWARD_LDPATH "LD_LIBRARY_PATH" +# if defined(__linux) +# define KWSYS_SHARED_FORWARD_LDD "ldd" +# define KWSYS_SHARED_FORWARD_LDD_N 1 +# define KWSYS_SHARED_FORWARD_LDPATH "LD_LIBRARY_PATH" /* FreeBSD */ -#elif defined(__FreeBSD__) -#define KWSYS_SHARED_FORWARD_LDD "ldd" -#define KWSYS_SHARED_FORWARD_LDD_N 1 -#define KWSYS_SHARED_FORWARD_LDPATH "LD_LIBRARY_PATH" +# elif defined(__FreeBSD__) +# define KWSYS_SHARED_FORWARD_LDD "ldd" +# define KWSYS_SHARED_FORWARD_LDD_N 1 +# define KWSYS_SHARED_FORWARD_LDPATH "LD_LIBRARY_PATH" /* OpenBSD */ -#elif defined(__OpenBSD__) -#define KWSYS_SHARED_FORWARD_LDD "ldd" -#define KWSYS_SHARED_FORWARD_LDD_N 1 -#define KWSYS_SHARED_FORWARD_LDPATH "LD_LIBRARY_PATH" +# elif defined(__OpenBSD__) +# define KWSYS_SHARED_FORWARD_LDD "ldd" +# define KWSYS_SHARED_FORWARD_LDD_N 1 +# define KWSYS_SHARED_FORWARD_LDPATH "LD_LIBRARY_PATH" /* OS X */ -#elif defined(__APPLE__) -#define KWSYS_SHARED_FORWARD_LDD "otool", "-L" -#define KWSYS_SHARED_FORWARD_LDD_N 2 -#define KWSYS_SHARED_FORWARD_LDPATH "DYLD_LIBRARY_PATH" +# elif defined(__APPLE__) +# define KWSYS_SHARED_FORWARD_LDD "otool", "-L" +# define KWSYS_SHARED_FORWARD_LDD_N 2 +# define KWSYS_SHARED_FORWARD_LDPATH "DYLD_LIBRARY_PATH" /* AIX */ -#elif defined(_AIX) -#define KWSYS_SHARED_FORWARD_LDD "dump", "-H" -#define KWSYS_SHARED_FORWARD_LDD_N 2 -#define KWSYS_SHARED_FORWARD_LDPATH "LIBPATH" +# elif defined(_AIX) +# define KWSYS_SHARED_FORWARD_LDD "dump", "-H" +# define KWSYS_SHARED_FORWARD_LDD_N 2 +# define KWSYS_SHARED_FORWARD_LDPATH "LIBPATH" /* SUN */ -#elif defined(__sun) -#define KWSYS_SHARED_FORWARD_LDD "ldd" -#define KWSYS_SHARED_FORWARD_LDD_N 1 -#include <sys/isa_defs.h> -#if defined(_ILP32) -#define KWSYS_SHARED_FORWARD_LDPATH "LD_LIBRARY_PATH" -#elif defined(_LP64) -#define KWSYS_SHARED_FORWARD_LDPATH "LD_LIBRARY_PATH_64" -#endif +# elif defined(__sun) +# define KWSYS_SHARED_FORWARD_LDD "ldd" +# define KWSYS_SHARED_FORWARD_LDD_N 1 +# include <sys/isa_defs.h> +# if defined(_ILP32) +# define KWSYS_SHARED_FORWARD_LDPATH "LD_LIBRARY_PATH" +# elif defined(_LP64) +# define KWSYS_SHARED_FORWARD_LDPATH "LD_LIBRARY_PATH_64" +# endif /* HP-UX */ -#elif defined(__hpux) -#define KWSYS_SHARED_FORWARD_LDD "chatr" -#define KWSYS_SHARED_FORWARD_LDD_N 1 -#if defined(__LP64__) -#define KWSYS_SHARED_FORWARD_LDPATH "LD_LIBRARY_PATH" -#else -#define KWSYS_SHARED_FORWARD_LDPATH "SHLIB_PATH" -#endif +# elif defined(__hpux) +# define KWSYS_SHARED_FORWARD_LDD "chatr" +# define KWSYS_SHARED_FORWARD_LDD_N 1 +# if defined(__LP64__) +# define KWSYS_SHARED_FORWARD_LDPATH "LD_LIBRARY_PATH" +# else +# define KWSYS_SHARED_FORWARD_LDPATH "SHLIB_PATH" +# endif /* SGI MIPS */ -#elif defined(__sgi) && defined(_MIPS_SIM) -#define KWSYS_SHARED_FORWARD_LDD "ldd" -#define KWSYS_SHARED_FORWARD_LDD_N 1 -#if _MIPS_SIM == _ABIO32 -#define KWSYS_SHARED_FORWARD_LDPATH "LD_LIBRARY_PATH" -#elif _MIPS_SIM == _ABIN32 -#define KWSYS_SHARED_FORWARD_LDPATH "LD_LIBRARYN32_PATH" -#elif _MIPS_SIM == _ABI64 -#define KWSYS_SHARED_FORWARD_LDPATH "LD_LIBRARY64_PATH" -#endif +# elif defined(__sgi) && defined(_MIPS_SIM) +# define KWSYS_SHARED_FORWARD_LDD "ldd" +# define KWSYS_SHARED_FORWARD_LDD_N 1 +# if _MIPS_SIM == _ABIO32 +# define KWSYS_SHARED_FORWARD_LDPATH "LD_LIBRARY_PATH" +# elif _MIPS_SIM == _ABIN32 +# define KWSYS_SHARED_FORWARD_LDPATH "LD_LIBRARYN32_PATH" +# elif _MIPS_SIM == _ABI64 +# define KWSYS_SHARED_FORWARD_LDPATH "LD_LIBRARY64_PATH" +# endif /* Cygwin */ -#elif defined(__CYGWIN__) -#define KWSYS_SHARED_FORWARD_LDD "cygcheck" /* TODO: cygwin 1.7 has ldd */ -#define KWSYS_SHARED_FORWARD_LDD_N 1 -#define KWSYS_SHARED_FORWARD_LDPATH "PATH" +# elif defined(__CYGWIN__) +# define KWSYS_SHARED_FORWARD_LDD \ + "cygcheck" /* TODO: cygwin 1.7 has ldd \ + */ +# define KWSYS_SHARED_FORWARD_LDD_N 1 +# define KWSYS_SHARED_FORWARD_LDPATH "PATH" /* Windows */ -#elif defined(_WIN32) -#define KWSYS_SHARED_FORWARD_LDPATH "PATH" +# elif defined(_WIN32) +# define KWSYS_SHARED_FORWARD_LDPATH "PATH" /* Guess on this unknown system. */ -#else -#define KWSYS_SHARED_FORWARD_LDD "ldd" -#define KWSYS_SHARED_FORWARD_LDD_N 1 -#define KWSYS_SHARED_FORWARD_LDPATH "LD_LIBRARY_PATH" -#endif +# else +# define KWSYS_SHARED_FORWARD_LDD "ldd" +# define KWSYS_SHARED_FORWARD_LDD_N 1 +# define KWSYS_SHARED_FORWARD_LDPATH "LD_LIBRARY_PATH" +# endif -#ifdef KWSYS_SHARED_FORWARD_ESCAPE_ARGV +# ifdef KWSYS_SHARED_FORWARD_ESCAPE_ARGV typedef struct kwsys_sf_arg_info_s { const char* arg; @@ -404,25 +406,25 @@ static char* kwsys_sf_get_arg(kwsys_sf_arg_info info, char* out) return out; } -#endif +# endif /* Function to convert a logical or relative path to a physical full path. */ static int kwsys_shared_forward_realpath(const char* in_path, char* out_path) { -#if defined(_WIN32) && !defined(__CYGWIN__) +# if defined(_WIN32) && !defined(__CYGWIN__) /* Implementation for Windows. */ DWORD n = GetFullPathNameA(in_path, KWSYS_SHARED_FORWARD_MAXPATH, out_path, 0); return n > 0 && n <= KWSYS_SHARED_FORWARD_MAXPATH; -#else +# else /* Implementation for UNIX. */ return realpath(in_path, out_path) != 0; -#endif +# endif } static int kwsys_shared_forward_samepath(const char* file1, const char* file2) { -#if defined(_WIN32) +# if defined(_WIN32) int result = 0; HANDLE h1 = CreateFileA(file1, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL); @@ -440,19 +442,19 @@ static int kwsys_shared_forward_samepath(const char* file1, const char* file2) CloseHandle(h1); CloseHandle(h2); return result; -#else +# else struct stat fs1, fs2; return (stat(file1, &fs1) == 0 && stat(file2, &fs2) == 0 && memcmp(&fs2.st_dev, &fs1.st_dev, sizeof(fs1.st_dev)) == 0 && memcmp(&fs2.st_ino, &fs1.st_ino, sizeof(fs1.st_ino)) == 0 && fs2.st_size == fs1.st_size); -#endif +# endif } /* Function to report a system error message. */ static void kwsys_shared_forward_strerror(char* message) { -#if defined(_WIN32) && !defined(__CYGWIN__) +# if defined(_WIN32) && !defined(__CYGWIN__) /* Implementation for Windows. */ DWORD original = GetLastError(); DWORD length = @@ -465,17 +467,17 @@ static void kwsys_shared_forward_strerror(char* message) "Error 0x%X (FormatMessage failed with error 0x%X)", original, GetLastError()); } -#else +# else /* Implementation for UNIX. */ strcpy(message, strerror(errno)); -#endif +# endif } /* Functions to execute a child process. */ static void kwsys_shared_forward_execvp(const char* cmd, char const* const* argv) { -#ifdef KWSYS_SHARED_FORWARD_ESCAPE_ARGV +# ifdef KWSYS_SHARED_FORWARD_ESCAPE_ARGV /* Count the number of arguments. */ int argc = 0; { @@ -498,16 +500,16 @@ static void kwsys_shared_forward_execvp(const char* cmd, /* Replace the command line to be used. */ argv = (char const* const*)nargv; } -#endif +# endif /* Invoke the child process. */ -#if defined(_MSC_VER) +# if defined(_MSC_VER) _execvp(cmd, argv); -#elif defined(__MINGW32__) && !defined(__MINGW64__) +# elif defined(__MINGW32__) && !defined(__MINGW64__) execvp(cmd, argv); -#else +# else execvp(cmd, (char* const*)argv); -#endif +# endif } /* Function to get the directory containing the given file or directory. */ @@ -530,14 +532,14 @@ static void kwsys_shared_forward_dirname(const char* begin, char* result) /* Only one leading slash. */ strcpy(result, kwsys_shared_forward_path_slash); } -#if defined(_WIN32) +# if defined(_WIN32) else if (last_slash_index == 2 && begin[1] == ':') { /* Only one leading drive letter and slash. */ strncpy(result, begin, (size_t)last_slash_index); result[last_slash_index] = KWSYS_SHARED_FORWARD_PATH_SLASH; result[last_slash_index + 1] = 0; } -#endif +# endif else { /* A non-leading slash. */ strncpy(result, begin, (size_t)last_slash_index); @@ -548,16 +550,16 @@ static void kwsys_shared_forward_dirname(const char* begin, char* result) /* Function to check if a file exists and is executable. */ static int kwsys_shared_forward_is_executable(const char* f) { -#if defined(_MSC_VER) -#define KWSYS_SHARED_FORWARD_ACCESS _access -#else -#define KWSYS_SHARED_FORWARD_ACCESS access -#endif -#if defined(X_OK) -#define KWSYS_SHARED_FORWARD_ACCESS_OK X_OK -#else -#define KWSYS_SHARED_FORWARD_ACCESS_OK 04 -#endif +# if defined(_MSC_VER) +# define KWSYS_SHARED_FORWARD_ACCESS _access +# else +# define KWSYS_SHARED_FORWARD_ACCESS access +# endif +# if defined(X_OK) +# define KWSYS_SHARED_FORWARD_ACCESS_OK X_OK +# else +# define KWSYS_SHARED_FORWARD_ACCESS_OK 04 +# endif if (KWSYS_SHARED_FORWARD_ACCESS(f, KWSYS_SHARED_FORWARD_ACCESS_OK) == 0) { return 1; } else { @@ -641,12 +643,12 @@ static int kwsys_shared_forward_fullpath(const char* self_path, /* Already a full path. */ strcpy(result, in_path); } -#if defined(_WIN32) +# if defined(_WIN32) else if (in_path[0] && in_path[1] == ':') { /* Already a full path. */ strcpy(result, in_path); } -#endif +# endif else { /* Relative to self path. */ char temp_path[KWSYS_SHARED_FORWARD_MAXPATH]; @@ -683,14 +685,14 @@ static int kwsys_shared_forward_get_settings(const char* self_path, const char* exe_path; /* Get the real name of the build and self paths. */ -#if defined(KWSYS_SHARED_FORWARD_CONFIG_NAME) +# if defined(KWSYS_SHARED_FORWARD_CONFIG_NAME) char build_path[] = KWSYS_SHARED_FORWARD_DIR_BUILD "/" KWSYS_SHARED_FORWARD_CONFIG_NAME; char self_path_logical[KWSYS_SHARED_FORWARD_MAXPATH]; -#else +# else char build_path[] = KWSYS_SHARED_FORWARD_DIR_BUILD; const char* self_path_logical = self_path; -#endif +# endif char build_path_real[KWSYS_SHARED_FORWARD_MAXPATH]; char self_path_real[KWSYS_SHARED_FORWARD_MAXPATH]; if (!kwsys_shared_forward_realpath(self_path, self_path_real)) { @@ -706,29 +708,29 @@ static int kwsys_shared_forward_get_settings(const char* self_path, kwsys_shared_forward_samepath(self_path_real, build_path_real)) { /* Running in build tree. Use the build path and exe. */ search_path = search_path_build; -#if defined(_WIN32) +# if defined(_WIN32) exe_path = KWSYS_SHARED_FORWARD_EXE_BUILD ".exe"; -#else +# else exe_path = KWSYS_SHARED_FORWARD_EXE_BUILD; -#endif +# endif -#if defined(KWSYS_SHARED_FORWARD_CONFIG_NAME) +# if defined(KWSYS_SHARED_FORWARD_CONFIG_NAME) /* Remove the configuration directory from self_path. */ kwsys_shared_forward_dirname(self_path, self_path_logical); -#endif +# endif } else { /* Running in install tree. Use the install path and exe. */ search_path = search_path_install; -#if defined(_WIN32) +# if defined(_WIN32) exe_path = KWSYS_SHARED_FORWARD_EXE_INSTALL ".exe"; -#else +# else exe_path = KWSYS_SHARED_FORWARD_EXE_INSTALL; -#endif +# endif -#if defined(KWSYS_SHARED_FORWARD_CONFIG_NAME) +# if defined(KWSYS_SHARED_FORWARD_CONFIG_NAME) /* Use the original self path directory. */ strcpy(self_path_logical, self_path); -#endif +# endif } /* Construct the runtime search path. */ @@ -795,7 +797,7 @@ static int @KWSYS_NAMESPACE@_shared_forward_to_real(int argc, char** argv_in) /* Store the environment variable. */ putenv(kwsys_shared_forward_ldpath); -#if defined(KWSYS_SHARED_FORWARD_OPTION_COMMAND) +# if defined(KWSYS_SHARED_FORWARD_OPTION_COMMAND) /* Look for the command line replacement option. */ if (argc > 1 && strcmp(argv[1], KWSYS_SHARED_FORWARD_OPTION_COMMAND) == 0) { @@ -806,14 +808,15 @@ static int @KWSYS_NAMESPACE@_shared_forward_to_real(int argc, char** argv_in) argc -= 2; } else { /* The option was not given an executable. */ - fprintf(stderr, "Option " KWSYS_SHARED_FORWARD_OPTION_COMMAND - " must be followed by a command line.\n"); + fprintf(stderr, + "Option " KWSYS_SHARED_FORWARD_OPTION_COMMAND + " must be followed by a command line.\n"); return 1; } } -#endif +# endif -#if defined(KWSYS_SHARED_FORWARD_OPTION_PRINT) +# if defined(KWSYS_SHARED_FORWARD_OPTION_PRINT) /* Look for the print command line option. */ if (argc > 1 && strcmp(argv[1], KWSYS_SHARED_FORWARD_OPTION_PRINT) == 0) { @@ -821,12 +824,12 @@ static int @KWSYS_NAMESPACE@_shared_forward_to_real(int argc, char** argv_in) fprintf(stdout, "%s\n", exe); return 0; } -#endif +# endif -#if defined(KWSYS_SHARED_FORWARD_OPTION_LDD) +# if defined(KWSYS_SHARED_FORWARD_OPTION_LDD) /* Look for the ldd command line option. */ if (argc > 1 && strcmp(argv[1], KWSYS_SHARED_FORWARD_OPTION_LDD) == 0) { -#if defined(KWSYS_SHARED_FORWARD_LDD) +# if defined(KWSYS_SHARED_FORWARD_LDD) /* Use the named ldd-like executable and arguments. */ char const* ldd_argv[] = { KWSYS_SHARED_FORWARD_LDD, 0, 0 }; ldd_argv[KWSYS_SHARED_FORWARD_LDD_N] = exe; @@ -835,13 +838,13 @@ static int @KWSYS_NAMESPACE@_shared_forward_to_real(int argc, char** argv_in) /* Report why execution failed. */ kwsys_shared_forward_print_failure(ldd_argv); return 1; -#else +# else /* We have no ldd-like executable available on this platform. */ fprintf(stderr, "No ldd-like tool is known to this executable.\n"); return 1; -#endif +# endif } -#endif +# endif /* Replace this process with the real executable. */ argv[0] = exe; @@ -865,12 +868,12 @@ static int @KWSYS_NAMESPACE@_shared_forward_to_real(int argc, char** argv_in) } /* Restore warning stack. */ -#if defined(__clang__) && defined(__has_warning) -#if __has_warning("-Wcast-qual") -#pragma clang diagnostic pop -#endif -#endif +# if defined(__clang__) && defined(__has_warning) +# if __has_warning("-Wcast-qual") +# pragma clang diagnostic pop +# endif +# endif #else -#error "@KWSYS_NAMESPACE@/SharedForward.h should be included only once." +# error "@KWSYS_NAMESPACE@/SharedForward.h should be included only once." #endif diff --git a/Source/kwsys/String.c b/Source/kwsys/String.c index 048222968c..daf7ad1a0f 100644 --- a/Source/kwsys/String.c +++ b/Source/kwsys/String.c @@ -8,23 +8,23 @@ directory that use the stl string cause the compiler to load this source to try to get the definition of the string template. This condition blocks the compiler from seeing the symbols defined here. */ -#include "kwsysPrivate.h" -#include KWSYS_HEADER(String.h) +# include "kwsysPrivate.h" +# include KWSYS_HEADER(String.h) /* Work-around CMake dependency scanning limitation. This must duplicate the above list of headers. */ -#if 0 -#include "String.h.in" -#endif +# if 0 +# include "String.h.in" +# endif /* Select an implementation for strcasecmp. */ -#if defined(_MSC_VER) -#define KWSYS_STRING_USE_STRICMP -#include <string.h> -#elif defined(__GNUC__) -#define KWSYS_STRING_USE_STRCASECMP -#include <strings.h> -#else +# if defined(_MSC_VER) +# define KWSYS_STRING_USE_STRICMP +# include <string.h> +# elif defined(__GNUC__) +# define KWSYS_STRING_USE_STRCASECMP +# include <strings.h> +# else /* Table to convert upper case letters to lower case and leave all other characters alone. */ static char kwsysString_strcasecmp_tolower[] = { @@ -58,16 +58,16 @@ static char kwsysString_strcasecmp_tolower[] = { '\363', '\364', '\365', '\366', '\367', '\370', '\371', '\372', '\373', '\374', '\375', '\376', '\377' }; -#endif +# endif /*--------------------------------------------------------------------------*/ int kwsysString_strcasecmp(const char* lhs, const char* rhs) { -#if defined(KWSYS_STRING_USE_STRICMP) +# if defined(KWSYS_STRING_USE_STRICMP) return _stricmp(lhs, rhs); -#elif defined(KWSYS_STRING_USE_STRCASECMP) +# elif defined(KWSYS_STRING_USE_STRCASECMP) return strcasecmp(lhs, rhs); -#else +# else const char* const lower = kwsysString_strcasecmp_tolower; unsigned char const* us1 = (unsigned char const*)lhs; unsigned char const* us2 = (unsigned char const*)rhs; @@ -75,17 +75,17 @@ int kwsysString_strcasecmp(const char* lhs, const char* rhs) while ((result = lower[*us1] - lower[*us2++], result == 0) && *us1++) { } return result; -#endif +# endif } /*--------------------------------------------------------------------------*/ int kwsysString_strncasecmp(const char* lhs, const char* rhs, size_t n) { -#if defined(KWSYS_STRING_USE_STRICMP) +# if defined(KWSYS_STRING_USE_STRICMP) return _strnicmp(lhs, rhs, n); -#elif defined(KWSYS_STRING_USE_STRCASECMP) +# elif defined(KWSYS_STRING_USE_STRCASECMP) return strncasecmp(lhs, rhs, n); -#else +# else const char* const lower = kwsysString_strcasecmp_tolower; unsigned char const* us1 = (unsigned char const*)lhs; unsigned char const* us2 = (unsigned char const*)rhs; @@ -94,7 +94,7 @@ int kwsysString_strncasecmp(const char* lhs, const char* rhs, size_t n) --n; } return result; -#endif +# endif } #endif /* KWSYS_STRING_C */ diff --git a/Source/kwsys/String.h.in b/Source/kwsys/String.h.in index 3c1d571c00..7c9348af13 100644 --- a/Source/kwsys/String.h.in +++ b/Source/kwsys/String.h.in @@ -12,12 +12,12 @@ not visible to user code. Use kwsysHeaderDump.pl to reproduce these macros after making changes to the interface. */ #if !defined(KWSYS_NAMESPACE) -#define kwsys_ns(x) @KWSYS_NAMESPACE@##x -#define kwsysEXPORT @KWSYS_NAMESPACE@_EXPORT +# define kwsys_ns(x) @KWSYS_NAMESPACE@##x +# define kwsysEXPORT @KWSYS_NAMESPACE@_EXPORT #endif #if !@KWSYS_NAMESPACE@_NAME_IS_KWSYS -#define kwsysString_strcasecmp kwsys_ns(String_strcasecmp) -#define kwsysString_strncasecmp kwsys_ns(String_strncasecmp) +# define kwsysString_strcasecmp kwsys_ns(String_strcasecmp) +# define kwsysString_strncasecmp kwsys_ns(String_strncasecmp) #endif #if defined(__cplusplus) @@ -46,12 +46,12 @@ kwsysEXPORT int kwsysString_strncasecmp(const char* lhs, const char* rhs, /* If we are building a kwsys .c or .cxx file, let it use these macros. Otherwise, undefine them to keep the namespace clean. */ #if !defined(KWSYS_NAMESPACE) -#undef kwsys_ns -#undef kwsysEXPORT -#if !@KWSYS_NAMESPACE@_NAME_IS_KWSYS -#undef kwsysString_strcasecmp -#undef kwsysString_strncasecmp -#endif +# undef kwsys_ns +# undef kwsysEXPORT +# if !@KWSYS_NAMESPACE@_NAME_IS_KWSYS +# undef kwsysString_strcasecmp +# undef kwsysString_strncasecmp +# endif #endif #endif diff --git a/Source/kwsys/System.c b/Source/kwsys/System.c index b9af8e9d9e..d43cc6fbbc 100644 --- a/Source/kwsys/System.c +++ b/Source/kwsys/System.c @@ -6,7 +6,7 @@ /* Work-around CMake dependency scanning limitation. This must duplicate the above list of headers. */ #if 0 -#include "System.h.in" +# include "System.h.in" #endif #include <ctype.h> /* isspace */ diff --git a/Source/kwsys/System.h.in b/Source/kwsys/System.h.in index 102974db7a..a9d4f5e690 100644 --- a/Source/kwsys/System.h.in +++ b/Source/kwsys/System.h.in @@ -10,11 +10,12 @@ not visible to user code. Use kwsysHeaderDump.pl to reproduce these macros after making changes to the interface. */ #if !defined(KWSYS_NAMESPACE) -#define kwsys_ns(x) @KWSYS_NAMESPACE@##x -#define kwsysEXPORT @KWSYS_NAMESPACE@_EXPORT +# define kwsys_ns(x) @KWSYS_NAMESPACE@##x +# define kwsysEXPORT @KWSYS_NAMESPACE@_EXPORT #endif #if !@KWSYS_NAMESPACE@_NAME_IS_KWSYS -#define kwsysSystem_Parse_CommandForUnix kwsys_ns(System_Parse_CommandForUnix) +# define kwsysSystem_Parse_CommandForUnix \ + kwsys_ns(System_Parse_CommandForUnix) #endif #if defined(__cplusplus) @@ -49,11 +50,11 @@ kwsysEXPORT char** kwsysSystem_Parse_CommandForUnix(const char* command, /* If we are building a kwsys .c or .cxx file, let it use these macros. Otherwise, undefine them to keep the namespace clean. */ #if !defined(KWSYS_NAMESPACE) -#undef kwsys_ns -#undef kwsysEXPORT -#if !defined(KWSYS_NAMESPACE) && !@KWSYS_NAMESPACE@_NAME_IS_KWSYS -#undef kwsysSystem_Parse_CommandForUnix -#endif +# undef kwsys_ns +# undef kwsysEXPORT +# if !defined(KWSYS_NAMESPACE) && !@KWSYS_NAMESPACE@_NAME_IS_KWSYS +# undef kwsysSystem_Parse_CommandForUnix +# endif #endif #endif diff --git a/Source/kwsys/SystemInformation.cxx b/Source/kwsys/SystemInformation.cxx index 37dec13eec..cfe62b4b41 100644 --- a/Source/kwsys/SystemInformation.cxx +++ b/Source/kwsys/SystemInformation.cxx @@ -1,15 +1,15 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing#kwsys for details. */ #if defined(_WIN32) -#define NOMINMAX // use our min,max -#if !defined(_WIN32_WINNT) && !(defined(_MSC_VER) && _MSC_VER < 1300) -#define _WIN32_WINNT 0x0501 -#endif -#include <winsock.h> // WSADATA, include before sys/types.h +# define NOMINMAX // use our min,max +# if !defined(_WIN32_WINNT) && !(defined(_MSC_VER) && _MSC_VER < 1300) +# define _WIN32_WINNT 0x0501 +# endif +# include <winsock.h> // WSADATA, include before sys/types.h #endif #if (defined(__GNUC__) || defined(__PGI)) && !defined(_GNU_SOURCE) -#define _GNU_SOURCE +# define _GNU_SOURCE #endif // TODO: @@ -31,8 +31,8 @@ // Work-around CMake dependency scanning limitation. This must // duplicate the above list of headers. #if 0 -#include "Process.h.in" -#include "SystemInformation.hxx.in" +# include "Process.h.in" +# include "SystemInformation.hxx.in" #endif #include <algorithm> @@ -47,116 +47,116 @@ #include <vector> #if defined(_WIN32) -#include <windows.h> -#if defined(_MSC_VER) && _MSC_VER >= 1800 -#define KWSYS_WINDOWS_DEPRECATED_GetVersionEx -#endif -#include <errno.h> -#if defined(KWSYS_SYS_HAS_PSAPI) -#include <psapi.h> -#endif -#if !defined(siginfo_t) +# include <windows.h> +# if defined(_MSC_VER) && _MSC_VER >= 1800 +# define KWSYS_WINDOWS_DEPRECATED_GetVersionEx +# endif +# include <errno.h> +# if defined(KWSYS_SYS_HAS_PSAPI) +# include <psapi.h> +# endif +# if !defined(siginfo_t) typedef int siginfo_t; -#endif +# endif #else -#include <sys/types.h> - -#include <errno.h> // extern int errno; -#include <fcntl.h> -#include <signal.h> -#include <sys/resource.h> // getrlimit -#include <sys/time.h> -#include <sys/utsname.h> // int uname(struct utsname *buf); -#include <unistd.h> +# include <sys/types.h> + +# include <errno.h> // extern int errno; +# include <fcntl.h> +# include <signal.h> +# include <sys/resource.h> // getrlimit +# include <sys/time.h> +# include <sys/utsname.h> // int uname(struct utsname *buf); +# include <unistd.h> #endif #if defined(__CYGWIN__) && !defined(_WIN32) -#include <windows.h> -#undef _WIN32 +# include <windows.h> +# undef _WIN32 #endif #if defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__NetBSD__) || \ defined(__DragonFly__) -#include <netdb.h> -#include <netinet/in.h> -#include <sys/param.h> -#include <sys/socket.h> -#include <sys/sysctl.h> -#if defined(KWSYS_SYS_HAS_IFADDRS_H) -#include <ifaddrs.h> -#include <net/if.h> -#define KWSYS_SYSTEMINFORMATION_IMPLEMENT_FQDN -#endif +# include <netdb.h> +# include <netinet/in.h> +# include <sys/param.h> +# include <sys/socket.h> +# include <sys/sysctl.h> +# if defined(KWSYS_SYS_HAS_IFADDRS_H) +# include <ifaddrs.h> +# include <net/if.h> +# define KWSYS_SYSTEMINFORMATION_IMPLEMENT_FQDN +# endif #endif #if defined(KWSYS_SYS_HAS_MACHINE_CPU_H) -#include <machine/cpu.h> +# include <machine/cpu.h> #endif #ifdef __APPLE__ -#include <mach/host_info.h> -#include <mach/mach.h> -#include <mach/mach_types.h> -#include <mach/vm_statistics.h> -#include <netdb.h> -#include <netinet/in.h> -#include <sys/socket.h> -#include <sys/sysctl.h> -#if defined(KWSYS_SYS_HAS_IFADDRS_H) -#include <ifaddrs.h> -#include <net/if.h> -#define KWSYS_SYSTEMINFORMATION_IMPLEMENT_FQDN -#endif -#if !(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ - 0 >= 1050) -#undef KWSYS_SYSTEMINFORMATION_HAS_BACKTRACE -#endif +# include <mach/host_info.h> +# include <mach/mach.h> +# include <mach/mach_types.h> +# include <mach/vm_statistics.h> +# include <netdb.h> +# include <netinet/in.h> +# include <sys/socket.h> +# include <sys/sysctl.h> +# if defined(KWSYS_SYS_HAS_IFADDRS_H) +# include <ifaddrs.h> +# include <net/if.h> +# define KWSYS_SYSTEMINFORMATION_IMPLEMENT_FQDN +# endif +# if !(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ - 0 >= 1050) +# undef KWSYS_SYSTEMINFORMATION_HAS_BACKTRACE +# endif #endif #if defined(__linux) || defined(__sun) || defined(_SCO_DS) -#include <netdb.h> -#include <netinet/in.h> -#include <sys/socket.h> -#if defined(KWSYS_SYS_HAS_IFADDRS_H) -#include <ifaddrs.h> -#include <net/if.h> -#if defined(__LSB_VERSION__) +# include <netdb.h> +# include <netinet/in.h> +# include <sys/socket.h> +# if defined(KWSYS_SYS_HAS_IFADDRS_H) +# include <ifaddrs.h> +# include <net/if.h> +# if defined(__LSB_VERSION__) /* LSB has no getifaddrs */ -#elif defined(__ANDROID_API__) && __ANDROID_API__ < 24 +# elif defined(__ANDROID_API__) && __ANDROID_API__ < 24 /* Android has no getifaddrs prior to API 24. */ -#else -#define KWSYS_SYSTEMINFORMATION_IMPLEMENT_FQDN -#endif -#endif -#if defined(KWSYS_CXX_HAS_RLIMIT64) +# else +# define KWSYS_SYSTEMINFORMATION_IMPLEMENT_FQDN +# endif +# endif +# if defined(KWSYS_CXX_HAS_RLIMIT64) typedef struct rlimit64 ResourceLimitType; -#define GetResourceLimit getrlimit64 -#else +# define GetResourceLimit getrlimit64 +# else typedef struct rlimit ResourceLimitType; -#define GetResourceLimit getrlimit -#endif +# define GetResourceLimit getrlimit +# endif #elif defined(__hpux) -#include <sys/param.h> -#include <sys/pstat.h> -#if defined(KWSYS_SYS_HAS_MPCTL_H) -#include <sys/mpctl.h> -#endif +# include <sys/param.h> +# include <sys/pstat.h> +# if defined(KWSYS_SYS_HAS_MPCTL_H) +# include <sys/mpctl.h> +# endif #endif #ifdef __HAIKU__ -#include <OS.h> +# include <OS.h> #endif #if defined(KWSYS_SYSTEMINFORMATION_HAS_BACKTRACE) -#include <execinfo.h> -#if defined(KWSYS_SYSTEMINFORMATION_HAS_CPP_DEMANGLE) -#include <cxxabi.h> -#endif -#if defined(KWSYS_SYSTEMINFORMATION_HAS_SYMBOL_LOOKUP) -#include <dlfcn.h> -#endif +# include <execinfo.h> +# if defined(KWSYS_SYSTEMINFORMATION_HAS_CPP_DEMANGLE) +# include <cxxabi.h> +# endif +# if defined(KWSYS_SYSTEMINFORMATION_HAS_SYMBOL_LOOKUP) +# include <dlfcn.h> +# endif #else -#undef KWSYS_SYSTEMINFORMATION_HAS_CPP_DEMANGLE -#undef KWSYS_SYSTEMINFORMATION_HAS_SYMBOL_LOOKUP +# undef KWSYS_SYSTEMINFORMATION_HAS_CPP_DEMANGLE +# undef KWSYS_SYSTEMINFORMATION_HAS_SYMBOL_LOOKUP #endif #include <ctype.h> // int isdigit(int c); @@ -166,57 +166,57 @@ typedef struct rlimit ResourceLimitType; #include <string.h> #if defined(KWSYS_USE_LONG_LONG) -#if defined(KWSYS_IOS_HAS_OSTREAM_LONG_LONG) -#define iostreamLongLong(x) (x) -#else -#define iostreamLongLong(x) ((long)(x)) -#endif +# if defined(KWSYS_IOS_HAS_OSTREAM_LONG_LONG) +# define iostreamLongLong(x) (x) +# else +# define iostreamLongLong(x) ((long)(x)) +# endif #elif defined(KWSYS_USE___INT64) -#if defined(KWSYS_IOS_HAS_OSTREAM___INT64) -#define iostreamLongLong(x) (x) +# if defined(KWSYS_IOS_HAS_OSTREAM___INT64) +# define iostreamLongLong(x) (x) +# else +# define iostreamLongLong(x) ((long)(x)) +# endif #else -#define iostreamLongLong(x) ((long)(x)) -#endif -#else -#error "No Long Long" +# error "No Long Long" #endif #if defined(KWSYS_CXX_HAS_ATOLL) -#define atoLongLong atoll -#else -#if defined(KWSYS_CXX_HAS__ATOI64) -#define atoLongLong _atoi64 -#elif defined(KWSYS_CXX_HAS_ATOL) -#define atoLongLong atol +# define atoLongLong atoll #else -#define atoLongLong atoi -#endif +# if defined(KWSYS_CXX_HAS__ATOI64) +# define atoLongLong _atoi64 +# elif defined(KWSYS_CXX_HAS_ATOL) +# define atoLongLong atol +# else +# define atoLongLong atoi +# endif #endif #if defined(_MSC_VER) && (_MSC_VER >= 1300) && !defined(_WIN64) && \ !defined(__clang__) -#define USE_ASM_INSTRUCTIONS 1 +# define USE_ASM_INSTRUCTIONS 1 #else -#define USE_ASM_INSTRUCTIONS 0 +# define USE_ASM_INSTRUCTIONS 0 #endif #if defined(_MSC_VER) && (_MSC_VER >= 1400) && !defined(__clang__) -#include <intrin.h> -#define USE_CPUID_INTRINSICS 1 +# include <intrin.h> +# define USE_CPUID_INTRINSICS 1 #else -#define USE_CPUID_INTRINSICS 0 +# define USE_CPUID_INTRINSICS 0 #endif #if USE_ASM_INSTRUCTIONS || USE_CPUID_INTRINSICS || \ defined(KWSYS_CXX_HAS_BORLAND_ASM_CPUID) -#define USE_CPUID 1 +# define USE_CPUID 1 #else -#define USE_CPUID 0 +# define USE_CPUID 0 #endif #if USE_CPUID -#define CPUID_AWARE_COMPILER +# define CPUID_AWARE_COMPILER /** * call CPUID instruction @@ -225,16 +225,16 @@ typedef struct rlimit ResourceLimitType; */ static bool call_cpuid(int select, int result[4]) { -#if USE_CPUID_INTRINSICS +# if USE_CPUID_INTRINSICS __cpuid(result, select); return true; -#else +# else int tmp[4]; -#if defined(_MSC_VER) +# if defined(_MSC_VER) // Use SEH to determine CPUID presence __try { _asm { -#ifdef CPUID_AWARE_COMPILER +# ifdef CPUID_AWARE_COMPILER ; we must push/pop the registers <<CPUID>> writes to, as the ; optimiser does not know about <<CPUID>>, and so does not expect ; these registers to change. @@ -242,33 +242,33 @@ static bool call_cpuid(int select, int result[4]) push ebx push ecx push edx -#endif +# endif ; <<CPUID>> mov eax, select -#ifdef CPUID_AWARE_COMPILER +# ifdef CPUID_AWARE_COMPILER cpuid -#else +# else _asm _emit 0x0f _asm _emit 0xa2 -#endif +# endif mov tmp[0 * TYPE int], eax mov tmp[1 * TYPE int], ebx mov tmp[2 * TYPE int], ecx mov tmp[3 * TYPE int], edx -#ifdef CPUID_AWARE_COMPILER +# ifdef CPUID_AWARE_COMPILER pop edx pop ecx pop ebx pop eax -#endif +# endif } } __except (1) { return false; } memcpy(result, tmp, sizeof(tmp)); -#elif defined(KWSYS_CXX_HAS_BORLAND_ASM_CPUID) +# elif defined(KWSYS_CXX_HAS_BORLAND_ASM_CPUID) unsigned int a, b, c, d; __asm { mov EAX, select; @@ -283,11 +283,11 @@ static bool call_cpuid(int select, int result[4]) result[1] = b; result[2] = c; result[3] = d; -#endif +# endif // The cpuid instruction succeeded. return true; -#endif +# endif } #endif @@ -904,7 +904,7 @@ int LoadLines(FILE* file, std::vector<std::string>& lines) return nRead; } -#if defined(__linux) +# if defined(__linux) // ***************************************************************************** int LoadLines(const char* fileName, std::vector<std::string>& lines) { @@ -916,7 +916,7 @@ int LoadLines(const char* fileName, std::vector<std::string>& lines) fclose(file); return nRead; } -#endif +# endif // **************************************************************************** template <typename T> @@ -1005,7 +1005,7 @@ int GetFieldsFromCommand(const char* command, const char** fieldNames, void StacktraceSignalHandler(int sigNo, siginfo_t* sigInfo, void* /*sigContext*/) { -#if defined(__linux) || defined(__APPLE__) +# if defined(__linux) || defined(__APPLE__) std::ostringstream oss; oss << std::endl << "=========================================================" @@ -1029,17 +1029,17 @@ void StacktraceSignalHandler(int sigNo, siginfo_t* sigInfo, << (sigInfo->si_addr == KWSYS_NULLPTR ? "0x" : "") << sigInfo->si_addr << " "; switch (sigInfo->si_code) { -#if defined(FPE_INTDIV) +# if defined(FPE_INTDIV) case FPE_INTDIV: oss << "integer division by zero"; break; -#endif +# endif -#if defined(FPE_INTOVF) +# if defined(FPE_INTOVF) case FPE_INTOVF: oss << "integer overflow"; break; -#endif +# endif case FPE_FLTDIV: oss << "floating point divide by zero"; @@ -1061,11 +1061,11 @@ void StacktraceSignalHandler(int sigNo, siginfo_t* sigInfo, oss << "floating point invalid operation"; break; -#if defined(FPE_FLTSUB) +# if defined(FPE_FLTSUB) case FPE_FLTSUB: oss << "floating point subscript out of range"; break; -#endif +# endif default: oss << "code " << sigInfo->si_code; @@ -1101,31 +1101,31 @@ void StacktraceSignalHandler(int sigNo, siginfo_t* sigInfo, oss << "invalid address alignment"; break; -#if defined(BUS_ADRERR) +# if defined(BUS_ADRERR) case BUS_ADRERR: oss << "nonexistent physical address"; break; -#endif +# endif -#if defined(BUS_OBJERR) +# if defined(BUS_OBJERR) case BUS_OBJERR: oss << "object-specific hardware error"; break; -#endif +# endif -#if defined(BUS_MCEERR_AR) +# if defined(BUS_MCEERR_AR) case BUS_MCEERR_AR: oss << "Hardware memory error consumed on a machine check; action " "required."; break; -#endif +# endif -#if defined(BUS_MCEERR_AO) +# if defined(BUS_MCEERR_AO) case BUS_MCEERR_AO: oss << "Hardware memory error detected in process but not consumed; " "action optional."; break; -#endif +# endif default: oss << "code " << sigInfo->si_code; @@ -1142,17 +1142,17 @@ void StacktraceSignalHandler(int sigNo, siginfo_t* sigInfo, oss << "illegal opcode"; break; -#if defined(ILL_ILLOPN) +# if defined(ILL_ILLOPN) case ILL_ILLOPN: oss << "illegal operand"; break; -#endif +# endif -#if defined(ILL_ILLADR) +# if defined(ILL_ILLADR) case ILL_ILLADR: oss << "illegal addressing mode."; break; -#endif +# endif case ILL_ILLTRP: oss << "illegal trap"; @@ -1162,23 +1162,23 @@ void StacktraceSignalHandler(int sigNo, siginfo_t* sigInfo, oss << "privileged opcode"; break; -#if defined(ILL_PRVREG) +# if defined(ILL_PRVREG) case ILL_PRVREG: oss << "privileged register"; break; -#endif +# endif -#if defined(ILL_COPROC) +# if defined(ILL_COPROC) case ILL_COPROC: oss << "co-processor error"; break; -#endif +# endif -#if defined(ILL_BADSTK) +# if defined(ILL_BADSTK) case ILL_BADSTK: oss << "internal stack error"; break; -#endif +# endif default: oss << "code " << sigInfo->si_code; @@ -1201,16 +1201,16 @@ void StacktraceSignalHandler(int sigNo, siginfo_t* sigInfo, // and abort SystemInformationImplementation::SetStackTraceOnError(0); abort(); -#else +# else // avoid warning C4100 (void)sigNo; (void)sigInfo; -#endif +# endif } #endif #if defined(KWSYS_SYSTEMINFORMATION_HAS_BACKTRACE) -#define safes(_arg) ((_arg) ? (_arg) : "???") +# define safes(_arg) ((_arg) ? (_arg) : "???") // Description: // A container for symbol properties. Each instance @@ -1298,19 +1298,19 @@ private: std::ostream& operator<<(std::ostream& os, const SymbolProperties& sp) { -#if defined(KWSYS_SYSTEMINFORMATION_HAS_SYMBOL_LOOKUP) +# if defined(KWSYS_SYSTEMINFORMATION_HAS_SYMBOL_LOOKUP) os << std::hex << sp.GetAddress() << " : " << sp.GetFunction() << " [(" << sp.GetBinary() << ") " << sp.GetSourceFile() << ":" << std::dec << sp.GetLineNumber() << "]"; -#elif defined(KWSYS_SYSTEMINFORMATION_HAS_BACKTRACE) +# elif defined(KWSYS_SYSTEMINFORMATION_HAS_BACKTRACE) void* addr = sp.GetAddress(); char** syminfo = backtrace_symbols(&addr, 1); os << safes(syminfo[0]); free(syminfo); -#else +# else (void)os; (void)sp; -#endif +# endif return os; } @@ -1347,7 +1347,7 @@ std::string SymbolProperties::GetFileName(const std::string& path) const std::string SymbolProperties::GetBinary() const { // only linux has proc fs -#if defined(__linux__) +# if defined(__linux__) if (this->Binary == "/proc/self/exe") { std::string binary; char buf[1024] = { '\0' }; @@ -1360,14 +1360,14 @@ std::string SymbolProperties::GetBinary() const } return this->GetFileName(binary); } -#endif +# endif return this->GetFileName(this->Binary); } std::string SymbolProperties::Demangle(const char* symbol) const { std::string result = safes(symbol); -#if defined(KWSYS_SYSTEMINFORMATION_HAS_CPP_DEMANGLE) +# if defined(KWSYS_SYSTEMINFORMATION_HAS_CPP_DEMANGLE) int status = 0; size_t bufferLen = 1024; char* buffer = (char*)malloc(1024); @@ -1377,16 +1377,16 @@ std::string SymbolProperties::Demangle(const char* symbol) const result = demangledSymbol; } free(buffer); -#else +# else (void)symbol; -#endif +# endif return result; } void SymbolProperties::Initialize(void* address) { this->Address = address; -#if defined(KWSYS_SYSTEMINFORMATION_HAS_SYMBOL_LOOKUP) +# if defined(KWSYS_SYSTEMINFORMATION_HAS_SYMBOL_LOOKUP) // first fallback option can demangle c++ functions Dl_info info; int ierr = dladdr(this->Address, &info); @@ -1394,18 +1394,18 @@ void SymbolProperties::Initialize(void* address) this->SetBinary(info.dli_fname); this->SetFunction(info.dli_sname); } -#else +# else // second fallback use builtin backtrace_symbols // to decode the bactrace. -#endif +# endif } #endif // don't define this class if we're not using it #if defined(_WIN32) || defined(__CYGWIN__) -#define KWSYS_SYSTEMINFORMATION_USE_GetSystemTimes +# define KWSYS_SYSTEMINFORMATION_USE_GetSystemTimes #endif #if defined(_MSC_VER) && _MSC_VER < 1310 -#undef KWSYS_SYSTEMINFORMATION_USE_GetSystemTimes +# undef KWSYS_SYSTEMINFORMATION_USE_GetSystemTimes #endif #if defined(KWSYS_SYSTEMINFORMATION_USE_GetSystemTimes) double calculateCPULoad(unsigned __int64 idleTicks, @@ -2010,12 +2010,12 @@ bool SystemInformationImplementation::DoesCPUSupportCPUID() #if USE_CPUID int dummy[4] = { 0, 0, 0, 0 }; -#if USE_ASM_INSTRUCTIONS +# if USE_ASM_INSTRUCTIONS return call_cpuid(0, dummy); -#else +# else call_cpuid(0, dummy); return dummy[0] || dummy[1] || dummy[2] || dummy[3]; -#endif +# endif #else // Assume no cpuid instruction. return false; @@ -2057,7 +2057,7 @@ bool SystemInformationImplementation::RetrieveCPUFeatures() this->Features.HasIA64 = ((cpuinfo[3] & 0x40000000) != 0); // IA64 Present --> Bit 30 -#if USE_ASM_INSTRUCTIONS +# if USE_ASM_INSTRUCTIONS // Retrieve extended SSE capabilities if SSE is available. if (this->Features.HasSSE) { @@ -2081,9 +2081,9 @@ bool SystemInformationImplementation::RetrieveCPUFeatures() // Set the advanced SSE capabilities to not available. this->Features.HasSSEFP = false; } -#else +# else this->Features.HasSSEFP = false; -#endif +# endif // Retrieve Intel specific extended features. if (this->ChipManufacturer == Intel) { @@ -3564,7 +3564,7 @@ bool SystemInformationImplementation::QueryProcessorBySysconf() { #if defined(_SC_NPROC_ONLN) && !defined(_SC_NPROCESSORS_ONLN) // IRIX names this slightly different -#define _SC_NPROCESSORS_ONLN _SC_NPROC_ONLN +# define _SC_NPROCESSORS_ONLN _SC_NPROC_ONLN #endif #ifdef _SC_NPROCESSORS_ONLN @@ -3594,17 +3594,17 @@ SystemInformation::LongLong SystemInformationImplementation::GetHostMemoryTotal() { #if defined(_WIN32) -#if defined(_MSC_VER) && _MSC_VER < 1300 +# if defined(_MSC_VER) && _MSC_VER < 1300 MEMORYSTATUS stat; stat.dwLength = sizeof(stat); GlobalMemoryStatus(&stat); return stat.dwTotalPhys / 1024; -#else +# else MEMORYSTATUSEX statex; statex.dwLength = sizeof(statex); GlobalMemoryStatusEx(&statex); return statex.ullTotalPhys / 1024; -#endif +# endif #elif defined(__linux) SystemInformation::LongLong memTotal = 0; int ierr = GetFieldFromFile("/proc/meminfo", "MemTotal:", memTotal); @@ -3719,17 +3719,17 @@ SystemInformation::LongLong SystemInformationImplementation::GetHostMemoryUsed() { #if defined(_WIN32) -#if defined(_MSC_VER) && _MSC_VER < 1300 +# if defined(_MSC_VER) && _MSC_VER < 1300 MEMORYSTATUS stat; stat.dwLength = sizeof(stat); GlobalMemoryStatus(&stat); return (stat.dwTotalPhys - stat.dwAvailPhys) / 1024; -#else +# else MEMORYSTATUSEX statex; statex.dwLength = sizeof(statex); GlobalMemoryStatusEx(&statex); return (statex.ullTotalPhys - statex.ullAvailPhys) / 1024; -#endif +# endif #elif defined(__linux) // First try to use MemAvailable, but it only works on newer kernels const char* names2[3] = { "MemTotal:", "MemAvailable:", NULL }; @@ -3892,15 +3892,15 @@ std::string SystemInformationImplementation::GetProgramStack(int firstFrame, "WARNING: The stack trace will not use advanced " "capabilities because this is a release build.\n" #else -#if !defined(KWSYS_SYSTEMINFORMATION_HAS_SYMBOL_LOOKUP) +# if !defined(KWSYS_SYSTEMINFORMATION_HAS_SYMBOL_LOOKUP) "WARNING: Function names will not be demangled " "because " "dladdr is not available.\n" -#endif -#if !defined(KWSYS_SYSTEMINFORMATION_HAS_CPP_DEMANGLE) +# endif +# if !defined(KWSYS_SYSTEMINFORMATION_HAS_CPP_DEMANGLE) "WARNING: Function names will not be demangled " "because cxxabi is not available.\n" -#endif +# endif #endif ; @@ -3955,9 +3955,9 @@ void SystemInformationImplementation::SetStackTraceOnError(int enable) struct sigaction sa; sa.sa_sigaction = (SigAction)StacktraceSignalHandler; sa.sa_flags = SA_SIGINFO | SA_RESETHAND; -#ifdef SA_RESTART +# ifdef SA_RESTART sa.sa_flags |= SA_RESTART; -#endif +# endif sigemptyset(&sa.sa_mask); sigaction(SIGABRT, &sa, KWSYS_NULLPTR); @@ -3989,21 +3989,21 @@ void SystemInformationImplementation::SetStackTraceOnError(int enable) bool SystemInformationImplementation::QueryWindowsMemory() { #if defined(_WIN32) -#if defined(_MSC_VER) && _MSC_VER < 1300 +# if defined(_MSC_VER) && _MSC_VER < 1300 MEMORYSTATUS ms; unsigned long tv, tp, av, ap; ms.dwLength = sizeof(ms); GlobalMemoryStatus(&ms); -#define MEM_VAL(value) dw##value -#else +# define MEM_VAL(value) dw##value +# else MEMORYSTATUSEX ms; DWORDLONG tv, tp, av, ap; ms.dwLength = sizeof(ms); if (0 == GlobalMemoryStatusEx(&ms)) { return 0; } -#define MEM_VAL(value) ull##value -#endif +# define MEM_VAL(value) ull##value +# endif tv = ms.MEM_VAL(TotalPageFile); tp = ms.MEM_VAL(TotalPhys); av = ms.MEM_VAL(AvailPageFile); @@ -4186,7 +4186,7 @@ bool SystemInformationImplementation::QueryMemoryBySysconf() this->TotalPhysicalMemory = p; this->TotalPhysicalMemory /= pagediv; -#if defined(_SC_AVPHYS_PAGES) +# if defined(_SC_AVPHYS_PAGES) p = sysconf(_SC_AVPHYS_PAGES); if (p < 0) { return false; @@ -4194,7 +4194,7 @@ bool SystemInformationImplementation::QueryMemoryBySysconf() this->AvailablePhysicalMemory = p; this->AvailablePhysicalMemory /= pagediv; -#endif +# endif return true; #else @@ -4427,7 +4427,7 @@ bool SystemInformationImplementation::ParseSysCtl() static_cast<size_t>(available_memory / 1048576); } -#ifdef VM_SWAPUSAGE +# ifdef VM_SWAPUSAGE // Virtual memory. int mib[2] = { CTL_VM, VM_SWAPUSAGE }; size_t miblen = sizeof(mib) / sizeof(mib[0]); @@ -4439,10 +4439,10 @@ bool SystemInformationImplementation::ParseSysCtl() static_cast<size_t>(swap.xsu_avail / 1048576); this->TotalVirtualMemory = static_cast<size_t>(swap.xsu_total / 1048576); } -#else +# else this->AvailableVirtualMemory = 0; this->TotalVirtualMemory = 0; -#endif +# endif // CPU Info len = sizeof(this->NumberOfPhysicalCPU); @@ -4733,11 +4733,11 @@ bool SystemInformationImplementation::QuerySolarisMemory() // a 32 bit process on a 64 bit host the returned memory will be // limited to 4GiB. So if this is a 32 bit process or if the sysconf // method fails use the kstat interface. -#if SIZEOF_VOID_P == 8 +# if SIZEOF_VOID_P == 8 if (this->QueryMemoryBySysconf()) { return true; } -#endif +# endif char* tail; unsigned long totalMemory = @@ -4900,12 +4900,12 @@ bool SystemInformationImplementation::QueryBSDMemory() #if defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__NetBSD__) || \ defined(__DragonFly__) int ctrl[2] = { CTL_HW, HW_PHYSMEM }; -#if defined(HW_PHYSMEM64) +# if defined(HW_PHYSMEM64) int64_t k; ctrl[1] = HW_PHYSMEM64; -#else +# else int k; -#endif +# endif size_t sz = sizeof(k); if (sysctl(ctrl, 2, &k, &sz, NULL, 0) != 0) { @@ -4986,7 +4986,7 @@ bool SystemInformationImplementation::QueryBSDProcessor() this->NumberOfPhysicalCPU = k; this->NumberOfLogicalCPU = this->NumberOfPhysicalCPU; -#if defined(HW_CPUSPEED) +# if defined(HW_CPUSPEED) ctrl[1] = HW_CPUSPEED; if (sysctl(ctrl, 2, &k, &sz, NULL, 0) != 0) { @@ -4994,9 +4994,9 @@ bool SystemInformationImplementation::QueryBSDProcessor() } this->CPUSpeedInMHz = (float)k; -#endif +# endif -#if defined(CPU_SSE) +# if defined(CPU_SSE) ctrl[0] = CTL_MACHDEP; ctrl[1] = CPU_SSE; @@ -5005,9 +5005,9 @@ bool SystemInformationImplementation::QueryBSDProcessor() } this->Features.HasSSE = (k > 0); -#endif +# endif -#if defined(CPU_SSE2) +# if defined(CPU_SSE2) ctrl[0] = CTL_MACHDEP; ctrl[1] = CPU_SSE2; @@ -5016,9 +5016,9 @@ bool SystemInformationImplementation::QueryBSDProcessor() } this->Features.HasSSE2 = (k > 0); -#endif +# endif -#if defined(CPU_CPUVENDOR) +# if defined(CPU_CPUVENDOR) ctrl[0] = CTL_MACHDEP; ctrl[1] = CPU_CPUVENDOR; char vbuf[25]; @@ -5030,7 +5030,7 @@ bool SystemInformationImplementation::QueryBSDProcessor() this->ChipID.Vendor = vbuf; this->FindManufacturer(); -#endif +# endif return true; #else @@ -5075,7 +5075,7 @@ bool SystemInformationImplementation::QueryHPUXMemory() bool SystemInformationImplementation::QueryHPUXProcessor() { #if defined(__hpux) -#if defined(KWSYS_SYS_HAS_MPCTL_H) +# if defined(KWSYS_SYS_HAS_MPCTL_H) int c = mpctl(MPC_GETNUMSPUS_SYS, 0, 0); if (c <= 0) { return false; @@ -5103,17 +5103,17 @@ bool SystemInformationImplementation::QueryHPUXProcessor() this->ChipID.Vendor = "Hewlett-Packard"; this->ChipID.Family = 0x200; break; -#if defined(CPU_HP_INTEL_EM_1_0) || defined(CPU_IA64_ARCHREV_0) -#ifdef CPU_HP_INTEL_EM_1_0 +# if defined(CPU_HP_INTEL_EM_1_0) || defined(CPU_IA64_ARCHREV_0) +# ifdef CPU_HP_INTEL_EM_1_0 case CPU_HP_INTEL_EM_1_0: -#endif -#ifdef CPU_IA64_ARCHREV_0 +# endif +# ifdef CPU_IA64_ARCHREV_0 case CPU_IA64_ARCHREV_0: -#endif +# endif this->ChipID.Vendor = "GenuineIntel"; this->Features.HasIA64 = true; break; -#endif +# endif default: return false; } @@ -5121,9 +5121,9 @@ bool SystemInformationImplementation::QueryHPUXProcessor() this->FindManufacturer(); return true; -#else +# else return false; -#endif +# endif #else return false; #endif @@ -5144,14 +5144,14 @@ bool SystemInformationImplementation::QueryOSInformation() // Try calling GetVersionEx using the OSVERSIONINFOEX structure. ZeroMemory(&osvi, sizeof(OSVERSIONINFOEXW)); osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEXW); -#ifdef KWSYS_WINDOWS_DEPRECATED_GetVersionEx -#pragma warning(push) -#ifdef __INTEL_COMPILER -#pragma warning(disable : 1478) -#else -#pragma warning(disable : 4996) -#endif -#endif +# ifdef KWSYS_WINDOWS_DEPRECATED_GetVersionEx +# pragma warning(push) +# ifdef __INTEL_COMPILER +# pragma warning(disable : 1478) +# else +# pragma warning(disable : 4996) +# endif +# endif bOsVersionInfoEx = GetVersionExW((OSVERSIONINFOW*)&osvi); if (!bOsVersionInfoEx) { osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOW); @@ -5159,9 +5159,9 @@ bool SystemInformationImplementation::QueryOSInformation() return false; } } -#ifdef KWSYS_WINDOWS_DEPRECATED_GetVersionEx -#pragma warning(pop) -#endif +# ifdef KWSYS_WINDOWS_DEPRECATED_GetVersionEx +# pragma warning(pop) +# endif switch (osvi.dwPlatformId) { case VER_PLATFORM_WIN32_NT: @@ -5179,7 +5179,7 @@ bool SystemInformationImplementation::QueryOSInformation() if (osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 2) { this->OSRelease = "XP"; } -#ifdef VER_NT_WORKSTATION +# ifdef VER_NT_WORKSTATION // Test for product type. if (bOsVersionInfoEx) { if (osvi.wProductType == VER_NT_WORKSTATION) { @@ -5190,7 +5190,7 @@ bool SystemInformationImplementation::QueryOSInformation() this->OSRelease = "7"; } // VER_SUITE_PERSONAL may not be defined -#ifdef VER_SUITE_PERSONAL +# ifdef VER_SUITE_PERSONAL else { if (osvi.wSuiteMask & VER_SUITE_PERSONAL) { this->OSRelease += " Personal"; @@ -5198,7 +5198,7 @@ bool SystemInformationImplementation::QueryOSInformation() this->OSRelease += " Professional"; } } -#endif +# endif } else if (osvi.wProductType == VER_NT_SERVER) { // Check for .NET Server instead of Windows XP. if (osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 1) { @@ -5219,7 +5219,7 @@ bool SystemInformationImplementation::QueryOSInformation() osvi.dwBuildNumber & 0xFFFF); this->OSVersion = operatingSystem; } else -#endif // VER_NT_WORKSTATION +# endif // VER_NT_WORKSTATION { HKEY hKey; wchar_t szProductType[80]; @@ -5370,7 +5370,7 @@ bool SystemInformationImplementation::QueryOSInformation() } } -#ifdef __APPLE__ +# ifdef __APPLE__ this->OSName = "Unknown Apple OS"; this->OSRelease = "Unknown product version"; this->OSVersion = "Unknown build version"; @@ -5378,7 +5378,7 @@ bool SystemInformationImplementation::QueryOSInformation() this->CallSwVers("-productName", this->OSName); this->CallSwVers("-productVersion", this->OSRelease); this->CallSwVers("-buildVersion", this->OSVersion); -#endif +# endif #endif diff --git a/Source/kwsys/SystemInformation.hxx.in b/Source/kwsys/SystemInformation.hxx.in index fe7e8b557a..9e1ce6ce2c 100644 --- a/Source/kwsys/SystemInformation.hxx.in +++ b/Source/kwsys/SystemInformation.hxx.in @@ -20,7 +20,7 @@ class @KWSYS_NAMESPACE@_EXPORT SystemInformation #elif @KWSYS_USE___INT64@ typedef __int64 LongLong; #else -#error "No Long Long" +# error "No Long Long" #endif friend class SystemInformationImplementation; SystemInformationImplementation* Implementation; diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx index 7743e4ed3d..0079da2862 100644 --- a/Source/kwsys/SystemTools.cxx +++ b/Source/kwsys/SystemTools.cxx @@ -1,18 +1,19 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing#kwsys for details. */ #ifdef __osf__ -#define _OSF_SOURCE -#define _POSIX_C_SOURCE 199506L -#define _XOPEN_SOURCE_EXTENDED +# define _OSF_SOURCE +# define _POSIX_C_SOURCE 199506L +# define _XOPEN_SOURCE_EXTENDED #endif -#if defined(_WIN32) && (defined(_MSC_VER) || defined(__WATCOMC__) || \ - defined(__BORLANDC__) || defined(__MINGW32__)) -#define KWSYS_WINDOWS_DIRS +#if defined(_WIN32) && \ + (defined(_MSC_VER) || defined(__WATCOMC__) || defined(__BORLANDC__) || \ + defined(__MINGW32__)) +# define KWSYS_WINDOWS_DIRS #else -#if defined(__SUNPRO_CC) -#include <fcntl.h> -#endif +# if defined(__SUNPRO_CC) +# include <fcntl.h> +# endif #endif #include "kwsysPrivate.h" @@ -32,25 +33,25 @@ // Work-around CMake dependency scanning limitation. This must // duplicate the above list of headers. #if 0 -#include "Directory.hxx.in" -#include "Encoding.hxx.in" -#include "FStream.hxx.in" -#include "RegularExpression.hxx.in" -#include "SystemTools.hxx.in" +# include "Directory.hxx.in" +# include "Encoding.hxx.in" +# include "FStream.hxx.in" +# include "RegularExpression.hxx.in" +# include "SystemTools.hxx.in" #endif #ifdef _MSC_VER -#pragma warning(disable : 4786) +# pragma warning(disable : 4786) #endif #if defined(__sgi) && !defined(__GNUC__) -#pragma set woff 1375 /* base class destructor not virtual */ +# pragma set woff 1375 /* base class destructor not virtual */ #endif #include <ctype.h> #include <errno.h> #ifdef __QNX__ -#include <malloc.h> /* for malloc/free on QNX */ +# include <malloc.h> /* for malloc/free on QNX */ #endif #include <stdio.h> #include <stdlib.h> @@ -58,42 +59,42 @@ #include <time.h> #if defined(_WIN32) && !defined(_MSC_VER) && defined(__GNUC__) -#include <strings.h> /* for strcasecmp */ +# include <strings.h> /* for strcasecmp */ #endif #ifdef _MSC_VER -#define umask _umask // Note this is still umask on Borland +# define umask _umask // Note this is still umask on Borland #endif // support for realpath call #ifndef _WIN32 -#include <limits.h> -#include <pwd.h> -#include <sys/ioctl.h> -#include <sys/time.h> -#include <sys/wait.h> -#include <unistd.h> -#include <utime.h> -#ifndef __VMS -#include <sys/param.h> -#include <termios.h> -#endif -#include <signal.h> /* sigprocmask */ +# include <limits.h> +# include <pwd.h> +# include <sys/ioctl.h> +# include <sys/time.h> +# include <sys/wait.h> +# include <unistd.h> +# include <utime.h> +# ifndef __VMS +# include <sys/param.h> +# include <termios.h> +# endif +# include <signal.h> /* sigprocmask */ #endif // Windows API. #if defined(_WIN32) -#include <windows.h> -#include <winioctl.h> -#ifndef INVALID_FILE_ATTRIBUTES -#define INVALID_FILE_ATTRIBUTES ((DWORD)-1) -#endif -#if defined(_MSC_VER) && _MSC_VER >= 1800 -#define KWSYS_WINDOWS_DEPRECATED_GetVersionEx -#endif +# include <windows.h> +# include <winioctl.h> +# ifndef INVALID_FILE_ATTRIBUTES +# define INVALID_FILE_ATTRIBUTES ((DWORD)-1) +# endif +# if defined(_MSC_VER) && _MSC_VER >= 1800 +# define KWSYS_WINDOWS_DEPRECATED_GetVersionEx +# endif #elif defined(__CYGWIN__) -#include <windows.h> -#undef _WIN32 +# include <windows.h> +# undef _WIN32 #endif #if !KWSYS_CXX_HAS_ENVIRON_IN_STDLIB_H @@ -101,18 +102,18 @@ extern char** environ; #endif #ifdef __CYGWIN__ -#include <sys/cygwin.h> +# include <sys/cygwin.h> #endif // getpwnam doesn't exist on Windows and Cray Xt3/Catamount // same for TIOCGWINSZ #if defined(_WIN32) || defined(__LIBCATAMOUNT__) || \ (defined(HAVE_GETPWNAM) && HAVE_GETPWNAM == 0) -#undef HAVE_GETPWNAM -#undef HAVE_TTY_INFO +# undef HAVE_GETPWNAM +# undef HAVE_TTY_INFO #else -#define HAVE_GETPWNAM 1 -#define HAVE_TTY_INFO 1 +# define HAVE_GETPWNAM 1 +# define HAVE_TTY_INFO 1 #endif #define VTK_URL_PROTOCOL_REGEX "([a-zA-Z0-9]*)://(.*)" @@ -121,15 +122,15 @@ extern char** environ; "(.+)?" #ifdef _MSC_VER -#include <sys/utime.h> +# include <sys/utime.h> #else -#include <utime.h> +# include <utime.h> #endif // This is a hack to prevent warnings about these functions being // declared but not referenced. #if defined(__sgi) && !defined(__GNUC__) -#include <sys/termios.h> +# include <sys/termios.h> namespace KWSYS_NAMESPACE { class SystemToolsHack { @@ -147,32 +148,33 @@ public: } #endif -#if defined(_WIN32) && (defined(_MSC_VER) || defined(__WATCOMC__) || \ - defined(__BORLANDC__) || defined(__MINGW32__)) -#include <direct.h> -#include <io.h> -#define _unlink unlink +#if defined(_WIN32) && \ + (defined(_MSC_VER) || defined(__WATCOMC__) || defined(__BORLANDC__) || \ + defined(__MINGW32__)) +# include <direct.h> +# include <io.h> +# define _unlink unlink #endif /* The maximum length of a file name. */ #if defined(PATH_MAX) -#define KWSYS_SYSTEMTOOLS_MAXPATH PATH_MAX +# define KWSYS_SYSTEMTOOLS_MAXPATH PATH_MAX #elif defined(MAXPATHLEN) -#define KWSYS_SYSTEMTOOLS_MAXPATH MAXPATHLEN +# define KWSYS_SYSTEMTOOLS_MAXPATH MAXPATHLEN #else -#define KWSYS_SYSTEMTOOLS_MAXPATH 16384 +# define KWSYS_SYSTEMTOOLS_MAXPATH 16384 #endif #if defined(__WATCOMC__) -#include <direct.h> -#define _mkdir mkdir -#define _rmdir rmdir -#define _getcwd getcwd -#define _chdir chdir +# include <direct.h> +# define _mkdir mkdir +# define _rmdir rmdir +# define _getcwd getcwd +# define _chdir chdir #endif #if defined(__BEOS__) && !defined(__ZETA__) -#include <be/kernel/OS.h> -#include <be/storage/Path.h> +# include <be/kernel/OS.h> +# include <be/storage/Path.h> // BeOS 5 doesn't have usleep(), but it has snooze(), which is identical. static inline void usleep(unsigned int msec) @@ -213,7 +215,7 @@ static time_t windows_filetime_to_posix_time(const FILETIME& ft) #endif #ifdef KWSYS_WINDOWS_DIRS -#include <wctype.h> +# include <wctype.h> inline int Mkdir(const std::string& dir) { @@ -245,11 +247,11 @@ inline const char* Getcwd(char* buf, unsigned int len) } inline int Chdir(const std::string& dir) { -#if defined(__BORLANDC__) +# if defined(__BORLANDC__) return chdir(dir.c_str()); -#else +# else return _wchdir(KWSYS_NAMESPACE::Encoding::ToWide(dir).c_str()); -#endif +# endif } inline void Realpath(const std::string& path, std::string& resolved_path, std::string* errorMessage = 0) @@ -284,10 +286,10 @@ inline void Realpath(const std::string& path, std::string& resolved_path, } } #else -#include <sys/types.h> +# include <sys/types.h> -#include <fcntl.h> -#include <unistd.h> +# include <fcntl.h> +# include <unistd.h> inline int Mkdir(const std::string& dir) { return mkdir(dir.c_str(), 00777); @@ -429,13 +431,13 @@ struct SystemToolsPathCaseCmp { bool operator()(std::string const& l, std::string const& r) const { -#ifdef _MSC_VER +# ifdef _MSC_VER return _stricmp(l.c_str(), r.c_str()) < 0; -#elif defined(__GNUC__) +# elif defined(__GNUC__) return strcasecmp(l.c_str(), r.c_str()) < 0; -#else +# else return SystemTools::Strucmp(l.c_str(), r.c_str()) < 0; -#endif +# endif } }; @@ -672,9 +674,9 @@ bool SystemTools::UnPutEnv(const std::string& env) environment values that may still reference memory we allocated. Then free the memory. This will not affect any environment values we never set. */ -#ifdef __INTEL_COMPILER -#pragma warning disable 444 /* base has non-virtual destructor */ -#endif +# ifdef __INTEL_COMPILER +# pragma warning disable 444 /* base has non-virtual destructor */ +# endif class kwsysEnv : public kwsysEnvSet { @@ -682,39 +684,39 @@ public: ~kwsysEnv() { for (iterator i = this->begin(); i != this->end(); ++i) { -#if defined(_WIN32) +# if defined(_WIN32) const std::string s = Encoding::ToNarrow(*i); kwsysUnPutEnv(s.c_str()); -#else +# else kwsysUnPutEnv(*i); -#endif +# endif free(const_cast<envchar*>(*i)); } } bool Put(const char* env) { -#if defined(_WIN32) +# if defined(_WIN32) const std::wstring wEnv = Encoding::ToWide(env); wchar_t* newEnv = _wcsdup(wEnv.c_str()); -#else +# else char* newEnv = strdup(env); -#endif +# endif Free oldEnv(this->Release(newEnv)); this->insert(newEnv); -#if defined(_WIN32) +# if defined(_WIN32) return _wputenv(newEnv) == 0; -#else +# else return putenv(newEnv) == 0; -#endif +# endif } bool UnPut(const char* env) { -#if defined(_WIN32) +# if defined(_WIN32) const std::wstring wEnv = Encoding::ToWide(env); Free oldEnv(this->Release(wEnv.c_str())); -#else +# else Free oldEnv(this->Release(env)); -#endif +# endif return kwsysUnPutEnv(env) == 0; } }; @@ -792,7 +794,7 @@ bool SystemTools::MakeDirectory(const std::string& path, const mode_t* mode) #ifdef __BORLANDC__ && (errno != EACCES) #endif - ) { + ) { return false; } } else if (mode != KWSYS_NULLPTR) { @@ -862,13 +864,13 @@ void SystemTools::ReplaceString(std::string& source, const char* replace, #if defined(_WIN32) && !defined(__CYGWIN__) -#if defined(KEY_WOW64_32KEY) && defined(KEY_WOW64_64KEY) -#define KWSYS_ST_KEY_WOW64_32KEY KEY_WOW64_32KEY -#define KWSYS_ST_KEY_WOW64_64KEY KEY_WOW64_64KEY -#else -#define KWSYS_ST_KEY_WOW64_32KEY 0x0200 -#define KWSYS_ST_KEY_WOW64_64KEY 0x0100 -#endif +# if defined(KEY_WOW64_32KEY) && defined(KEY_WOW64_64KEY) +# define KWSYS_ST_KEY_WOW64_32KEY KEY_WOW64_32KEY +# define KWSYS_ST_KEY_WOW64_64KEY KEY_WOW64_64KEY +# else +# define KWSYS_ST_KEY_WOW64_32KEY 0x0200 +# define KWSYS_ST_KEY_WOW64_64KEY 0x0100 +# endif static bool SystemToolsParseRegistryKey(const std::string& key, HKEY& primaryKey, std::string& second, @@ -1200,11 +1202,11 @@ bool SystemTools::FileExists(const std::string& filename) INVALID_FILE_ATTRIBUTES); #else // SCO OpenServer 5.0.7/3.2's command has 711 permission. -#if defined(_SCO_DS) +# if defined(_SCO_DS) return access(filename.c_str(), F_OK) == 0; -#else +# else return access(filename.c_str(), R_OK) == 0; -#endif +# endif #endif } @@ -1276,11 +1278,11 @@ int SystemTools::Stat(const std::string& path, SystemTools::Stat_t* buf) // long paths, but _wstat64 rejects paths with '?' in them, thinking // they are wildcards. std::wstring const& wpath = Encoding::ToWide(path); -#if defined(__BORLANDC__) +# if defined(__BORLANDC__) return _wstati64(wpath.c_str(), buf); -#else +# else return _wstat64(wpath.c_str(), buf); -#endif +# endif #else return stat(path.c_str(), buf); #endif @@ -1346,28 +1348,28 @@ bool SystemTools::Touch(const std::string& filename, bool create) } struct timeval mtime; gettimeofday(&mtime, 0); -#if KWSYS_CXX_HAS_UTIMES +# if KWSYS_CXX_HAS_UTIMES struct timeval atime; -#if KWSYS_CXX_STAT_HAS_ST_MTIM +# if KWSYS_CXX_STAT_HAS_ST_MTIM atime.tv_sec = st.st_atim.tv_sec; atime.tv_usec = st.st_atim.tv_nsec / 1000; -#elif KWSYS_CXX_STAT_HAS_ST_MTIMESPEC +# elif KWSYS_CXX_STAT_HAS_ST_MTIMESPEC atime.tv_sec = st.st_atimespec.tv_sec; atime.tv_usec = st.st_atimespec.tv_nsec / 1000; -#else +# else atime.tv_sec = st.st_atime; atime.tv_usec = 0; -#endif +# endif struct timeval times[2] = { atime, mtime }; if (utimes(filename.c_str(), times) < 0) { return false; } -#else +# else struct utimbuf times = { st.st_atime, mtime.tv_sec }; if (utime(filename.c_str(), ×) < 0) { return false; } -#endif +# endif #endif return true; } @@ -1387,7 +1389,7 @@ bool SystemTools::FileTimeCompare(const std::string& f1, const std::string& f2, if (stat(f2.c_str(), &s2) != 0) { return false; } -#if KWSYS_CXX_STAT_HAS_ST_MTIM +# if KWSYS_CXX_STAT_HAS_ST_MTIM // Compare using nanosecond resolution. if (s1.st_mtim.tv_sec < s2.st_mtim.tv_sec) { *result = -1; @@ -1398,7 +1400,7 @@ bool SystemTools::FileTimeCompare(const std::string& f1, const std::string& f2, } else if (s1.st_mtim.tv_nsec > s2.st_mtim.tv_nsec) { *result = 1; } -#elif KWSYS_CXX_STAT_HAS_ST_MTIMESPEC +# elif KWSYS_CXX_STAT_HAS_ST_MTIMESPEC // Compare using nanosecond resolution. if (s1.st_mtimespec.tv_sec < s2.st_mtimespec.tv_sec) { *result = -1; @@ -1409,14 +1411,14 @@ bool SystemTools::FileTimeCompare(const std::string& f1, const std::string& f2, } else if (s1.st_mtimespec.tv_nsec > s2.st_mtimespec.tv_nsec) { *result = 1; } -#else +# else // Compare using 1 second resolution. if (s1.st_mtime < s2.st_mtime) { *result = -1; } else if (s1.st_mtime > s2.st_mtime) { *result = 1; } -#endif +# endif #else // Windows version. Get the modification time from extended file attributes. WIN32_FILE_ATTRIBUTE_DATA f1d; @@ -1900,15 +1902,15 @@ void SystemTools::ConvertToUnixSlashes(std::string& path) // Also, reuse the loop to check for slash followed by another slash if (!hasDoubleSlash && *(pos0 + 1) == '/' && *(pos0 + 2) == '/') { -#ifdef _WIN32 +# ifdef _WIN32 // However, on windows if the first characters are both slashes, // then keep them that way, so that network paths can be handled. if (pos > 0) { hasDoubleSlash = true; } -#else +# else hasDoubleSlash = true; -#endif +# endif } pos0++; @@ -2396,7 +2398,7 @@ std::string SystemTools::GetLastSystemError() static bool IsJunction(const std::wstring& source) { -#ifdef FSCTL_GET_REPARSE_POINT +# ifdef FSCTL_GET_REPARSE_POINT const DWORD JUNCTION_ATTRS = FILE_ATTRIBUTE_DIRECTORY | FILE_ATTRIBUTE_REPARSE_POINT; DWORD attrs = GetFileAttributesW(source.c_str()); @@ -2438,14 +2440,14 @@ static bool IsJunction(const std::wstring& source) return (success && (reparse_buffer->ReparseTag == IO_REPARSE_TAG_MOUNT_POINT)); -#else +# else return false; -#endif +# endif } static bool DeleteJunction(const std::wstring& source) { -#ifdef FSCTL_DELETE_REPARSE_POINT +# ifdef FSCTL_DELETE_REPARSE_POINT // Adjust privileges so that we can succefully open junction points as // read/write. HANDLE token; @@ -2480,9 +2482,9 @@ static bool DeleteJunction(const std::wstring& source) CloseHandle(dir); return !!success; -#else +# else return false; -#endif +# endif } #endif @@ -3295,7 +3297,7 @@ std::string SystemTools::RelativePath(const std::string& local, #else localSplit[sameCount] == remoteSplit[sameCount] #endif - ) { + ) { // put the common parts of the path into the commonPath array commonPath.push_back(localSplit[sameCount]); // erase the common parts of the path from the original path arrays @@ -3601,13 +3603,13 @@ std::string SystemTools::JoinPath( bool SystemTools::ComparePath(const std::string& c1, const std::string& c2) { #if defined(_WIN32) || defined(__APPLE__) -#ifdef _MSC_VER +# ifdef _MSC_VER return _stricmp(c1.c_str(), c2.c_str()) == 0; -#elif defined(__APPLE__) || defined(__GNUC__) +# elif defined(__APPLE__) || defined(__GNUC__) return strcasecmp(c1.c_str(), c2.c_str()) == 0; -#else +# else return SystemTools::Strucmp(c1.c_str(), c2.c_str()) == 0; -#endif +# endif #else return c1 == c2; #endif @@ -4130,8 +4132,9 @@ bool SystemTools::GetPermissions(const std::string& file, mode_t& mode) } size_t dotPos = file.rfind('.'); const char* ext = dotPos == std::string::npos ? 0 : (file.c_str() + dotPos); - if (ext && (Strucmp(ext, ".exe") == 0 || Strucmp(ext, ".com") == 0 || - Strucmp(ext, ".cmd") == 0 || Strucmp(ext, ".bat") == 0)) { + if (ext && + (Strucmp(ext, ".exe") == 0 || Strucmp(ext, ".com") == 0 || + Strucmp(ext, ".cmd") == 0 || Strucmp(ext, ".bat") == 0)) { mode |= (_S_IEXEC | (_S_IEXEC >> 3) | (_S_IEXEC >> 6)); } #else @@ -4237,24 +4240,24 @@ std::string SystemTools::GetOperatingSystemNameAndVersion() ZeroMemory(&osvi, sizeof(osvi)); osvi.dwOSVersionInfoSize = sizeof(osvi); -#ifdef KWSYS_WINDOWS_DEPRECATED_GetVersionEx -#pragma warning(push) -#ifdef __INTEL_COMPILER -#pragma warning(disable : 1478) -#else -#pragma warning(disable : 4996) -#endif -#endif +# ifdef KWSYS_WINDOWS_DEPRECATED_GetVersionEx +# pragma warning(push) +# ifdef __INTEL_COMPILER +# pragma warning(disable : 1478) +# else +# pragma warning(disable : 4996) +# endif +# endif bOsVersionInfoEx = GetVersionExA((OSVERSIONINFOA*)&osvi); if (!bOsVersionInfoEx) { return 0; } -#ifdef KWSYS_WINDOWS_DEPRECATED_GetVersionEx -#pragma warning(pop) -#endif +# ifdef KWSYS_WINDOWS_DEPRECATED_GetVersionEx +# pragma warning(pop) +# endif switch (osvi.dwPlatformId) { - // Test for the Windows NT product family. + // Test for the Windows NT product family. case VER_PLATFORM_WIN32_NT: @@ -4372,7 +4375,7 @@ std::string SystemTools::GetOperatingSystemNameAndVersion() else { HKEY hKey; -#define BUFSIZE 80 +# define BUFSIZE 80 wchar_t szProductType[BUFSIZE]; DWORD dwBufLen = BUFSIZE; LONG lRet; @@ -4454,7 +4457,7 @@ std::string SystemTools::GetOperatingSystemNameAndVersion() break; - // Test for the Windows 95 product family. + // Test for the Windows 95 product family. case VER_PLATFORM_WIN32_WINDOWS: @@ -4655,9 +4658,9 @@ void SystemTools::ClassFinalize() } // namespace KWSYS_NAMESPACE #if defined(_MSC_VER) && defined(_DEBUG) -#include <crtdbg.h> -#include <stdio.h> -#include <stdlib.h> +# include <crtdbg.h> +# include <stdio.h> +# include <stdlib.h> namespace KWSYS_NAMESPACE { static int SystemToolsDebugReport(int, char* message, int*) diff --git a/Source/kwsys/SystemTools.hxx.in b/Source/kwsys/SystemTools.hxx.in index 3898e3ad2f..928ee41f2a 100644 --- a/Source/kwsys/SystemTools.hxx.in +++ b/Source/kwsys/SystemTools.hxx.in @@ -17,7 +17,7 @@ #include <sys/stat.h> #if !defined(_WIN32) || defined(__CYGWIN__) -#include <unistd.h> // For access permissions for use with access() +# include <unistd.h> // For access permissions for use with access() #endif // Required for va_list @@ -318,11 +318,11 @@ public: * Cross platform wrapper for stat struct */ #if defined(_WIN32) && !defined(__CYGWIN__) -#if defined(__BORLANDC__) +# if defined(__BORLANDC__) typedef struct stati64 Stat_t; -#else +# else typedef struct _stat64 Stat_t; -#endif +# endif #else typedef struct stat Stat_t; #endif diff --git a/Source/kwsys/Terminal.c b/Source/kwsys/Terminal.c index c9f9dc59ff..f0d9c64092 100644 --- a/Source/kwsys/Terminal.c +++ b/Source/kwsys/Terminal.c @@ -6,15 +6,15 @@ /* Work-around CMake dependency scanning limitation. This must duplicate the above list of headers. */ #if 0 -#include "Terminal.h.in" +# include "Terminal.h.in" #endif /* Configure support for this platform. */ #if defined(_WIN32) || defined(__CYGWIN__) -#define KWSYS_TERMINAL_SUPPORT_CONSOLE +# define KWSYS_TERMINAL_SUPPORT_CONSOLE #endif #if !defined(_WIN32) -#define KWSYS_TERMINAL_ISATTY_WORKS +# define KWSYS_TERMINAL_ISATTY_WORKS #endif /* Include needed system APIs. */ @@ -24,14 +24,14 @@ #include <string.h> /* strcmp */ #if defined(KWSYS_TERMINAL_SUPPORT_CONSOLE) -#include <io.h> /* _get_osfhandle */ -#include <windows.h> /* SetConsoleTextAttribute */ +# include <io.h> /* _get_osfhandle */ +# include <windows.h> /* SetConsoleTextAttribute */ #endif #if defined(KWSYS_TERMINAL_ISATTY_WORKS) -#include <unistd.h> /* isatty */ +# include <unistd.h> /* isatty */ #else -#include <sys/stat.h> /* fstat */ +# include <sys/stat.h> /* fstat */ #endif static int kwsysTerminalStreamIsVT100(FILE* stream, int default_vt100, @@ -301,10 +301,12 @@ static void kwsysTerminalSetVT100Color(FILE* stream, int color) #if defined(KWSYS_TERMINAL_SUPPORT_CONSOLE) -#define KWSYS_TERMINAL_MASK_FOREGROUND \ - (FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_INTENSITY) -#define KWSYS_TERMINAL_MASK_BACKGROUND \ - (BACKGROUND_BLUE | BACKGROUND_GREEN | BACKGROUND_RED | BACKGROUND_INTENSITY) +# define KWSYS_TERMINAL_MASK_FOREGROUND \ + (FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED | \ + FOREGROUND_INTENSITY) +# define KWSYS_TERMINAL_MASK_BACKGROUND \ + (BACKGROUND_BLUE | BACKGROUND_GREEN | BACKGROUND_RED | \ + BACKGROUND_INTENSITY) /* Get the Windows handle for a FILE stream. */ static HANDLE kwsysTerminalGetStreamHandle(FILE* stream) @@ -312,7 +314,7 @@ static HANDLE kwsysTerminalGetStreamHandle(FILE* stream) /* Get the C-library file descriptor from the stream. */ int fd = fileno(stream); -#if defined(__CYGWIN__) +# if defined(__CYGWIN__) /* Cygwin seems to have an extra pipe level. If the file descriptor corresponds to stdout or stderr then obtain the matching windows handle directly. */ @@ -321,7 +323,7 @@ static HANDLE kwsysTerminalGetStreamHandle(FILE* stream) } else if (fd == fileno(stderr)) { return GetStdHandle(STD_ERROR_HANDLE); } -#endif +# endif /* Get the underlying Windows handle for the descriptor. */ return (HANDLE)_get_osfhandle(fd); diff --git a/Source/kwsys/Terminal.h.in b/Source/kwsys/Terminal.h.in index 5d29830042..1a2c7452fa 100644 --- a/Source/kwsys/Terminal.h.in +++ b/Source/kwsys/Terminal.h.in @@ -12,57 +12,57 @@ not visible to user code. Use kwsysHeaderDump.pl to reproduce these macros after making changes to the interface. */ #if !defined(KWSYS_NAMESPACE) -#define kwsys_ns(x) @KWSYS_NAMESPACE@##x -#define kwsysEXPORT @KWSYS_NAMESPACE@_EXPORT +# define kwsys_ns(x) @KWSYS_NAMESPACE@##x +# define kwsysEXPORT @KWSYS_NAMESPACE@_EXPORT #endif #if !@KWSYS_NAMESPACE@_NAME_IS_KWSYS -#define kwsysTerminal_cfprintf kwsys_ns(Terminal_cfprintf) -#define kwsysTerminal_Color_e kwsys_ns(Terminal_Color_e) -#define kwsysTerminal_Color_Normal kwsys_ns(Terminal_Color_Normal) -#define kwsysTerminal_Color_ForegroundBlack \ - kwsys_ns(Terminal_Color_ForegroundBlack) -#define kwsysTerminal_Color_ForegroundRed \ - kwsys_ns(Terminal_Color_ForegroundRed) -#define kwsysTerminal_Color_ForegroundGreen \ - kwsys_ns(Terminal_Color_ForegroundGreen) -#define kwsysTerminal_Color_ForegroundYellow \ - kwsys_ns(Terminal_Color_ForegroundYellow) -#define kwsysTerminal_Color_ForegroundBlue \ - kwsys_ns(Terminal_Color_ForegroundBlue) -#define kwsysTerminal_Color_ForegroundMagenta \ - kwsys_ns(Terminal_Color_ForegroundMagenta) -#define kwsysTerminal_Color_ForegroundCyan \ - kwsys_ns(Terminal_Color_ForegroundCyan) -#define kwsysTerminal_Color_ForegroundWhite \ - kwsys_ns(Terminal_Color_ForegroundWhite) -#define kwsysTerminal_Color_ForegroundMask \ - kwsys_ns(Terminal_Color_ForegroundMask) -#define kwsysTerminal_Color_BackgroundBlack \ - kwsys_ns(Terminal_Color_BackgroundBlack) -#define kwsysTerminal_Color_BackgroundRed \ - kwsys_ns(Terminal_Color_BackgroundRed) -#define kwsysTerminal_Color_BackgroundGreen \ - kwsys_ns(Terminal_Color_BackgroundGreen) -#define kwsysTerminal_Color_BackgroundYellow \ - kwsys_ns(Terminal_Color_BackgroundYellow) -#define kwsysTerminal_Color_BackgroundBlue \ - kwsys_ns(Terminal_Color_BackgroundBlue) -#define kwsysTerminal_Color_BackgroundMagenta \ - kwsys_ns(Terminal_Color_BackgroundMagenta) -#define kwsysTerminal_Color_BackgroundCyan \ - kwsys_ns(Terminal_Color_BackgroundCyan) -#define kwsysTerminal_Color_BackgroundWhite \ - kwsys_ns(Terminal_Color_BackgroundWhite) -#define kwsysTerminal_Color_BackgroundMask \ - kwsys_ns(Terminal_Color_BackgroundMask) -#define kwsysTerminal_Color_ForegroundBold \ - kwsys_ns(Terminal_Color_ForegroundBold) -#define kwsysTerminal_Color_BackgroundBold \ - kwsys_ns(Terminal_Color_BackgroundBold) -#define kwsysTerminal_Color_AssumeTTY kwsys_ns(Terminal_Color_AssumeTTY) -#define kwsysTerminal_Color_AssumeVT100 kwsys_ns(Terminal_Color_AssumeVT100) -#define kwsysTerminal_Color_AttributeMask \ - kwsys_ns(Terminal_Color_AttributeMask) +# define kwsysTerminal_cfprintf kwsys_ns(Terminal_cfprintf) +# define kwsysTerminal_Color_e kwsys_ns(Terminal_Color_e) +# define kwsysTerminal_Color_Normal kwsys_ns(Terminal_Color_Normal) +# define kwsysTerminal_Color_ForegroundBlack \ + kwsys_ns(Terminal_Color_ForegroundBlack) +# define kwsysTerminal_Color_ForegroundRed \ + kwsys_ns(Terminal_Color_ForegroundRed) +# define kwsysTerminal_Color_ForegroundGreen \ + kwsys_ns(Terminal_Color_ForegroundGreen) +# define kwsysTerminal_Color_ForegroundYellow \ + kwsys_ns(Terminal_Color_ForegroundYellow) +# define kwsysTerminal_Color_ForegroundBlue \ + kwsys_ns(Terminal_Color_ForegroundBlue) +# define kwsysTerminal_Color_ForegroundMagenta \ + kwsys_ns(Terminal_Color_ForegroundMagenta) +# define kwsysTerminal_Color_ForegroundCyan \ + kwsys_ns(Terminal_Color_ForegroundCyan) +# define kwsysTerminal_Color_ForegroundWhite \ + kwsys_ns(Terminal_Color_ForegroundWhite) +# define kwsysTerminal_Color_ForegroundMask \ + kwsys_ns(Terminal_Color_ForegroundMask) +# define kwsysTerminal_Color_BackgroundBlack \ + kwsys_ns(Terminal_Color_BackgroundBlack) +# define kwsysTerminal_Color_BackgroundRed \ + kwsys_ns(Terminal_Color_BackgroundRed) +# define kwsysTerminal_Color_BackgroundGreen \ + kwsys_ns(Terminal_Color_BackgroundGreen) +# define kwsysTerminal_Color_BackgroundYellow \ + kwsys_ns(Terminal_Color_BackgroundYellow) +# define kwsysTerminal_Color_BackgroundBlue \ + kwsys_ns(Terminal_Color_BackgroundBlue) +# define kwsysTerminal_Color_BackgroundMagenta \ + kwsys_ns(Terminal_Color_BackgroundMagenta) +# define kwsysTerminal_Color_BackgroundCyan \ + kwsys_ns(Terminal_Color_BackgroundCyan) +# define kwsysTerminal_Color_BackgroundWhite \ + kwsys_ns(Terminal_Color_BackgroundWhite) +# define kwsysTerminal_Color_BackgroundMask \ + kwsys_ns(Terminal_Color_BackgroundMask) +# define kwsysTerminal_Color_ForegroundBold \ + kwsys_ns(Terminal_Color_ForegroundBold) +# define kwsysTerminal_Color_BackgroundBold \ + kwsys_ns(Terminal_Color_BackgroundBold) +# define kwsysTerminal_Color_AssumeTTY kwsys_ns(Terminal_Color_AssumeTTY) +# define kwsysTerminal_Color_AssumeVT100 kwsys_ns(Terminal_Color_AssumeVT100) +# define kwsysTerminal_Color_AttributeMask \ + kwsys_ns(Terminal_Color_AttributeMask) #endif #if defined(__cplusplus) @@ -135,36 +135,36 @@ enum kwsysTerminal_Color_e /* If we are building a kwsys .c or .cxx file, let it use these macros. Otherwise, undefine them to keep the namespace clean. */ #if !defined(KWSYS_NAMESPACE) -#undef kwsys_ns -#undef kwsysEXPORT -#if !@KWSYS_NAMESPACE@_NAME_IS_KWSYS -#undef kwsysTerminal_cfprintf -#undef kwsysTerminal_Color_e -#undef kwsysTerminal_Color_Normal -#undef kwsysTerminal_Color_ForegroundBlack -#undef kwsysTerminal_Color_ForegroundRed -#undef kwsysTerminal_Color_ForegroundGreen -#undef kwsysTerminal_Color_ForegroundYellow -#undef kwsysTerminal_Color_ForegroundBlue -#undef kwsysTerminal_Color_ForegroundMagenta -#undef kwsysTerminal_Color_ForegroundCyan -#undef kwsysTerminal_Color_ForegroundWhite -#undef kwsysTerminal_Color_ForegroundMask -#undef kwsysTerminal_Color_BackgroundBlack -#undef kwsysTerminal_Color_BackgroundRed -#undef kwsysTerminal_Color_BackgroundGreen -#undef kwsysTerminal_Color_BackgroundYellow -#undef kwsysTerminal_Color_BackgroundBlue -#undef kwsysTerminal_Color_BackgroundMagenta -#undef kwsysTerminal_Color_BackgroundCyan -#undef kwsysTerminal_Color_BackgroundWhite -#undef kwsysTerminal_Color_BackgroundMask -#undef kwsysTerminal_Color_ForegroundBold -#undef kwsysTerminal_Color_BackgroundBold -#undef kwsysTerminal_Color_AssumeTTY -#undef kwsysTerminal_Color_AssumeVT100 -#undef kwsysTerminal_Color_AttributeMask -#endif +# undef kwsys_ns +# undef kwsysEXPORT +# if !@KWSYS_NAMESPACE@_NAME_IS_KWSYS +# undef kwsysTerminal_cfprintf +# undef kwsysTerminal_Color_e +# undef kwsysTerminal_Color_Normal +# undef kwsysTerminal_Color_ForegroundBlack +# undef kwsysTerminal_Color_ForegroundRed +# undef kwsysTerminal_Color_ForegroundGreen +# undef kwsysTerminal_Color_ForegroundYellow +# undef kwsysTerminal_Color_ForegroundBlue +# undef kwsysTerminal_Color_ForegroundMagenta +# undef kwsysTerminal_Color_ForegroundCyan +# undef kwsysTerminal_Color_ForegroundWhite +# undef kwsysTerminal_Color_ForegroundMask +# undef kwsysTerminal_Color_BackgroundBlack +# undef kwsysTerminal_Color_BackgroundRed +# undef kwsysTerminal_Color_BackgroundGreen +# undef kwsysTerminal_Color_BackgroundYellow +# undef kwsysTerminal_Color_BackgroundBlue +# undef kwsysTerminal_Color_BackgroundMagenta +# undef kwsysTerminal_Color_BackgroundCyan +# undef kwsysTerminal_Color_BackgroundWhite +# undef kwsysTerminal_Color_BackgroundMask +# undef kwsysTerminal_Color_ForegroundBold +# undef kwsysTerminal_Color_BackgroundBold +# undef kwsysTerminal_Color_AssumeTTY +# undef kwsysTerminal_Color_AssumeVT100 +# undef kwsysTerminal_Color_AttributeMask +# endif #endif #endif diff --git a/Source/kwsys/hash_map.hxx.in b/Source/kwsys/hash_map.hxx.in index 8c9b81e1b9..5f04e9c168 100644 --- a/Source/kwsys/hash_map.hxx.in +++ b/Source/kwsys/hash_map.hxx.in @@ -35,14 +35,14 @@ #include <functional> // equal_to #if defined(_MSC_VER) -#pragma warning(push) -#pragma warning(disable : 4284) -#pragma warning(disable : 4786) +# pragma warning(push) +# pragma warning(disable : 4284) +# pragma warning(disable : 4786) #endif #if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32) -#pragma set woff 1174 -#pragma set woff 1375 +# pragma set woff 1174 +# pragma set woff 1375 #endif namespace @KWSYS_NAMESPACE@ { @@ -412,12 +412,12 @@ inline void swap(hash_multimap<_Key, _Tp, _HashFcn, _EqlKey, _Alloc>& __hm1, } // namespace @KWSYS_NAMESPACE@ #if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32) -#pragma reset woff 1174 -#pragma reset woff 1375 +# pragma reset woff 1174 +# pragma reset woff 1375 #endif #if defined(_MSC_VER) -#pragma warning(pop) +# pragma warning(pop) #endif #endif diff --git a/Source/kwsys/hash_set.hxx.in b/Source/kwsys/hash_set.hxx.in index 5edd367af7..f4a37eebdb 100644 --- a/Source/kwsys/hash_set.hxx.in +++ b/Source/kwsys/hash_set.hxx.in @@ -35,14 +35,14 @@ #include <functional> // equal_to #if defined(_MSC_VER) -#pragma warning(push) -#pragma warning(disable : 4284) -#pragma warning(disable : 4786) +# pragma warning(push) +# pragma warning(disable : 4284) +# pragma warning(disable : 4786) #endif #if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32) -#pragma set woff 1174 -#pragma set woff 1375 +# pragma set woff 1174 +# pragma set woff 1375 #endif namespace @KWSYS_NAMESPACE@ { @@ -381,12 +381,12 @@ inline void swap(hash_multiset<_Val, _HashFcn, _EqualKey, _Alloc>& __hs1, } // namespace @KWSYS_NAMESPACE@ #if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32) -#pragma reset woff 1174 -#pragma reset woff 1375 +# pragma reset woff 1174 +# pragma reset woff 1375 #endif #if defined(_MSC_VER) -#pragma warning(pop) +# pragma warning(pop) #endif #endif diff --git a/Source/kwsys/hashtable.hxx.in b/Source/kwsys/hashtable.hxx.in index e962f17a99..fc0d60e7d3 100644 --- a/Source/kwsys/hashtable.hxx.in +++ b/Source/kwsys/hashtable.hxx.in @@ -26,42 +26,42 @@ * */ #ifdef __BORLANDC__ -#pragma warn - 8027 /* 'for' not inlined. */ -#pragma warn - 8026 /* 'exception' not inlined. */ +# pragma warn - 8027 /* 'for' not inlined. */ +# pragma warn - 8026 /* 'exception' not inlined. */ #endif #ifndef @KWSYS_NAMESPACE@_hashtable_hxx -#define @KWSYS_NAMESPACE@_hashtable_hxx - -#include <@KWSYS_NAMESPACE@/Configure.hxx> - -#include <algorithm> // lower_bound -#include <iterator> // iterator_traits -#include <memory> // allocator -#include <stddef.h> // size_t -#include <utility> // pair -#include <vector> // vector - -#if defined(_MSC_VER) -#pragma warning(push) -#pragma warning(disable : 4284) -#pragma warning(disable : 4786) -#pragma warning(disable : 4512) /* no assignment operator for class */ -#endif -#if defined(__sgi) && !defined(__GNUC__) -#pragma set woff 3970 /* pointer to int conversion */ 3321 3968 -#endif +# define @KWSYS_NAMESPACE@_hashtable_hxx + +# include <@KWSYS_NAMESPACE@/Configure.hxx> + +# include <algorithm> // lower_bound +# include <iterator> // iterator_traits +# include <memory> // allocator +# include <stddef.h> // size_t +# include <utility> // pair +# include <vector> // vector + +# if defined(_MSC_VER) +# pragma warning(push) +# pragma warning(disable : 4284) +# pragma warning(disable : 4786) +# pragma warning(disable : 4512) /* no assignment operator for class */ +# endif +# if defined(__sgi) && !defined(__GNUC__) +# pragma set woff 3970 /* pointer to int conversion */ 3321 3968 +# endif // In C++11, clang will warn about using dynamic exception specifications // as they are deprecated. But as this class is trying to faithfully // mimic unordered_set and unordered_map, we want to keep the 'throw()' // decorations below. So we suppress the warning. -#if defined(__clang__) && defined(__has_warning) -#if __has_warning("-Wdeprecated") -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated" -#endif -#endif +# if defined(__clang__) && defined(__has_warning) +# if __has_warning("-Wdeprecated") +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wdeprecated" +# endif +# endif namespace @KWSYS_NAMESPACE@ { @@ -250,6 +250,7 @@ private: public: typedef typename _Alloc::template rebind<_Val>::other allocator_type; allocator_type get_allocator() const { return _M_node_allocator; } + private: typedef typename _Alloc::template rebind<_Node>::other _M_node_allocator_type; @@ -568,7 +569,7 @@ private: template <class _Val, class _Key, class _HF, class _ExK, class _EqK, class _All> _Hashtable_iterator<_Val, _Key, _HF, _ExK, _EqK, _All>& - _Hashtable_iterator<_Val, _Key, _HF, _ExK, _EqK, _All>::operator++() +_Hashtable_iterator<_Val, _Key, _HF, _ExK, _EqK, _All>::operator++() { const _Node* __old = _M_cur; _M_cur = _M_cur->_M_next; @@ -583,7 +584,7 @@ _Hashtable_iterator<_Val, _Key, _HF, _ExK, _EqK, _All>& template <class _Val, class _Key, class _HF, class _ExK, class _EqK, class _All> inline _Hashtable_iterator<_Val, _Key, _HF, _ExK, _EqK, _All> - _Hashtable_iterator<_Val, _Key, _HF, _ExK, _EqK, _All>::operator++(int) +_Hashtable_iterator<_Val, _Key, _HF, _ExK, _EqK, _All>::operator++(int) { iterator __tmp = *this; ++*this; @@ -593,7 +594,7 @@ inline _Hashtable_iterator<_Val, _Key, _HF, _ExK, _EqK, _All> template <class _Val, class _Key, class _HF, class _ExK, class _EqK, class _All> _Hashtable_const_iterator<_Val, _Key, _HF, _ExK, _EqK, _All>& - _Hashtable_const_iterator<_Val, _Key, _HF, _ExK, _EqK, _All>::operator++() +_Hashtable_const_iterator<_Val, _Key, _HF, _ExK, _EqK, _All>::operator++() { const _Node* __old = _M_cur; _M_cur = _M_cur->_M_next; @@ -608,7 +609,7 @@ _Hashtable_const_iterator<_Val, _Key, _HF, _ExK, _EqK, _All>& template <class _Val, class _Key, class _HF, class _ExK, class _EqK, class _All> inline _Hashtable_const_iterator<_Val, _Key, _HF, _ExK, _EqK, _All> - _Hashtable_const_iterator<_Val, _Key, _HF, _ExK, _EqK, _All>::operator++(int) +_Hashtable_const_iterator<_Val, _Key, _HF, _ExK, _EqK, _All>::operator++(int) { const_iterator __tmp = *this; ++*this; @@ -693,8 +694,9 @@ hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::insert_equal_noresize( } template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All> -typename hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::reference hashtable< - _Val, _Key, _HF, _Ex, _Eq, _All>::find_or_insert(const value_type& __obj) +typename hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::reference +hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::find_or_insert( + const value_type& __obj) { resize(_M_num_elements + 1); @@ -962,7 +964,7 @@ void hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::_M_copy_from( _Node* __copy = _M_new_node(__cur->_M_val); _M_buckets[__i] = __copy; - for (_Node *__next = __cur->_M_next; __next; + for (_Node* __next = __cur->_M_next; __next; __cur = __next, __next = __cur->_M_next) { __copy->_M_next = _M_new_node(__next->_M_val); __copy = __copy->_M_next; @@ -979,14 +981,14 @@ void hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::_M_copy_from( } // namespace @KWSYS_NAMESPACE@ // Undo warning suppression. -#if defined(__clang__) && defined(__has_warning) -#if __has_warning("-Wdeprecated") -#pragma clang diagnostic pop -#endif -#endif - -#if defined(_MSC_VER) -#pragma warning(pop) -#endif +# if defined(__clang__) && defined(__has_warning) +# if __has_warning("-Wdeprecated") +# pragma clang diagnostic pop +# endif +# endif + +# if defined(_MSC_VER) +# pragma warning(pop) +# endif #endif diff --git a/Source/kwsys/kwsysPlatformTestsC.c b/Source/kwsys/kwsysPlatformTestsC.c index 5432633eb8..b0cf7ad3b0 100644 --- a/Source/kwsys/kwsysPlatformTestsC.c +++ b/Source/kwsys/kwsysPlatformTestsC.c @@ -17,18 +17,18 @@ } */ #if defined(__CLASSIC_C__) -#define KWSYS_PLATFORM_TEST_C_MAIN() main() -#define KWSYS_PLATFORM_TEST_C_MAIN_ARGS(argc, argv) \ - main(argc, argv) int argc; \ - char* argv[]; +# define KWSYS_PLATFORM_TEST_C_MAIN() main() +# define KWSYS_PLATFORM_TEST_C_MAIN_ARGS(argc, argv) \ + main(argc, argv) int argc; \ + char* argv[]; #else -#define KWSYS_PLATFORM_TEST_C_MAIN() main(void) -#define KWSYS_PLATFORM_TEST_C_MAIN_ARGS(argc, argv) \ - main(int argc, char* argv[]) +# define KWSYS_PLATFORM_TEST_C_MAIN() main(void) +# define KWSYS_PLATFORM_TEST_C_MAIN_ARGS(argc, argv) \ + main(int argc, char* argv[]) #endif #ifdef TEST_KWSYS_C_HAS_PTRDIFF_T -#include <stddef.h> +# include <stddef.h> int f(ptrdiff_t n) { return n > 0; @@ -43,7 +43,7 @@ int KWSYS_PLATFORM_TEST_C_MAIN() #endif #ifdef TEST_KWSYS_C_HAS_SSIZE_T -#include <unistd.h> +# include <unistd.h> int f(ssize_t n) { return (int)n; @@ -56,13 +56,13 @@ int KWSYS_PLATFORM_TEST_C_MAIN() #endif #ifdef TEST_KWSYS_C_HAS_CLOCK_GETTIME_MONOTONIC -#if defined(__APPLE__) -#include <AvailabilityMacros.h> -#if MAC_OS_X_VERSION_MIN_REQUIRED < 101200 -#error "clock_gettime not available on macOS < 10.12" -#endif -#endif -#include <time.h> +# if defined(__APPLE__) +# include <AvailabilityMacros.h> +# if MAC_OS_X_VERSION_MIN_REQUIRED < 101200 +# error "clock_gettime not available on macOS < 10.12" +# endif +# endif +# include <time.h> int KWSYS_PLATFORM_TEST_C_MAIN() { struct timespec ts; @@ -72,30 +72,30 @@ int KWSYS_PLATFORM_TEST_C_MAIN() #ifdef TEST_KWSYS_C_TYPE_MACROS char* info_macros = -#if defined(__SIZEOF_SHORT__) +# if defined(__SIZEOF_SHORT__) "INFO:macro[__SIZEOF_SHORT__]\n" -#endif -#if defined(__SIZEOF_INT__) +# endif +# if defined(__SIZEOF_INT__) "INFO:macro[__SIZEOF_INT__]\n" -#endif -#if defined(__SIZEOF_LONG__) +# endif +# if defined(__SIZEOF_LONG__) "INFO:macro[__SIZEOF_LONG__]\n" -#endif -#if defined(__SIZEOF_LONG_LONG__) +# endif +# if defined(__SIZEOF_LONG_LONG__) "INFO:macro[__SIZEOF_LONG_LONG__]\n" -#endif -#if defined(__SHORT_MAX__) +# endif +# if defined(__SHORT_MAX__) "INFO:macro[__SHORT_MAX__]\n" -#endif -#if defined(__INT_MAX__) +# endif +# if defined(__INT_MAX__) "INFO:macro[__INT_MAX__]\n" -#endif -#if defined(__LONG_MAX__) +# endif +# if defined(__LONG_MAX__) "INFO:macro[__LONG_MAX__]\n" -#endif -#if defined(__LONG_LONG_MAX__) +# endif +# if defined(__LONG_LONG_MAX__) "INFO:macro[__LONG_LONG_MAX__]\n" -#endif +# endif ""; int KWSYS_PLATFORM_TEST_C_MAIN_ARGS(argc, argv) diff --git a/Source/kwsys/kwsysPlatformTestsCXX.cxx b/Source/kwsys/kwsysPlatformTestsCXX.cxx index f1f9ed351b..b77d7292a6 100644 --- a/Source/kwsys/kwsysPlatformTestsCXX.cxx +++ b/Source/kwsys/kwsysPlatformTestsCXX.cxx @@ -1,7 +1,7 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing#kwsys for details. */ #ifdef TEST_KWSYS_CXX_HAS_CSTDIO -#include <cstdio> +# include <cstdio> int main() { return 0; @@ -33,10 +33,10 @@ int main() #endif #ifdef TEST_KWSYS_CXX_STAT_HAS_ST_MTIM -#include <sys/types.h> +# include <sys/types.h> -#include <sys/stat.h> -#include <unistd.h> +# include <sys/stat.h> +# include <unistd.h> int main() { struct stat stat1; @@ -47,10 +47,10 @@ int main() #endif #ifdef TEST_KWSYS_CXX_STAT_HAS_ST_MTIMESPEC -#include <sys/types.h> +# include <sys/types.h> -#include <sys/stat.h> -#include <unistd.h> +# include <sys/stat.h> +# include <unistd.h> int main() { struct stat stat1; @@ -85,7 +85,7 @@ int main() #endif #ifdef TEST_KWSYS_IOS_HAS_ISTREAM_LONG_LONG -#include <iostream> +# include <iostream> int test_istream(std::istream& is, long long& x) { return (is >> x) ? 1 : 0; @@ -98,7 +98,7 @@ int main() #endif #ifdef TEST_KWSYS_IOS_HAS_OSTREAM_LONG_LONG -#include <iostream> +# include <iostream> int test_ostream(std::ostream& os, long long x) { return (os << x) ? 1 : 0; @@ -111,7 +111,7 @@ int main() #endif #ifdef TEST_KWSYS_IOS_HAS_ISTREAM___INT64 -#include <iostream> +# include <iostream> int test_istream(std::istream& is, __int64& x) { return (is >> x) ? 1 : 0; @@ -124,7 +124,7 @@ int main() #endif #ifdef TEST_KWSYS_IOS_HAS_OSTREAM___INT64 -#include <iostream> +# include <iostream> int test_ostream(std::ostream& os, __int64 x) { return (os << x) ? 1 : 0; @@ -138,23 +138,23 @@ int main() #ifdef TEST_KWSYS_LFS_WORKS /* Return 0 when LFS is available and 1 otherwise. */ -#define _LARGEFILE_SOURCE -#define _LARGEFILE64_SOURCE -#define _LARGE_FILES -#define _FILE_OFFSET_BITS 64 -#include <sys/types.h> - -#include <assert.h> -#include <sys/stat.h> -#if KWSYS_CXX_HAS_CSTDIO -#include <cstdio> -#endif -#include <stdio.h> +# define _LARGEFILE_SOURCE +# define _LARGEFILE64_SOURCE +# define _LARGE_FILES +# define _FILE_OFFSET_BITS 64 +# include <sys/types.h> + +# include <assert.h> +# include <sys/stat.h> +# if KWSYS_CXX_HAS_CSTDIO +# include <cstdio> +# endif +# include <stdio.h> int main(int, char** argv) { /* check that off_t can hold 2^63 - 1 and perform basic operations... */ -#define OFF_T_64 (((off_t)1 << 62) - 1 + ((off_t)1 << 62)) +# define OFF_T_64 (((off_t)1 << 62) - 1 + ((off_t)1 << 62)) if (OFF_T_64 % 2147483647 != 1) return 1; @@ -173,7 +173,7 @@ int main(int, char** argv) #endif #ifdef TEST_KWSYS_CXX_HAS_SETENV -#include <stdlib.h> +# include <stdlib.h> int main() { return setenv("A", "B", 1); @@ -181,7 +181,7 @@ int main() #endif #ifdef TEST_KWSYS_CXX_HAS_UNSETENV -#include <stdlib.h> +# include <stdlib.h> int main() { unsetenv("A"); @@ -190,7 +190,7 @@ int main() #endif #ifdef TEST_KWSYS_CXX_HAS_ENVIRON_IN_STDLIB_H -#include <stdlib.h> +# include <stdlib.h> int main() { char* e = environ[0]; @@ -200,10 +200,10 @@ int main() #ifdef TEST_KWSYS_CXX_HAS_GETLOADAVG // Match feature definitions from SystemInformation.cxx -#if (defined(__GNUC__) || defined(__PGI)) && !defined(_GNU_SOURCE) -#define _GNU_SOURCE -#endif -#include <stdlib.h> +# if (defined(__GNUC__) || defined(__PGI)) && !defined(_GNU_SOURCE) +# define _GNU_SOURCE +# endif +# include <stdlib.h> int main() { double loadavg[3] = { 0.0, 0.0, 0.0 }; @@ -212,13 +212,13 @@ int main() #endif #ifdef TEST_KWSYS_CXX_HAS_RLIMIT64 -#if defined(KWSYS_HAS_LFS) -#define _LARGEFILE_SOURCE -#define _LARGEFILE64_SOURCE -#define _LARGE_FILES -#define _FILE_OFFSET_BITS 64 -#endif -#include <sys/resource.h> +# if defined(KWSYS_HAS_LFS) +# define _LARGEFILE_SOURCE +# define _LARGEFILE64_SOURCE +# define _LARGE_FILES +# define _FILE_OFFSET_BITS 64 +# endif +# include <sys/resource.h> int main() { struct rlimit64 rlim; @@ -227,7 +227,7 @@ int main() #endif #ifdef TEST_KWSYS_CXX_HAS_ATOLL -#include <stdlib.h> +# include <stdlib.h> int main() { const char* str = "1024"; @@ -236,7 +236,7 @@ int main() #endif #ifdef TEST_KWSYS_CXX_HAS_ATOL -#include <stdlib.h> +# include <stdlib.h> int main() { const char* str = "1024"; @@ -245,7 +245,7 @@ int main() #endif #ifdef TEST_KWSYS_CXX_HAS__ATOI64 -#include <stdlib.h> +# include <stdlib.h> int main() { const char* str = "1024"; @@ -254,7 +254,7 @@ int main() #endif #ifdef TEST_KWSYS_CXX_HAS_UTIMES -#include <sys/time.h> +# include <sys/time.h> int main() { struct timeval* current_time = 0; @@ -263,14 +263,14 @@ int main() #endif #ifdef TEST_KWSYS_CXX_HAS_UTIMENSAT -#include <fcntl.h> -#include <sys/stat.h> -#if defined(__APPLE__) -#include <AvailabilityMacros.h> -#if MAC_OS_X_VERSION_MIN_REQUIRED < 101300 -#error "utimensat not available on macOS < 10.13" -#endif -#endif +# include <fcntl.h> +# include <sys/stat.h> +# if defined(__APPLE__) +# include <AvailabilityMacros.h> +# if MAC_OS_X_VERSION_MIN_REQUIRED < 101300 +# error "utimensat not available on macOS < 10.13" +# endif +# endif int main() { struct timespec times[2] = { { 0, UTIME_OMIT }, { 0, UTIME_NOW } }; @@ -279,14 +279,14 @@ int main() #endif #ifdef TEST_KWSYS_CXX_HAS_BACKTRACE -#if defined(__PATHSCALE__) || defined(__PATHCC__) || \ - (defined(__LSB_VERSION__) && (__LSB_VERSION__ < 41)) +# if defined(__PATHSCALE__) || defined(__PATHCC__) || \ + (defined(__LSB_VERSION__) && (__LSB_VERSION__ < 41)) backtrace does not work with this compiler or os -#endif -#if (defined(__GNUC__) || defined(__PGI)) && !defined(_GNU_SOURCE) -#define _GNU_SOURCE -#endif -#include <execinfo.h> +# endif +# if (defined(__GNUC__) || defined(__PGI)) && !defined(_GNU_SOURCE) +# define _GNU_SOURCE +# endif +# include <execinfo.h> int main() { void* stackSymbols[256]; @@ -297,10 +297,10 @@ int main() #endif #ifdef TEST_KWSYS_CXX_HAS_DLADDR -#if (defined(__GNUC__) || defined(__PGI)) && !defined(_GNU_SOURCE) -#define _GNU_SOURCE -#endif -#include <dlfcn.h> +# if (defined(__GNUC__) || defined(__PGI)) && !defined(_GNU_SOURCE) +# define _GNU_SOURCE +# endif +# include <dlfcn.h> int main() { Dl_info info; @@ -310,14 +310,14 @@ int main() #endif #ifdef TEST_KWSYS_CXX_HAS_CXXABI -#if (defined(__GNUC__) || defined(__PGI)) && !defined(_GNU_SOURCE) -#define _GNU_SOURCE -#endif -#if defined(__SUNPRO_CC) && __SUNPRO_CC >= 0x5130 && __linux && \ - __SUNPRO_CC_COMPAT == 'G' -#include <iostream> -#endif -#include <cxxabi.h> +# if (defined(__GNUC__) || defined(__PGI)) && !defined(_GNU_SOURCE) +# define _GNU_SOURCE +# endif +# if defined(__SUNPRO_CC) && __SUNPRO_CC >= 0x5130 && __linux && \ + __SUNPRO_CC_COMPAT == 'G' +# include <iostream> +# endif +# include <cxxabi.h> int main() { int status = 0; @@ -358,7 +358,7 @@ int main() #endif #ifdef TEST_KWSYS_STL_HAS_WSTRING -#include <string> +# include <string> void f(std::wstring*) { } @@ -369,7 +369,7 @@ int main() #endif #ifdef TEST_KWSYS_CXX_HAS_EXT_STDIO_FILEBUF_H -#include <ext/stdio_filebuf.h> +# include <ext/stdio_filebuf.h> int main() { return 0; diff --git a/Source/kwsys/kwsysPrivate.h b/Source/kwsys/kwsysPrivate.h index ce1b53ed85..dd9c1277fb 100644 --- a/Source/kwsys/kwsysPrivate.h +++ b/Source/kwsys/kwsysPrivate.h @@ -1,11 +1,11 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing#kwsys for details. */ #ifndef KWSYS_NAMESPACE -#error "Do not include kwsysPrivate.h outside of kwsys c and cxx files." +# error "Do not include kwsysPrivate.h outside of kwsys c and cxx files." #endif #ifndef _kwsysPrivate_h -#define _kwsysPrivate_h +# define _kwsysPrivate_h /* Define KWSYS_HEADER macro to help the c and cxx files include kwsys @@ -18,17 +18,17 @@ /* clang-format off */ #define KWSYS_HEADER(x) KWSYS_HEADER0(KWSYS_NAMESPACE/x) /* clang-format on */ -#define KWSYS_HEADER0(x) KWSYS_HEADER1(x) -#define KWSYS_HEADER1(x) <x> +# define KWSYS_HEADER0(x) KWSYS_HEADER1(x) +# define KWSYS_HEADER1(x) <x> /* Define KWSYS_NAMESPACE_STRING to be a string constant containing the name configured for this instance of the kwsys library. */ -#define KWSYS_NAMESPACE_STRING KWSYS_NAMESPACE_STRING0(KWSYS_NAMESPACE) -#define KWSYS_NAMESPACE_STRING0(x) KWSYS_NAMESPACE_STRING1(x) -#define KWSYS_NAMESPACE_STRING1(x) #x +# define KWSYS_NAMESPACE_STRING KWSYS_NAMESPACE_STRING0(KWSYS_NAMESPACE) +# define KWSYS_NAMESPACE_STRING0(x) KWSYS_NAMESPACE_STRING1(x) +# define KWSYS_NAMESPACE_STRING1(x) # x #else -#error "kwsysPrivate.h included multiple times." +# error "kwsysPrivate.h included multiple times." #endif diff --git a/Source/kwsys/testCommandLineArguments.cxx b/Source/kwsys/testCommandLineArguments.cxx index 58f861cbe4..0385a3dc68 100644 --- a/Source/kwsys/testCommandLineArguments.cxx +++ b/Source/kwsys/testCommandLineArguments.cxx @@ -6,7 +6,7 @@ // Work-around CMake dependency scanning limitation. This must // duplicate the above list of headers. #if 0 -#include "CommandLineArguments.hxx.in" +# include "CommandLineArguments.hxx.in" #endif #include <iostream> diff --git a/Source/kwsys/testCommandLineArguments1.cxx b/Source/kwsys/testCommandLineArguments1.cxx index 5dfa5e3f3a..9895008f02 100644 --- a/Source/kwsys/testCommandLineArguments1.cxx +++ b/Source/kwsys/testCommandLineArguments1.cxx @@ -6,7 +6,7 @@ // Work-around CMake dependency scanning limitation. This must // duplicate the above list of headers. #if 0 -#include "CommandLineArguments.hxx.in" +# include "CommandLineArguments.hxx.in" #endif #include <iostream> diff --git a/Source/kwsys/testConfigure.cxx b/Source/kwsys/testConfigure.cxx index 916dcc1351..a3c2ed3aed 100644 --- a/Source/kwsys/testConfigure.cxx +++ b/Source/kwsys/testConfigure.cxx @@ -6,7 +6,7 @@ file Copyright.txt or https://cmake.org/licensing#kwsys for details. */ // Work-around CMake dependency scanning limitation. This must // duplicate the above list of headers. #if 0 -#include "Configure.hxx.in" +# include "Configure.hxx.in" #endif static bool testFallthrough(int n) diff --git a/Source/kwsys/testConsoleBuf.cxx b/Source/kwsys/testConsoleBuf.cxx index 816a4338e6..1549440585 100644 --- a/Source/kwsys/testConsoleBuf.cxx +++ b/Source/kwsys/testConsoleBuf.cxx @@ -13,24 +13,24 @@ // Work-around CMake dependency scanning limitation. This must // duplicate the above list of headers. #if 0 -#include "Encoding.hxx.in" +# include "Encoding.hxx.in" #endif #if defined(_WIN32) -#include <algorithm> -#include <iomanip> -#include <iostream> -#include <stdexcept> -#include <string.h> -#include <wchar.h> -#include <windows.h> +# include <algorithm> +# include <iomanip> +# include <iostream> +# include <stdexcept> +# include <string.h> +# include <wchar.h> +# include <windows.h> -#include "testConsoleBuf.hxx" +# include "testConsoleBuf.hxx" -#if defined(_MSC_VER) && _MSC_VER >= 1800 -#define KWSYS_WINDOWS_DEPRECATED_GetVersion -#endif +# if defined(_MSC_VER) && _MSC_VER >= 1800 +# define KWSYS_WINDOWS_DEPRECATED_GetVersion +# endif // يونيكود static const WCHAR UnicodeInputTestString[] = L"\u064A\u0648\u0646\u064A\u0643\u0648\u062F!"; @@ -219,9 +219,9 @@ static void finishFile(HANDLE file) } } -#ifndef MAPVK_VK_TO_VSC -#define MAPVK_VK_TO_VSC (0) -#endif +# ifndef MAPVK_VK_TO_VSC +# define MAPVK_VK_TO_VSC (0) +# endif static void writeInputKeyEvent(INPUT_RECORD inputBuffer[], WCHAR chr) { @@ -470,9 +470,9 @@ static int testFile() return didFail; } -#ifndef _WIN32_WINNT_VISTA -#define _WIN32_WINNT_VISTA 0x0600 -#endif +# ifndef _WIN32_WINNT_VISTA +# define _WIN32_WINNT_VISTA 0x0600 +# endif static int testConsole() { @@ -495,19 +495,19 @@ static int testConsole() DWORD FaceNameSize = sizeof(FaceName); DWORD FontFamily = TestFontFamily; DWORD FontSize = TestFontSize; -#ifdef KWSYS_WINDOWS_DEPRECATED_GetVersion -#pragma warning(push) -#ifdef __INTEL_COMPILER -#pragma warning(disable : 1478) -#else -#pragma warning(disable : 4996) -#endif -#endif +# ifdef KWSYS_WINDOWS_DEPRECATED_GetVersion +# pragma warning(push) +# ifdef __INTEL_COMPILER +# pragma warning(disable : 1478) +# else +# pragma warning(disable : 4996) +# endif +# endif const bool isVistaOrGreater = LOBYTE(LOWORD(GetVersion())) >= HIBYTE(_WIN32_WINNT_VISTA); -#ifdef KWSYS_WINDOWS_DEPRECATED_GetVersion -#pragma warning(pop) -#endif +# ifdef KWSYS_WINDOWS_DEPRECATED_GetVersion +# pragma warning(pop) +# endif if (!isVistaOrGreater) { if (RegOpenKeyExW(HKEY_CURRENT_USER, L"Console", 0, KEY_READ | KEY_WRITE, &hConsoleKey) == ERROR_SUCCESS) { @@ -573,7 +573,7 @@ static int testConsole() newConsole = true; } -#if _WIN32_WINNT >= _WIN32_WINNT_VISTA +# if _WIN32_WINNT >= _WIN32_WINNT_VISTA if (isVistaOrGreater) { CONSOLE_FONT_INFOEX consoleFont; memset(&consoleFont, 0, sizeof(consoleFont)); @@ -603,7 +603,7 @@ static int testConsole() std::cerr << "GetCurrentConsoleFontEx failed!" << std::endl; } } else { -#endif +# endif if (restoreConsole && RegOpenKeyExW(HKEY_CURRENT_USER, L"Console", 0, KEY_WRITE, &hConsoleKey) == ERROR_SUCCESS) { @@ -619,9 +619,9 @@ static int testConsole() sizeof(FontSize)); RegCloseKey(hConsoleKey); } -#if _WIN32_WINNT >= _WIN32_WINNT_VISTA +# if _WIN32_WINNT >= _WIN32_WINNT_VISTA } -#endif +# endif if (createProcess(NULL, NULL, NULL)) { try { diff --git a/Source/kwsys/testConsoleBufChild.cxx b/Source/kwsys/testConsoleBufChild.cxx index 6a743edcda..3c8fdc2e13 100644 --- a/Source/kwsys/testConsoleBufChild.cxx +++ b/Source/kwsys/testConsoleBufChild.cxx @@ -8,8 +8,8 @@ // Work-around CMake dependency scanning limitation. This must // duplicate the above list of headers. #if 0 -#include "ConsoleBuf.hxx.in" -#include "Encoding.hxx.in" +# include "ConsoleBuf.hxx.in" +# include "Encoding.hxx.in" #endif #include <iostream> diff --git a/Source/kwsys/testDirectory.cxx b/Source/kwsys/testDirectory.cxx index 62a09863f1..b1ab0c8727 100644 --- a/Source/kwsys/testDirectory.cxx +++ b/Source/kwsys/testDirectory.cxx @@ -8,9 +8,9 @@ file Copyright.txt or https://cmake.org/licensing#kwsys for details. */ // Work-around CMake dependency scanning limitation. This must // duplicate the above list of headers. #if 0 -#include "Directory.hxx.in" -#include "Encoding.hxx.in" -#include "SystemTools.hxx.in" +# include "Directory.hxx.in" +# include "Encoding.hxx.in" +# include "SystemTools.hxx.in" #endif #include <fstream> diff --git a/Source/kwsys/testDynamicLoader.cxx b/Source/kwsys/testDynamicLoader.cxx index b52ddda8bd..ce87117a16 100644 --- a/Source/kwsys/testDynamicLoader.cxx +++ b/Source/kwsys/testDynamicLoader.cxx @@ -5,13 +5,13 @@ #include KWSYS_HEADER(DynamicLoader.hxx) #if defined(__BEOS__) || defined(__HAIKU__) -#include <be/kernel/OS.h> /* disable_debugger() API. */ +# include <be/kernel/OS.h> /* disable_debugger() API. */ #endif // Work-around CMake dependency scanning limitation. This must // duplicate the above list of headers. #if 0 -#include "DynamicLoader.hxx.in" +# include "DynamicLoader.hxx.in" #endif #include <iostream> diff --git a/Source/kwsys/testDynload.c b/Source/kwsys/testDynload.c index cdb9e5c358..c49f747df4 100644 --- a/Source/kwsys/testDynload.c +++ b/Source/kwsys/testDynload.c @@ -1,9 +1,9 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing#kwsys for details. */ #ifdef _WIN32 -#define DL_EXPORT __declspec(dllexport) +# define DL_EXPORT __declspec(dllexport) #else -#define DL_EXPORT +# define DL_EXPORT #endif DL_EXPORT int TestDynamicLoaderData = 0; diff --git a/Source/kwsys/testEncode.c b/Source/kwsys/testEncode.c index a20d46fd3b..b7b6dd8458 100644 --- a/Source/kwsys/testEncode.c +++ b/Source/kwsys/testEncode.c @@ -6,7 +6,7 @@ /* Work-around CMake dependency scanning limitation. This must duplicate the above list of headers. */ #if 0 -#include "MD5.h.in" +# include "MD5.h.in" #endif #include <stdio.h> diff --git a/Source/kwsys/testEncoding.cxx b/Source/kwsys/testEncoding.cxx index 6bf273f2c5..fdad1cdff5 100644 --- a/Source/kwsys/testEncoding.cxx +++ b/Source/kwsys/testEncoding.cxx @@ -3,7 +3,7 @@ #include "kwsysPrivate.h" #if defined(_MSC_VER) -#pragma warning(disable : 4786) +# pragma warning(disable : 4786) #endif #include KWSYS_HEADER(Encoding.hxx) @@ -18,8 +18,8 @@ // Work-around CMake dependency scanning limitation. This must // duplicate the above list of headers. #if 0 -#include "Encoding.h.in" -#include "Encoding.hxx.in" +# include "Encoding.h.in" +# include "Encoding.hxx.in" #endif static const unsigned char helloWorldStrings[][32] = { diff --git a/Source/kwsys/testFStream.cxx b/Source/kwsys/testFStream.cxx index a92a781c38..5009e98877 100644 --- a/Source/kwsys/testFStream.cxx +++ b/Source/kwsys/testFStream.cxx @@ -3,19 +3,19 @@ #include "kwsysPrivate.h" #if defined(_MSC_VER) -#pragma warning(disable : 4786) +# pragma warning(disable : 4786) #endif #include KWSYS_HEADER(FStream.hxx) #include <string.h> #ifdef __BORLANDC__ -#include <mem.h> /* memcmp */ +# include <mem.h> /* memcmp */ #endif // Work-around CMake dependency scanning limitation. This must // duplicate the above list of headers. #if 0 -#include "FStream.hxx.in" +# include "FStream.hxx.in" #endif #include <iostream> diff --git a/Source/kwsys/testHashSTL.cxx b/Source/kwsys/testHashSTL.cxx index 0444874732..4ed2f899d1 100644 --- a/Source/kwsys/testHashSTL.cxx +++ b/Source/kwsys/testHashSTL.cxx @@ -7,18 +7,19 @@ // Work-around CMake dependency scanning limitation. This must // duplicate the above list of headers. #if 0 -#include "hash_map.hxx.in" -#include "hash_set.hxx.in" +# include "hash_map.hxx.in" +# include "hash_set.hxx.in" #endif #include <iostream> #if defined(_MSC_VER) -#pragma warning(disable : 4786) +# pragma warning(disable : 4786) #endif #if defined(__sgi) && !defined(__GNUC__) -#pragma set woff 1468 /* inline function cannot be explicitly instantiated */ +# pragma set woff 1468 /* inline function cannot be explicitly instantiated \ + */ #endif template class kwsys::hash_map<const char*, int>; diff --git a/Source/kwsys/testProcess.c b/Source/kwsys/testProcess.c index 4b4978dfe5..f139f58609 100644 --- a/Source/kwsys/testProcess.c +++ b/Source/kwsys/testProcess.c @@ -7,8 +7,8 @@ /* Work-around CMake dependency scanning limitation. This must duplicate the above list of headers. */ #if 0 -#include "Encoding.h.in" -#include "Process.h.in" +# include "Encoding.h.in" +# include "Process.h.in" #endif #include <assert.h> @@ -18,21 +18,21 @@ #include <string.h> #if defined(_WIN32) -#include <windows.h> +# include <windows.h> #else -#include <signal.h> -#include <unistd.h> +# include <signal.h> +# include <unistd.h> #endif #if defined(__BORLANDC__) -#pragma warn - 8060 /* possibly incorrect assignment */ +# pragma warn - 8060 /* possibly incorrect assignment */ #endif /* Platform-specific sleep functions. */ #if defined(__BEOS__) && !defined(__ZETA__) /* BeOS 5 doesn't have usleep(), but it has snooze(), which is identical. */ -#include <be/kernel/OS.h> +# include <be/kernel/OS.h> static inline void testProcess_usleep(unsigned int usec) { snooze(usec); @@ -44,7 +44,7 @@ static void testProcess_usleep(unsigned int usec) Sleep(usec / 1000); } #else -#define testProcess_usleep usleep +# define testProcess_usleep usleep #endif #if defined(_WIN32) @@ -481,20 +481,23 @@ static int runChild2(kwsysProcess* kp, const char* cmd[], int state, if (result) { if (exception != kwsysProcess_GetExitException(kp)) { - fprintf(stderr, "Mismatch in exit exception. " - "Should have been %d, was %d.\n", + fprintf(stderr, + "Mismatch in exit exception. " + "Should have been %d, was %d.\n", exception, kwsysProcess_GetExitException(kp)); } if (value != kwsysProcess_GetExitValue(kp)) { - fprintf(stderr, "Mismatch in exit value. " - "Should have been %d, was %d.\n", + fprintf(stderr, + "Mismatch in exit value. " + "Should have been %d, was %d.\n", value, kwsysProcess_GetExitValue(kp)); } } if (kwsysProcess_GetState(kp) != state) { - fprintf(stderr, "Mismatch in state. " - "Should have been %d, was %d.\n", + fprintf(stderr, + "Mismatch in state. " + "Should have been %d, was %d.\n", state, kwsysProcess_GetState(kp)); result = 1; } diff --git a/Source/kwsys/testSharedForward.c.in b/Source/kwsys/testSharedForward.c.in index 9a0c0c0614..b3eb413828 100644 --- a/Source/kwsys/testSharedForward.c.in +++ b/Source/kwsys/testSharedForward.c.in @@ -1,11 +1,11 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing#kwsys for details. */ #if defined(CMAKE_INTDIR) -#define CONFIG_DIR_PRE CMAKE_INTDIR "/" -#define CONFIG_DIR_POST "/" CMAKE_INTDIR +# define CONFIG_DIR_PRE CMAKE_INTDIR "/" +# define CONFIG_DIR_POST "/" CMAKE_INTDIR #else -#define CONFIG_DIR_PRE "" -#define CONFIG_DIR_POST "" +# define CONFIG_DIR_PRE "" +# define CONFIG_DIR_POST "" #endif #define @KWSYS_NAMESPACE@_SHARED_FORWARD_DIR_BUILD "@EXEC_DIR@" #define @KWSYS_NAMESPACE@_SHARED_FORWARD_PATH_BUILD "." CONFIG_DIR_POST @@ -18,7 +18,7 @@ #define @KWSYS_NAMESPACE@_SHARED_FORWARD_OPTION_PRINT "--print" #define @KWSYS_NAMESPACE@_SHARED_FORWARD_OPTION_LDD "--ldd" #if defined(CMAKE_INTDIR) -#define @KWSYS_NAMESPACE@_SHARED_FORWARD_CONFIG_NAME CMAKE_INTDIR +# define @KWSYS_NAMESPACE@_SHARED_FORWARD_CONFIG_NAME CMAKE_INTDIR #endif #include <@KWSYS_NAMESPACE@/SharedForward.h> int main(int argc, char** argv) diff --git a/Source/kwsys/testSystemInformation.cxx b/Source/kwsys/testSystemInformation.cxx index 3a9217f2c7..154517eae4 100644 --- a/Source/kwsys/testSystemInformation.cxx +++ b/Source/kwsys/testSystemInformation.cxx @@ -6,25 +6,25 @@ // Work-around CMake dependency scanning limitation. This must // duplicate the above list of headers. #if 0 -#include "SystemInformation.hxx.in" +# include "SystemInformation.hxx.in" #endif #include <iostream> #if defined(KWSYS_USE_LONG_LONG) -#if defined(KWSYS_IOS_HAS_OSTREAM_LONG_LONG) -#define iostreamLongLong(x) (x) -#else -#define iostreamLongLong(x) ((long)x) -#endif +# if defined(KWSYS_IOS_HAS_OSTREAM_LONG_LONG) +# define iostreamLongLong(x) (x) +# else +# define iostreamLongLong(x) ((long)x) +# endif #elif defined(KWSYS_USE___INT64) -#if defined(KWSYS_IOS_HAS_OSTREAM___INT64) -#define iostreamLongLong(x) (x) +# if defined(KWSYS_IOS_HAS_OSTREAM___INT64) +# define iostreamLongLong(x) (x) +# else +# define iostreamLongLong(x) ((long)x) +# endif #else -#define iostreamLongLong(x) ((long)x) -#endif -#else -#error "No Long Long" +# error "No Long Long" #endif #define printMethod(info, m) std::cout << #m << ": " << info.m() << "\n" @@ -86,7 +86,7 @@ int testSystemInformation(int, char* []) } /* test stack trace - */ + */ std::cout << "Program Stack:" << std::endl << kwsys::SystemInformation::GetProgramStack(0, 0) << std::endl << std::endl; diff --git a/Source/kwsys/testSystemTools.cxx b/Source/kwsys/testSystemTools.cxx index 8c928d40c6..e6f9701c3c 100644 --- a/Source/kwsys/testSystemTools.cxx +++ b/Source/kwsys/testSystemTools.cxx @@ -3,7 +3,7 @@ #include "kwsysPrivate.h" #if defined(_MSC_VER) -#pragma warning(disable : 4786) +# pragma warning(disable : 4786) #endif #include KWSYS_HEADER(FStream.hxx) @@ -12,8 +12,8 @@ // Work-around CMake dependency scanning limitation. This must // duplicate the above list of headers. #if 0 -#include "FStream.hxx.in" -#include "SystemTools.hxx.in" +# include "FStream.hxx.in" +# include "SystemTools.hxx.in" #endif // Include with <> instead of "" to avoid getting any in-source copy @@ -25,10 +25,10 @@ #include <stdlib.h> /* free */ #include <string.h> /* strcmp */ #if defined(_WIN32) && !defined(__CYGWIN__) -#include <io.h> /* _umask (MSVC) / umask (Borland) */ -#ifdef _MSC_VER -#define umask _umask // Note this is still umask on Borland -#endif +# include <io.h> /* _umask (MSVC) / umask (Borland) */ +# ifdef _MSC_VER +# define umask _umask // Note this is still umask on Borland +# endif #endif #include <sys/stat.h> /* umask (POSIX), _S_I* constants (Windows) */ // Visual C++ does not define mode_t (note that Borland does, however). diff --git a/Source/kwsys/testTerminal.c b/Source/kwsys/testTerminal.c index f6c1eddb7b..652830ccd9 100644 --- a/Source/kwsys/testTerminal.c +++ b/Source/kwsys/testTerminal.c @@ -6,7 +6,7 @@ /* Work-around CMake dependency scanning limitation. This must duplicate the above list of headers. */ #if 0 -#include "Terminal.h.in" +# include "Terminal.h.in" #endif int testTerminal(int argc, char* argv[]) |