Fix warnings in CMake source code. Suppress rampant warnings emanating from Qt files.

This commit is contained in:
David Cole 2009-10-01 16:47:08 -04:00
parent 86459a89a1
commit 44bcba7461
10 changed files with 27 additions and 18 deletions

View File

@ -25,6 +25,7 @@ SET(CTEST_CUSTOM_WARNING_EXCEPTION
"remark\\(1209" "remark\\(1209"
"stl_deque.h:1051" "stl_deque.h:1051"
"(Lexer|Parser).*warning.*conversion.*may (alter its value|change the sign)" "(Lexer|Parser).*warning.*conversion.*may (alter its value|change the sign)"
"[Qq]t([Cc]ore|[Gg]ui).*warning.*conversion.*may alter its value"
"Parser.cxx.*warning.*2111-D.*statement is unreachable" "Parser.cxx.*warning.*2111-D.*statement is unreachable"
"CMakeSetupManifest.xml.*manifest authoring warning.*Unrecognized Element" "CMakeSetupManifest.xml.*manifest authoring warning.*Unrecognized Element"
) )

View File

@ -176,12 +176,12 @@ int cmCPackTGZ_Data_Close(void *client_data)
int n; int n;
uLong x = mydata->CRC; uLong x = mydata->CRC;
for (n = 0; n < 4; n++) { for (n = 0; n < 4; n++) {
buffer[n] = (int)(x & 0xff); buffer[n] = static_cast<char>(x & 0xff);
x >>= 8; x >>= 8;
} }
x = mydata->ZLibStream.total_in; x = mydata->ZLibStream.total_in;
for (n = 0; n < 4; n++) { for (n = 0; n < 4; n++) {
buffer[n+4] = (int)(x & 0xff); buffer[n+4] = static_cast<char>(x & 0xff);
x >>= 8; x >>= 8;
} }

View File

@ -596,8 +596,8 @@ void cmCTestBuildHandler::GenerateXMLLogScraped(std::ostream& os)
std::vector<cmCTestBuildErrorWarning>::iterator it; std::vector<cmCTestBuildErrorWarning>::iterator it;
// only report the first 50 warnings and first 50 errors // only report the first 50 warnings and first 50 errors
unsigned short numErrorsAllowed = this->MaxErrors; int numErrorsAllowed = this->MaxErrors;
unsigned short numWarningsAllowed = this->MaxWarnings; int numWarningsAllowed = this->MaxWarnings;
std::string srcdir = this->CTest->GetCTestConfiguration("SourceDirectory"); std::string srcdir = this->CTest->GetCTestConfiguration("SourceDirectory");
// make sure the source dir is in the correct case on windows // make sure the source dir is in the correct case on windows
// via a call to collapse full path. // via a call to collapse full path.

View File

