diff options
author | David Cole <david.cole@kitware.com> | 2009-09-30 11:41:34 -0400 |
---|---|---|
committer | David Cole <david.cole@kitware.com> | 2009-09-30 11:41:34 -0400 |
commit | a9dcc7fd47048a25f79f04a0d0a57a81aede617b (patch) | |
tree | 367c4e907bdab9961e981e44a40de016fa7a574c | |
parent | 67530409a91156b06b3f8076bbd2e96969319fd4 (diff) | |
download | cmake-a9dcc7fd47048a25f79f04a0d0a57a81aede617b.tar.gz |
Fix warnings in CMake source code. Suppress warnings in Lexer and Parser files that are 'too hard' to fix.
-rw-r--r-- | CTestCustom.cmake.in | 1 | ||||
-rw-r--r-- | Source/cmCacheManager.cxx | 6 | ||||
-rw-r--r-- | Source/cmComputeLinkInformation.cxx | 4 | ||||
-rw-r--r-- | Source/cmFileCommand.cxx | 4 | ||||
-rw-r--r-- | Source/cmGlobalGenerator.cxx | 9 | ||||
-rw-r--r-- | Source/cmStringCommand.cxx | 2 | ||||
-rw-r--r-- | Source/kwsys/testProcess.c | 2 |
7 files changed, 18 insertions, 10 deletions
diff --git a/CTestCustom.cmake.in b/CTestCustom.cmake.in index 6d167f6623..a9d4d75d34 100644 --- a/CTestCustom.cmake.in +++ b/CTestCustom.cmake.in @@ -24,6 +24,7 @@ SET(CTEST_CUSTOM_WARNING_EXCEPTION "Clock skew detected" "remark\\(1209" "stl_deque.h:1051" + "(Lexer|Parser).*warning.*conversion.*may (alter its value|change the sign)" "Parser.cxx.*warning.*2111-D.*statement is unreachable" "CMakeSetupManifest.xml.*manifest authoring warning.*Unrecognized Element" ) diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx index b1f969a09a..e1a1076541 100644 --- a/Source/cmCacheManager.cxx +++ b/Source/cmCacheManager.cxx @@ -462,11 +462,13 @@ bool cmCacheManager::SaveCache(const char* path) if ( currentcwd[0] >= 'A' && currentcwd[0] <= 'Z' && currentcwd[1] == ':' ) { - currentcwd[0] = currentcwd[0] - 'A' + 'a'; + // Cast added to avoid compiler warning. Cast is ok because + // value is guaranteed to fit in char by the above if... + currentcwd[0] = static_cast<char>(currentcwd[0] - 'A' + 'a'); } cmSystemTools::ConvertToUnixSlashes(currentcwd); this->AddCacheEntry("CMAKE_CACHEFILE_DIR", currentcwd.c_str(), - "This is the directory where this CMakeCahe.txt" + "This is the directory where this CMakeCache.txt" " was created", cmCacheManager::INTERNAL); fout << "# This is the CMakeCache file.\n" diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx index 824408fbc5..69a4d22bb2 100644 --- a/Source/cmComputeLinkInformation.cxx +++ b/Source/cmComputeLinkInformation.cxx @@ -987,8 +987,8 @@ std::string cmComputeLinkInformation::NoCaseExpression(const char* str) else { ret += "["; - ret += tolower(*s); - ret += toupper(*s); + ret += static_cast<char>(tolower(*s)); + ret += static_cast<char>(toupper(*s)); ret += "]"; } s++; diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index dc2f37790f..a70ca75117 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -589,7 +589,9 @@ bool cmFileCommand::HandleStringsCommand(std::vector<std::string> const& args) (c == '\n' && newline_consume)) { // This is an ASCII character that may be part of a string. - s += c; + // Cast added to avoid compiler warning. Cast is ok because + // c is guaranteed to fit in char by the above if... + s += static_cast<char>(c); } else { diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 87bf616b0a..34cbe83d5e 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -889,7 +889,8 @@ void cmGlobalGenerator::Generate() this->LocalGenerators[i]->GenerateInstallRules(); this->LocalGenerators[i]->GenerateTestFiles(); this->CMakeInstance->UpdateProgress("Generating", - (i+1.0f)/this->LocalGenerators.size()); + (static_cast<float>(i)+1.0f)/ + static_cast<float>(this->LocalGenerators.size())); } this->SetCurrentLocalGenerator(0); @@ -996,7 +997,8 @@ void cmGlobalGenerator::CheckLocalGenerators() } } this->CMakeInstance->UpdateProgress - ("Configuring", 0.9f+0.1f*(i+1.0f)/this->LocalGenerators.size()); + ("Configuring", 0.9f+0.1f*(static_cast<float>(i)+1.0f)/ + static_cast<float>(this->LocalGenerators.size())); } if(notFoundMap.size()) @@ -1262,7 +1264,8 @@ void cmGlobalGenerator::AddLocalGenerator(cmLocalGenerator *lg) } int numGen = atoi(numGenC); - float prog = 0.9f*this->LocalGenerators.size()/numGen; + float prog = 0.9f*static_cast<float>(this->LocalGenerators.size())/ + static_cast<float>(numGen); if (prog > 0.9f) { prog = 0.9f; diff --git a/Source/cmStringCommand.cxx b/Source/cmStringCommand.cxx index 88d0b23ecc..134f9eabff 100644 --- a/Source/cmStringCommand.cxx +++ b/Source/cmStringCommand.cxx @@ -126,7 +126,7 @@ bool cmStringCommand::HandleAsciiCommand(std::vector<std::string> const& args) else { std::string error = "Character with code "; - error += ch; + error += args[cc]; error += " does not exist."; this->SetError(error.c_str()); return false; diff --git a/Source/kwsys/testProcess.c b/Source/kwsys/testProcess.c index 7c858dbe97..0060c4d1ff 100644 --- a/Source/kwsys/testProcess.c +++ b/Source/kwsys/testProcess.c @@ -266,7 +266,7 @@ int runChild2(kwsysProcess* kp, } else { - fwrite(data, 1, length, stdout); + fwrite(data, 1, (size_t) length, stdout); fflush(stdout); } } |