From a9dcc7fd47048a25f79f04a0d0a57a81aede617b Mon Sep 17 00:00:00 2001 From: David Cole Date: Wed, 30 Sep 2009 11:41:34 -0400 Subject: Fix warnings in CMake source code. Suppress warnings in Lexer and Parser files that are 'too hard' to fix. --- CTestCustom.cmake.in | 1 + Source/cmCacheManager.cxx | 6 ++++-- Source/cmComputeLinkInformation.cxx | 4 ++-- Source/cmFileCommand.cxx | 4 +++- Source/cmGlobalGenerator.cxx | 9 ++++++--- Source/cmStringCommand.cxx | 2 +- Source/kwsys/testProcess.c | 2 +- 7 files changed, 18 insertions(+), 10 deletions(-) diff --git a/CTestCustom.cmake.in b/CTestCustom.cmake.in index 6d167f6..a9d4d75 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 b1f969a..e1a1076 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(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 824408f..69a4d22 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(tolower(*s)); + ret += static_cast(toupper(*s)); ret += "]"; } s++; diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index dc2f377..a70ca75 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -589,7 +589,9 @@ bool cmFileCommand::HandleStringsCommand(std::vector 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(c); } else { diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 87bf616..34cbe83 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(i)+1.0f)/ + static_cast(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(i)+1.0f)/ + static_cast(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(this->LocalGenerators.size())/ + static_cast(numGen); if (prog > 0.9f) { prog = 0.9f; diff --git a/Source/cmStringCommand.cxx b/Source/cmStringCommand.cxx index 88d0b23..134f9ea 100644 --- a/Source/cmStringCommand.cxx +++ b/Source/cmStringCommand.cxx @@ -126,7 +126,7 @@ bool cmStringCommand::HandleAsciiCommand(std::vector 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 7c858db..0060c4d 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); } } -- cgit v0.12