@ -1590,13 +1590,13 @@ int cmCTestCoverageHandler::RunBullseyeSourceSummary(
std::string shortFileName = std::string shortFileName =
this->CTest->GetShortPathToFile(file.c_str()); this->CTest->GetShortPathToFile(file.c_str());
float cper = percentBranch + percentFunction; float cper = static_cast<float>(percentBranch + percentFunction);
if(totalBranches > 0) if(totalBranches > 0)
{ {
cper /= 2.0f; cper /= 2.0f;
} }
percent_coverage += cper; percent_coverage += cper;
float cmet = percentFunction + percentBranch; float cmet = static_cast<float>(percentFunction + percentBranch);
if(totalBranches > 0) if(totalBranches > 0)
{ {
cmet /= 2.0f; cmet /= 2.0f;

View File

@ -920,7 +920,7 @@ void cmCursesMainForm::HandleInput()
{ {
if ( this->SearchString.size() < static_cast<std::string::size_type>(x-10) ) if ( this->SearchString.size() < static_cast<std::string::size_type>(x-10) )
{ {
this->SearchString += key; this->SearchString += static_cast<char>(key);
} }
} }
else if ( key == ctrl('h') || key == KEY_BACKSPACE || key == KEY_DC ) else if ( key == ctrl('h') || key == KEY_BACKSPACE || key == KEY_DC )

View File

@ -172,7 +172,8 @@ cmHexFileConverter::FileType cmHexFileConverter::DetermineFileType(
return Binary; return Binary;
} }
fgets(buf, 1024, inFile); buf[0] = 0;
(void) fgets(buf, 1024, inFile);
fclose(inFile); fclose(inFile);
FileType type = Binary; FileType type = Binary;
unsigned int minLineLength = 0; unsigned int minLineLength = 0;

View File

@ -53,7 +53,7 @@ static void cmScriptGeneratorEncodeConfig(const char* config,
if(*c >= 'a' && *c <= 'z') if(*c >= 'a' && *c <= 'z')
{ {
result += "["; result += "[";
result += *c + ('A' - 'a'); result += static_cast<char>(*c + 'A' - 'a');
result += *c; result += *c;
result += "]"; result += "]";
} }
@ -61,7 +61,7 @@ static void cmScriptGeneratorEncodeConfig(const char* config,
{ {
result += "["; result += "[";
result += *c; result += *c;
result += *c + ('a' - 'A'); result += static_cast<char>(*c + 'a' - 'A');
result += "]"; result += "]";
} }
else else

View File

@ -338,7 +338,7 @@ bool cmSystemTools::IsOn(const char* val)
for(std::basic_string<char>::iterator c = v.begin(); for(std::basic_string<char>::iterator c = v.begin();
c != v.end(); c++) c != v.end(); c++)
{ {
*c = toupper(*c); *c = static_cast<char>(toupper(*c));
} }
return (v == "ON" || v == "1" || v == "YES" || v == "TRUE" || v == "Y"); return (v == "ON" || v == "1" || v == "YES" || v == "TRUE" || v == "Y");
} }
@ -371,7 +371,7 @@ bool cmSystemTools::IsOff(const char* val)
for(std::basic_string<char>::iterator c = v.begin(); for(std::basic_string<char>::iterator c = v.begin();
c != v.end(); c++) c != v.end(); c++)
{ {
*c = toupper(*c); *c = static_cast<char>(toupper(*c));
} }
return (v == "OFF" || v == "0" || v == "NO" || v == "FALSE" || return (v == "OFF" || v == "0" || v == "NO" || v == "FALSE" ||
v == "N" || cmSystemTools::IsNOTFOUND(v.c_str()) || v == "IGNORE"); v == "N" || cmSystemTools::IsNOTFOUND(v.c_str()) || v == "IGNORE");
@ -915,7 +915,8 @@ bool RunCommandViaPopen(const char* command,
#endif #endif
return false; return false;
} }
fgets(buffer, BUFFER_SIZE, cpipe); buffer[0] = 0;
(void) fgets(buffer, BUFFER_SIZE, cpipe);
while(!feof(cpipe)) while(!feof(cpipe))
{ {
if(verbose) if(verbose)
@ -924,7 +925,7 @@ bool RunCommandViaPopen(const char* command,
} }
output += buffer; output += buffer;
buffer[0] = 0; buffer[0] = 0;
fgets(buffer, BUFFER_SIZE, cpipe); (void) fgets(buffer, BUFFER_SIZE, cpipe);
} }
retVal = pclose(cpipe); retVal = pclose(cpipe);

View File

@ -1276,7 +1276,10 @@ int cmake::ExecuteCMakeCommand(std::vector<std::string>& args)
int count; int count;
if (countFile) if (countFile)
{ {
fscanf(countFile,"%i",&count); if (1!=fscanf(countFile,"%i",&count))
{
cmSystemTools::Message("Could not read from count file.");
}
fclose(countFile); fclose(countFile);
} }
else else
@ -1318,7 +1321,10 @@ int cmake::ExecuteCMakeCommand(std::vector<std::string>& args)
} }
else else
{ {
fscanf(progFile,"%i",&count); if (1!=fscanf(progFile,"%i",&count))
{
cmSystemTools::Message("Could not read from progress file.");
}
fclose(progFile); fclose(progFile);
} }
unsigned int i; unsigned int i;

View File

@ -29,7 +29,7 @@ void cmakewizard::AskUser(const char* key,
printf("New Value (Enter to keep current value): "); printf("New Value (Enter to keep current value): ");
char buffer[4096]; char buffer[4096];
buffer[0] = 0; buffer[0] = 0;
fgets(buffer, sizeof(buffer)-1, stdin); (void) fgets(buffer, sizeof(buffer)-1, stdin);
if(strlen(buffer) > 0) if(strlen(buffer) > 0)
{ {
@ -66,7 +66,7 @@ bool cmakewizard::AskAdvanced()
printf("Would you like to see advanced options? [No]:"); printf("Would you like to see advanced options? [No]:");
char buffer[4096]; char buffer[4096];
buffer[0] = 0; buffer[0] = 0;
fgets(buffer, sizeof(buffer)-1, stdin); (void) fgets(buffer, sizeof(buffer)-1, stdin);
if(buffer[0]) if(buffer[0])
{ {
if(buffer[0] == 'y' || buffer[0] == 'Y') if(buffer[0] == 'y' || buffer[0] == 'Y')