diff options
Diffstat (limited to 'Source')
-rw-r--r-- | Source/CMakeVersion.cmake | 2 | ||||
-rw-r--r-- | Source/cmGlobalNinjaGenerator.cxx | 11 | ||||
-rw-r--r-- | Source/cmGlobalNinjaGenerator.h | 1 | ||||
-rw-r--r-- | Source/cmNinjaTargetGenerator.cxx | 8 | ||||
-rw-r--r-- | Source/cmQtAutoGeneratorInitializer.cxx | 2 | ||||
-rw-r--r-- | Source/cmVisualStudio10TargetGenerator.cxx | 2 | ||||
-rw-r--r-- | Source/cmVisualStudio10ToolsetOptions.cxx | 1 | ||||
-rw-r--r-- | Source/kwsys/Directory.cxx | 2 | ||||
-rw-r--r-- | Source/kwsys/EncodingCXX.cxx | 8 | ||||
-rw-r--r-- | Source/kwsys/SystemInformation.cxx | 43 | ||||
-rw-r--r-- | Source/kwsys/SystemTools.cxx | 27 | ||||
-rw-r--r-- | Source/kwsys/SystemTools.hxx.in | 4 | ||||
-rw-r--r-- | Source/kwsys/testConsoleBuf.cxx | 10 | ||||
-rw-r--r-- | Source/kwsys/testSystemTools.cxx | 8 |
14 files changed, 66 insertions, 63 deletions
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 510911d..0555bd7 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 8) -set(CMake_VERSION_PATCH 20170529) +set(CMake_VERSION_PATCH 20170602) #set(CMake_VERSION_RC 1) diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index e1e165c..bb0b83a 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -146,13 +146,6 @@ std::string cmGlobalNinjaGenerator::EncodePath(const std::string& path) return EncodeLiteral(result); } -std::string cmGlobalNinjaGenerator::EncodeDepfileSpace(const std::string& path) -{ - std::string result = path; - cmSystemTools::ReplaceString(result, " ", "\\ "); - return result; -} - void cmGlobalNinjaGenerator::WriteBuild( std::ostream& os, const std::string& comment, const std::string& rule, const cmNinjaDeps& outputs, const cmNinjaDeps& implicitOuts, @@ -216,7 +209,7 @@ void cmGlobalNinjaGenerator::WriteBuild( ++i) { build += " " + EncodeIdent(EncodePath(*i), os); if (this->ComputingUnknownDependencies) { - this->CombinedBuildOutputs.insert(EncodePath(*i)); + this->CombinedBuildOutputs.insert(*i); } } if (!implicitOuts.empty()) { @@ -318,7 +311,7 @@ void cmGlobalNinjaGenerator::WriteCustomCommandBuild( // we need to track every dependency that comes in, since we are trying // to find dependencies that are side effects of build commands for (cmNinjaDeps::const_iterator i = deps.begin(); i != deps.end(); ++i) { - this->CombinedCustomCommandExplicitDependencies.insert(EncodePath(*i)); + this->CombinedCustomCommandExplicitDependencies.insert(*i); } } } diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h index b1d6155..41c5175 100644 --- a/Source/cmGlobalNinjaGenerator.h +++ b/Source/cmGlobalNinjaGenerator.h @@ -75,7 +75,6 @@ public: static std::string EncodeIdent(const std::string& ident, std::ostream& vars); static std::string EncodeLiteral(const std::string& lit); std::string EncodePath(const std::string& path); - static std::string EncodeDepfileSpace(const std::string& path); cmLinkLineComputer* CreateLinkLineComputer( cmOutputConverter* outputConverter, diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index 7e29681..2f4cccb 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -822,8 +822,8 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatement( vars["DEFINES"] = this->ComputeDefines(source, language); vars["INCLUDES"] = this->GetIncludes(language); if (!this->NeedDepTypeMSVC(language)) { - vars["DEP_FILE"] = - cmGlobalNinjaGenerator::EncodeDepfileSpace(objectFileName + ".d"); + vars["DEP_FILE"] = this->GetLocalGenerator()->ConvertToOutputFormat( + objectFileName + ".d", cmOutputConverter::SHELL); } this->ExportObjectCompileCommand( @@ -920,8 +920,8 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatement( vars["INCLUDES"] = sourceDirectoryFlag + " " + vars["INCLUDES"]; // Explicit preprocessing always uses a depfile. - ppVars["DEP_FILE"] = - cmGlobalNinjaGenerator::EncodeDepfileSpace(ppFileName + ".d"); + ppVars["DEP_FILE"] = this->GetLocalGenerator()->ConvertToOutputFormat( + ppFileName + ".d", cmOutputConverter::SHELL); // The actual compilation does not need a depfile because it // depends on the already-preprocessed source. vars.erase("DEP_FILE"); diff --git a/Source/cmQtAutoGeneratorInitializer.cxx b/Source/cmQtAutoGeneratorInitializer.cxx index e82665b..a39c10b 100644 --- a/Source/cmQtAutoGeneratorInitializer.cxx +++ b/Source/cmQtAutoGeneratorInitializer.cxx @@ -790,8 +790,6 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenTarget( bool usePRE_BUILD = false; cmGlobalGenerator* gg = lg->GetGlobalGenerator(); if (gg->GetName().find("Visual Studio") != std::string::npos) { - cmGlobalVisualStudioGenerator* vsgg = - static_cast<cmGlobalVisualStudioGenerator*>(gg); // Under VS use a PRE_BUILD event instead of a separate target to // reduce the number of targets loaded into the IDE. // This also works around a VS 11 bug that may skip updating the target: diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index e174f13..46c2894 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -3154,8 +3154,6 @@ bool cmVisualStudio10TargetGenerator::ComputeLinkOptions( // FIXME: Select flag table based on toolset instead of VS version. if (this->LocalGenerator->GetVersion() >= cmGlobalVisualStudioGenerator::VS14) { - cmGlobalVisualStudio10Generator* gg = - static_cast<cmGlobalVisualStudio10Generator*>(this->GlobalGenerator); const char* toolset = gg->GetPlatformToolset(); if (toolset && (toolset == kWINDOWS_7_1_SDK || /* clang-format please break here */ diff --git a/Source/cmVisualStudio10ToolsetOptions.cxx b/Source/cmVisualStudio10ToolsetOptions.cxx index 0f15ec4..afca216 100644 --- a/Source/cmVisualStudio10ToolsetOptions.cxx +++ b/Source/cmVisualStudio10ToolsetOptions.cxx @@ -11,7 +11,6 @@ #include "cmVS10LibFlagTable.h" #include "cmVS10LinkFlagTable.h" #include "cmVS10MASMFlagTable.h" -#include "cmVS10NASMFlagTable.h" #include "cmVS10RCFlagTable.h" #include "cmVS11CLFlagTable.h" #include "cmVS11CSharpFlagTable.h" diff --git a/Source/kwsys/Directory.cxx b/Source/kwsys/Directory.cxx index ca1cb18..5141d45 100644 --- a/Source/kwsys/Directory.cxx +++ b/Source/kwsys/Directory.cxx @@ -109,7 +109,7 @@ bool Directory::Load(const std::string& name) // Make sure the slashes in the wildcard suffix are consistent with the // rest of the path buf = new char[n + 2 + 1]; - if (name.find('\\') != name.npos) { + if (name.find('\\') != std::string::npos) { sprintf(buf, "%s\\*", name.c_str()); } else { sprintf(buf, "%s/*", name.c_str()); diff --git a/Source/kwsys/EncodingCXX.cxx b/Source/kwsys/EncodingCXX.cxx index 641c0e6..b1e54c9 100644 --- a/Source/kwsys/EncodingCXX.cxx +++ b/Source/kwsys/EncodingCXX.cxx @@ -147,11 +147,11 @@ std::wstring Encoding::ToWide(const std::string& str) wstr += ToWide(str.c_str() + pos); } nullPos = str.find('\0', pos); - if (nullPos != str.npos) { + if (nullPos != std::string::npos) { pos = nullPos + 1; wstr += wchar_t('\0'); } - } while (nullPos != str.npos); + } while (nullPos != std::string::npos); #endif return wstr; } @@ -181,11 +181,11 @@ std::string Encoding::ToNarrow(const std::wstring& str) nstr += ToNarrow(str.c_str() + pos); } nullPos = str.find(wchar_t('\0'), pos); - if (nullPos != str.npos) { + if (nullPos != std::string::npos) { pos = nullPos + 1; nstr += '\0'; } - } while (nullPos != str.npos); + } while (nullPos != std::string::npos); #endif return nstr; } diff --git a/Source/kwsys/SystemInformation.cxx b/Source/kwsys/SystemInformation.cxx index bfc895e..86fdccd 100644 --- a/Source/kwsys/SystemInformation.cxx +++ b/Source/kwsys/SystemInformation.cxx @@ -918,7 +918,8 @@ int LoadLines(const char* fileName, std::vector<std::string>& lines) // **************************************************************************** template <typename T> -int NameValue(std::vector<std::string>& lines, std::string name, T& value) +int NameValue(std::vector<std::string> const& lines, std::string const& name, + T& value) { size_t nLines = lines.size(); for (size_t i = 0; i < nLines; ++i) { @@ -1331,7 +1332,7 @@ std::string SymbolProperties::GetFileName(const std::string& path) const if (!this->ReportPath) { size_t at = file.rfind("/"); if (at != std::string::npos) { - file = file.substr(at + 1, std::string::npos); + file = file.substr(at + 1); } } return file; @@ -3341,11 +3342,11 @@ std::string SystemInformationImplementation::ExtractValueFromCpuInfoFile( std::string buffer, const char* word, size_t init) { size_t pos = buffer.find(word, init); - if (pos != buffer.npos) { + if (pos != std::string::npos) { this->CurrentPositionInFile = pos; pos = buffer.find(":", pos); size_t pos2 = buffer.find("\n", pos); - if (pos != buffer.npos && pos2 != buffer.npos) { + if (pos != std::string::npos && pos2 != std::string::npos) { // It may happen that the beginning matches, but this is still not the // requested key. // An example is looking for "cpu" when "cpu family" comes first. So we @@ -3360,7 +3361,7 @@ std::string SystemInformationImplementation::ExtractValueFromCpuInfoFile( return buffer.substr(pos + 2, pos2 - pos - 2); } } - this->CurrentPositionInFile = buffer.npos; + this->CurrentPositionInFile = std::string::npos; return ""; } @@ -3387,7 +3388,7 @@ bool SystemInformationImplementation::RetreiveInformationFromCpuInfoFile() // Number of logical CPUs (combination of multiple processors, multi-core // and SMT) size_t pos = buffer.find("processor\t"); - while (pos != buffer.npos) { + while (pos != std::string::npos) { this->NumberOfLogicalCPU++; pos = buffer.find("processor\t", pos + 1); } @@ -3396,7 +3397,7 @@ bool SystemInformationImplementation::RetreiveInformationFromCpuInfoFile() // Count sockets. std::set<int> PhysicalIDs; std::string idc = this->ExtractValueFromCpuInfoFile(buffer, "physical id"); - while (this->CurrentPositionInFile != buffer.npos) { + while (this->CurrentPositionInFile != std::string::npos) { int id = atoi(idc.c_str()); PhysicalIDs.insert(id); idc = this->ExtractValueFromCpuInfoFile(buffer, "physical id", @@ -3506,7 +3507,7 @@ bool SystemInformationImplementation::RetreiveInformationFromCpuInfoFile() this->ExtractValueFromCpuInfoFile(buffer, cachename[index]); if (!cacheSize.empty()) { pos = cacheSize.find(" KB"); - if (pos != cacheSize.npos) { + if (pos != std::string::npos) { cacheSize = cacheSize.substr(0, pos); } this->Features.L1CacheSize += atoi(cacheSize.c_str()); @@ -4585,10 +4586,10 @@ std::string SystemInformationImplementation::ExtractValueFromSysCtl( const char* word) { size_t pos = this->SysCtlBuffer.find(word); - if (pos != this->SysCtlBuffer.npos) { + if (pos != std::string::npos) { pos = this->SysCtlBuffer.find(": ", pos); size_t pos2 = this->SysCtlBuffer.find("\n", pos); - if (pos != this->SysCtlBuffer.npos && pos2 != this->SysCtlBuffer.npos) { + if (pos != std::string::npos && pos2 != std::string::npos) { return this->SysCtlBuffer.substr(pos + 2, pos2 - pos - 2); } } @@ -4660,14 +4661,14 @@ std::string SystemInformationImplementation::ParseValueFromKStat( args.push_back("-p"); std::string command = arguments; - size_t start = command.npos; + size_t start = std::string::npos; size_t pos = command.find(' ', 0); - while (pos != command.npos) { + while (pos != std::string::npos) { bool inQuotes = false; // Check if we are between quotes size_t b0 = command.find('"', 0); size_t b1 = command.find('"', b0 + 1); - while (b0 != command.npos && b1 != command.npos && b1 > b0) { + while (b0 != std::string::npos && b1 != std::string::npos && b1 > b0) { if (pos > b0 && pos < b1) { inQuotes = true; break; @@ -4681,7 +4682,7 @@ std::string SystemInformationImplementation::ParseValueFromKStat( // Remove the quotes if any size_t quotes = arg.find('"'); - while (quotes != arg.npos) { + while (quotes != std::string::npos) { arg.erase(quotes, 1); quotes = arg.find('"'); } @@ -4864,11 +4865,11 @@ bool SystemInformationImplementation::QueryQNXMemory() args.clear(); size_t pos = buffer.find("System RAM:"); - if (pos == buffer.npos) + if (pos == std::string::npos) return false; pos = buffer.find(":", pos); size_t pos2 = buffer.find("M (", pos); - if (pos2 == buffer.npos) + if (pos2 == std::string::npos) return false; pos++; @@ -4922,11 +4923,11 @@ bool SystemInformationImplementation::QueryQNXProcessor() args.clear(); size_t pos = buffer.find("Processor1:"); - if (pos == buffer.npos) + if (pos == std::string::npos) return false; size_t pos2 = buffer.find("MHz", pos); - if (pos2 == buffer.npos) + if (pos2 == std::string::npos) return false; size_t pos3 = pos2; @@ -4936,9 +4937,9 @@ bool SystemInformationImplementation::QueryQNXProcessor() this->CPUSpeedInMHz = atoi(buffer.substr(pos3 + 1, pos2 - pos3 - 1).c_str()); pos2 = buffer.find(" Stepping", pos); - if (pos2 != buffer.npos) { + if (pos2 != std::string::npos) { pos2 = buffer.find(" ", pos2 + 1); - if (pos2 != buffer.npos && pos2 < pos3) { + if (pos2 != std::string::npos && pos2 < pos3) { this->ChipID.Revision = atoi(buffer.substr(pos2 + 1, pos3 - pos2).c_str()); } @@ -4948,7 +4949,7 @@ bool SystemInformationImplementation::QueryQNXProcessor() do { pos = buffer.find("\nProcessor", pos + 1); ++this->NumberOfPhysicalCPU; - } while (pos != buffer.npos); + } while (pos != std::string::npos); this->NumberOfLogicalCPU = 1; return true; diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx index 5ca382f..1c4fe33 100644 --- a/Source/kwsys/SystemTools.cxx +++ b/Source/kwsys/SystemTools.cxx @@ -22,6 +22,7 @@ #include KWSYS_HEADER(FStream.hxx) #include KWSYS_HEADER(Encoding.hxx) +#include <algorithm> #include <fstream> #include <iostream> #include <set> @@ -553,7 +554,7 @@ bool SystemTools::HasEnv(const std::string& key) static int kwsysUnPutEnv(const std::string& env) { size_t pos = env.find('='); - if (pos != env.npos) { + if (pos != std::string::npos) { std::string name = env.substr(0, pos); unsetenv(name.c_str()); } else { @@ -569,7 +570,7 @@ static int kwsysUnPutEnv(const std::string& env) { int err = 0; size_t pos = env.find('='); - size_t const len = pos == env.npos ? env.size() : pos; + size_t const len = pos == std::string::npos ? env.size() : pos; size_t const sz = len + 1; char local_buf[256]; char* buf = sz > sizeof(local_buf) ? (char*)malloc(sz) : local_buf; @@ -603,7 +604,7 @@ static int kwsysUnPutEnv(std::string const& env) { std::wstring wEnv = Encoding::ToWide(env); size_t const pos = wEnv.find('='); - size_t const len = pos == wEnv.npos ? wEnv.size() : pos; + size_t const len = pos == std::string::npos ? wEnv.size() : pos; wEnv.resize(len + 1, L'='); wchar_t* newEnv = _wcsdup(wEnv.c_str()); if (!newEnv) { @@ -619,7 +620,7 @@ static int kwsysUnPutEnv(std::string const& env) static int kwsysUnPutEnv(const std::string& env) { size_t pos = env.find('='); - size_t const len = pos == env.npos ? env.size() : pos; + size_t const len = pos == std::string::npos ? env.size() : pos; int in = 0; int out = 0; while (environ[in]) { @@ -644,7 +645,7 @@ static int kwsysUnPutEnv(const std::string& env) bool SystemTools::PutEnv(const std::string& env) { size_t pos = env.find('='); - if (pos != env.npos) { + if (pos != std::string::npos) { std::string name = env.substr(0, pos); return setenv(name.c_str(), env.c_str() + pos + 1, 1) == 0; } else { @@ -1721,7 +1722,7 @@ std::string SystemTools::CropString(const std::string& s, size_t max_len) size_t middle = max_len / 2; n += s.substr(0, middle); - n += s.substr(s.size() - (max_len - middle), std::string::npos); + n += s.substr(s.size() - (max_len - middle)); if (max_len > 2) { n[middle] = '.'; @@ -1850,7 +1851,7 @@ static void ConvertVMSToUnix(std::string& path) { std::string::size_type rootEnd = path.find(":["); std::string::size_type pathEnd = path.find("]"); - if (rootEnd != path.npos) { + if (rootEnd != std::string::npos) { std::string root = path.substr(0, rootEnd); std::string pathPart = path.substr(rootEnd + 2, pathEnd - rootEnd - 2); const char* pathCString = pathPart.c_str(); @@ -3708,6 +3709,16 @@ std::string SystemTools::JoinPath( return result; } +void SystemTools::RemoveEmptyPathElements(std::vector<std::string>& path) +{ + if (path.empty()) { + return; + } + + path.erase(std::remove(path.begin() + 1, path.end(), std::string("")), + path.end()); +} + bool SystemTools::ComparePath(const std::string& c1, const std::string& c2) { #if defined(_WIN32) || defined(__APPLE__) @@ -4326,7 +4337,7 @@ bool SystemTools::GetPermissions(const std::string& file, mode_t& mode) mode |= S_IFREG; } size_t dotPos = file.rfind('.'); - const char* ext = dotPos == file.npos ? 0 : (file.c_str() + dotPos); + 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)) { mode |= (_S_IEXEC | (_S_IEXEC >> 3) | (_S_IEXEC >> 6)); diff --git a/Source/kwsys/SystemTools.hxx.in b/Source/kwsys/SystemTools.hxx.in index 0849e1d..5e091c2 100644 --- a/Source/kwsys/SystemTools.hxx.in +++ b/Source/kwsys/SystemTools.hxx.in @@ -474,6 +474,10 @@ public: static std::string JoinPath(std::vector<std::string>::const_iterator first, std::vector<std::string>::const_iterator last); + /** Removes empty components from path. + */ + static void RemoveEmptyPathElements(std::vector<std::string>& path); + /** * Compare a path or components of a path. */ diff --git a/Source/kwsys/testConsoleBuf.cxx b/Source/kwsys/testConsoleBuf.cxx index 21930f9..816a433 100644 --- a/Source/kwsys/testConsoleBuf.cxx +++ b/Source/kwsys/testConsoleBuf.cxx @@ -329,9 +329,8 @@ static int testPipe() throw std::runtime_error("ReadFile#3 failed!"); } buffer2[bytesRead] = 0; - didFail = - encodedTestString.compare(0, encodedTestString.npos, buffer2, - encodedTestString.size()) == 0 + didFail = encodedTestString.compare(0, std::string::npos, buffer2, + encodedTestString.size()) == 0 ? 0 : 1; } @@ -435,9 +434,8 @@ static int testFile() throw std::runtime_error("ReadFile#2 failed!"); } buffer2[bytesRead] = 0; - didFail = - encodedTestString.compare(0, encodedTestString.npos, buffer2, - encodedTestString.size()) == 0 + didFail = encodedTestString.compare(0, std::string::npos, buffer2, + encodedTestString.size()) == 0 ? 0 : 1; } diff --git a/Source/kwsys/testSystemTools.cxx b/Source/kwsys/testSystemTools.cxx index 900894c..e6fbf6c 100644 --- a/Source/kwsys/testSystemTools.cxx +++ b/Source/kwsys/testSystemTools.cxx @@ -54,7 +54,8 @@ static const char* toUnixPaths[][2] = { { 0, 0 } }; -static bool CheckConvertToUnixSlashes(std::string input, std::string output) +static bool CheckConvertToUnixSlashes(std::string const& input, + std::string const& output) { std::string result = input; kwsys::SystemTools::ConvertToUnixSlashes(result); @@ -71,8 +72,9 @@ static const char* checkEscapeChars[][4] = { { "1 foo 2 bar 2", "12", "\\", { " {} ", "{}", "#", " #{#} " }, { 0, 0, 0, 0 } }; -static bool CheckEscapeChars(std::string input, const char* chars_to_escape, - char escape_char, std::string output) +static bool CheckEscapeChars(std::string const& input, + const char* chars_to_escape, char escape_char, + std::string const& output) { std::string result = kwsys::SystemTools::EscapeChars( input.c_str(), chars_to_escape, escape_char); |