Replace foo.size() pattern with !foo.empty().

This commit is contained in:
Stephen Kelly 2015-01-15 23:04:33 +01:00
parent aa773035b7
commit fd7b371293
42 changed files with 114 additions and 114 deletions

View File

@ -62,7 +62,7 @@ int cmCTestBuildAndTestHandler::RunCMake(std::string* outstring,
std::vector<std::string> args;
args.push_back(cmSystemTools::GetCMakeCommand());
args.push_back(this->SourceDir);
if(this->BuildGenerator.size())
if(!this->BuildGenerator.empty())
{
std::string generator = "-G";
generator += this->BuildGenerator;
@ -74,7 +74,7 @@ int cmCTestBuildAndTestHandler::RunCMake(std::string* outstring,
platform += this->BuildGeneratorPlatform;
args.push_back(platform);
}
if(this->BuildGeneratorToolset.size())
if(!this->BuildGeneratorToolset.empty())
{
std::string toolset = "-T";
toolset += this->BuildGeneratorToolset;
@ -212,7 +212,7 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring)
std::ostringstream out;
if ( this->CTest->GetConfigType().empty() &&
this->ConfigSample.size())
!this->ConfigSample.empty())
{
// use the config sample to set the ConfigType
std::string fullPath;
@ -225,7 +225,7 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring)
resultingConfig,
extraPaths,
failed);
if (fullPath.size() && resultingConfig.size())
if (!fullPath.empty() && !resultingConfig.empty())
{
this->CTest->SetConfigType(resultingConfig.c_str());
}
@ -340,7 +340,7 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring)
std::string resultingConfig;
std::vector<std::string> extraPaths;
// if this->ExecutableDirectory is set try that as well
if (this->ExecutableDirectory.size())
if (!this->ExecutableDirectory.empty())
{
std::string tempPath = this->ExecutableDirectory;
tempPath += "/";
@ -388,7 +388,7 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring)
std::string outs;
int retval = 0;
// run the test from the this->BuildRunDir if set
if(this->BuildRunDir.size())
if(!this->BuildRunDir.empty())
{
out << "Run test in directory: " << this->BuildRunDir << "\n";
cmSystemTools::ChangeDirectory(this->BuildRunDir);

View File

@ -1150,7 +1150,7 @@ void cmCTestBuildHandler::ProcessBuffer(const char* data, int length,
{
// This is not an error or warning.
// So, figure out if this is a post-context line
if ( this->ErrorsAndWarnings.size() &&
if ( !this->ErrorsAndWarnings.empty() &&
this->LastErrorOrWarning != this->ErrorsAndWarnings.end() &&
this->PostContextCount < this->MaxPostContext )
{

View File

@ -87,7 +87,7 @@ public:
}
args.push_back(0); // null terminate
cmsysProcess_SetCommand(this->Process, &*args.begin());
if(this->WorkingDirectory.size())
if(!this->WorkingDirectory.empty())
{
cmsysProcess_SetWorkingDirectory(this->Process,
this->WorkingDirectory.c_str());
@ -270,7 +270,7 @@ bool cmCTestCoverageHandler::ShouldIDoCoverage(const char* file,
std::string ndc
= cmSystemTools::FileExistsInParentDirectories(".NoDartCoverage",
fFile.c_str(), checkDir.c_str());
if ( ndc.size() )
if (!ndc.empty())
{
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Found: " << ndc
<< " so skip coverage of " << file << std::endl);
@ -281,7 +281,7 @@ bool cmCTestCoverageHandler::ShouldIDoCoverage(const char* file,
// Get the relative path to the file an apply it to the opposite directory.
// If it is the same as fileDir, then ignore, otherwise check.
std::string relPath;
if(checkDir.size() )
if(!checkDir.empty())
{
relPath = cmSystemTools::RelativePath(checkDir.c_str(),
fFile.c_str());
@ -309,7 +309,7 @@ bool cmCTestCoverageHandler::ShouldIDoCoverage(const char* file,
ndc = cmSystemTools::FileExistsInParentDirectories(".NoDartCoverage",
fFile.c_str(), checkDir.c_str());
if ( ndc.size() )
if (!ndc.empty())
{
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Found: " << ndc
<< " so skip coverage of: " << file << std::endl);
@ -2183,7 +2183,7 @@ int cmCTestCoverageHandler::RunBullseyeSourceSummary(
while(cmSystemTools::GetLineFromStream(fin, stdline))
{
// if we have a line of output from stdout
if(stdline.size())
if(!stdline.empty())
{
// parse the comma separated output
this->ParseBullsEyeCovsrcLine(stdline,
@ -2596,7 +2596,7 @@ std::set<std::string> cmCTestCoverageHandler::FindUncoveredFiles(
}
}
if(extraMatches.size())
if(!extraMatches.empty())
{
for(cmCTestCoverageHandlerContainer::TotalCoverageMap::iterator i =
cont->TotalCoverage.begin(); i != cont->TotalCoverage.end(); ++i)

View File

@ -720,7 +720,7 @@ bool cmCTestLaunch::Match(std::string const& line,
//----------------------------------------------------------------------------
bool cmCTestLaunch::MatchesFilterPrefix(std::string const& line) const
{
if(this->OptionFilterPrefix.size() && cmSystemTools::StringStartsWith(
if(!this->OptionFilterPrefix.empty() && cmSystemTools::StringStartsWith(
line.c_str(), this->OptionFilterPrefix.c_str()))
{
return true;

View File

@ -223,7 +223,7 @@ void cmCTestMemCheckHandler::GenerateTestCommand(
this->MemoryTesterEnvironmentVariable;
for ( pp = 0; pp < this->MemoryTesterOptions.size(); pp ++ )
{
if(memTesterEnvironmentVariable.size())
if(!memTesterEnvironmentVariable.empty())
{
// If we are using env to pass options, append all the options to
// this string with space separation.
@ -241,7 +241,7 @@ void cmCTestMemCheckHandler::GenerateTestCommand(
}
// if this is an env option type, then add the env string as a single
// argument.
if(memTesterEnvironmentVariable.size())
if(!memTesterEnvironmentVariable.empty())
{
std::string::size_type pos = memTesterEnvironmentVariable.find("??");
if (pos != std::string::npos)
@ -848,7 +848,7 @@ bool cmCTestMemCheckHandler::ProcessMemCheckSanitizerOutput(
{
resultFound = sanitizerWarning.match(1);
}
if(resultFound.size())
if(!resultFound.empty())
{
std::vector<int>::size_type idx = this->FindOrAddWarning(resultFound);
if(result.empty() || idx > result.size()-1)

View File

@ -636,7 +636,7 @@ void cmCTestMultiProcessHandler::PrintTestList()
testRun.SetTestProperties(&p);
testRun.ComputeArguments(); //logs the command in verbose mode
if(p.Labels.size()) //print the labels
if(!p.Labels.empty()) //print the labels
{
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Labels:");
}
@ -645,7 +645,7 @@ void cmCTestMultiProcessHandler::PrintTestList()
{
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " " << *label);
}
if(p.Labels.size()) //print the labels
if(!p.Labels.empty()) //print the labels
{
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, std::endl);
}
@ -683,7 +683,7 @@ void cmCTestMultiProcessHandler::PrintLabels()
allLabels.insert(p.Labels.begin(), p.Labels.end());
}
if(allLabels.size())
if(!allLabels.empty())
{
cmCTestLog(this->CTest, HANDLER_OUTPUT, "All Labels:" << std::endl);
}

View File

@ -318,7 +318,7 @@ bool cmCTestRunTest::EndTest(size_t completed, size_t total, bool started)
*this->TestHandler->LogFile
<< "----------------------------------------------------------"
<< std::endl;
if(this->TestResult.Reason.size())
if(!this->TestResult.Reason.empty())
{
*this->TestHandler->LogFile << reasonType << ":\n"
<< this->TestResult.Reason << "\n";

View File

@ -415,7 +415,7 @@ int cmCTestScriptHandler::ReadInScript(const std::string& total_script_arg)
this->UpdateElapsedTime();
// add the script arg if defined
if (script_arg.size())
if (!script_arg.empty())
{
this->Makefile->AddDefinition("CTEST_SCRIPT_ARG", script_arg.c_str());
}

View File

@ -61,7 +61,7 @@ private:
std::string GetCurrentValue()
{
std::string val;
if(this->CurrentValue.size())
if(!this->CurrentValue.empty())
{
val.assign(&this->CurrentValue[0], this->CurrentValue.size());
}
@ -301,7 +301,7 @@ bool cmCTestSubmitHandler::SubmitUsingFTP(const std::string& localprefix,
<< error_buffer << std::endl
<< " Curl output was: ";
// avoid dereference of empty vector
if(chunk.size())
if(!chunk.empty())
{
*this->LogFile << cmCTestLogWrite(&*chunk.begin(), chunk.size());
cmCTestLog(this->CTest, ERROR_MESSAGE, "CURL output: ["
@ -605,7 +605,7 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const std::string& localprefix,
<< " Error message was: " << error_buffer
<< std::endl;
// avoid deref of begin for zero size array
if(chunk.size())
if(!chunk.empty())
{
*this->LogFile << " Curl output was: "
<< cmCTestLogWrite(&*chunk.begin(), chunk.size())
@ -766,7 +766,7 @@ bool cmCTestSubmitHandler::TriggerUsingHTTP(
<< std::endl
<< " Error message was: " << error_buffer
<< std::endl;
if(chunk.size())
if(!chunk.empty())
{
*this->LogFile
<< " Curl output was: "
@ -1060,7 +1060,7 @@ int cmCTestSubmitHandler::ProcessHandler()
{
std::string iscdash = this->CTest->GetCTestConfiguration("IsCDash");
// cdash does not need to trigger so just return true
if(iscdash.size())
if(!iscdash.empty())
{
this->CDash = true;
}

View File

@ -564,7 +564,7 @@ int cmCTestTestHandler::ProcessHandler()
}
else
{
if (this->HandlerVerbose && passed.size() &&
if (this->HandlerVerbose && !passed.empty() &&
(this->UseIncludeRegExpFlag || this->UseExcludeRegExpFlag))
{
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, std::endl
@ -596,7 +596,7 @@ int cmCTestTestHandler::ProcessHandler()
cmCTestLog(this->CTest, HANDLER_OUTPUT, "\nTotal Test time (real) = "
<< realBuf << "\n" );
if (failed.size())
if (!failed.empty())
{
cmGeneratedFileStream ofs;
cmCTestLog(this->CTest, HANDLER_OUTPUT, std::endl
@ -698,7 +698,7 @@ void cmCTestTestHandler::PrintLabelSummary()
}
}
// now print times
if(labels.size())
if(!labels.empty())
{
cmCTestLog(this->CTest, HANDLER_OUTPUT, "\nLabel Time Summary:");
}
@ -717,7 +717,7 @@ void cmCTestTestHandler::PrintLabelSummary()
<< buf << "\n";
}
}
if(labels.size())
if(!labels.empty())
{
if(this->LogFile)
{
@ -850,7 +850,7 @@ void cmCTestTestHandler::ComputeTestList()
if (this->UseUnion)
{
// if it is not in the list and not in the regexp then skip
if ((this->TestsToRun.size() &&
if ((!this->TestsToRun.empty() &&
std::find(this->TestsToRun.begin(), this->TestsToRun.end(), cnt)
== this->TestsToRun.end()) && !it->IsInBasedOnREOptions)
{
@ -860,7 +860,7 @@ void cmCTestTestHandler::ComputeTestList()
else
{
// is this test in the list of tests to run? If not then skip it
if ((this->TestsToRun.size() &&
if ((!this->TestsToRun.empty() &&
std::find(this->TestsToRun.begin(),
this->TestsToRun.end(), inREcnt)
== this->TestsToRun.end()) || !it->IsInBasedOnREOptions)
@ -891,7 +891,7 @@ void cmCTestTestHandler::ComputeTestListForRerunFailed()
cnt ++;
// if this test is not in our list of tests to run, then skip it.
if ((this->TestsToRun.size() &&
if ((!this->TestsToRun.empty() &&
std::find(this->TestsToRun.begin(), this->TestsToRun.end(), cnt)
== this->TestsToRun.end()))
{
@ -1094,7 +1094,7 @@ void cmCTestTestHandler::ProcessDirectory(std::vector<std::string> &passed,
p.Timeout = this->CTest->GetGlobalTimeout();
}
if(p.Depends.size())
if(!p.Depends.empty())
{
for(std::vector<std::string>::iterator i = p.Depends.begin();
i != p.Depends.end(); ++i)
@ -1192,7 +1192,7 @@ void cmCTestTestHandler::GenerateDartOutput(std::ostream& os)
<< "name=\"Execution Time\"><Value>"
<< result->ExecutionTime
<< "</Value></NamedMeasurement>\n";
if(result->Reason.size())
if(!result->Reason.empty())
{
const char* reasonType = "Pass Reason";
if(result->Status != cmCTestTestHandler::COMPLETED &&
@ -1376,7 +1376,7 @@ void cmCTestTestHandler
{
std::string tempPath;
if (filepath.size() &&
if (!filepath.empty() &&
filepath[filepath.size()-1] != '/')
{
filepath += "/";
@ -1385,7 +1385,7 @@ void cmCTestTestHandler
attempted.push_back(tempPath);
attemptedConfigs.push_back("");
if(ctest->GetConfigType().size())
if(!ctest->GetConfigType().empty())
{
tempPath = filepath;
tempPath += ctest->GetConfigType();
@ -1463,7 +1463,7 @@ std::string cmCTestTestHandler
// even if a fullpath was specified also try it relative to the current
// directory
if (filepath.size() && filepath[0] == '/')
if (!filepath.empty() && filepath[0] == '/')
{
std::string localfilepath = filepath.substr(1,filepath.size()-1);
cmCTestTestHandler::AddConfigurations(ctest, attempted,

View File

@ -94,7 +94,7 @@ cmCTestUpdateHandlerLocale::~cmCTestUpdateHandlerLocale()
{
// restore the value of LC_MESSAGES after running the version control
// commands
if(saveLCMessages.size())
if(!saveLCMessages.empty())
{
std::string put = "LC_MESSAGES=";
put += saveLCMessages;

View File

@ -80,7 +80,7 @@ bool cmParseGTMCoverage::ReadMCovFile(const char* file)
// no need to search the file if we just did it
if(function == lastfunction && lastroutine == routine)
{
if(lastpath.size())
if(!lastpath.empty())
{
this->Coverage.TotalCoverage[lastpath][lastoffset + linenumber]
+= count;

View File

@ -56,7 +56,7 @@ bool cmProcess::StartProcess()
this->ProcessArgs.push_back(0); // null terminate the list
this->Process = cmsysProcess_New();
cmsysProcess_SetCommand(this->Process, &*this->ProcessArgs.begin());
if(this->WorkingDirectory.size())
if(!this->WorkingDirectory.empty())
{
cmsysProcess_SetWorkingDirectory(this->Process,
this->WorkingDirectory.c_str());

View File

@ -212,7 +212,7 @@ int cmCTest::HTTPRequest(std::string url, HTTPMethod method,
::curl_easy_setopt(curl, CURLOPT_INFILE, file);
//fall through to append GET fields
case cmCTest::HTTP_GET:
if(fields.size())
if(!fields.empty())
{
url += "?" + fields;
}
@ -1080,7 +1080,7 @@ int cmCTest::ProcessTests()
if (this->Parts[PartNotes])
{
this->UpdateCTestConfiguration();
if ( this->NotesFiles.size() )
if (!this->NotesFiles.empty())
{
this->GenerateNotesFile(this->NotesFiles.c_str());
}
@ -3136,7 +3136,7 @@ double cmCTest::GetRemainingTimeAllowed()
void cmCTest::OutputTestErrors(std::vector<char> const &process_output)
{
std::string test_outputs("\n*** Test Failed:\n");
if(process_output.size())
if(!process_output.empty())
{
test_outputs.append(&*process_output.begin(), process_output.size());
}

View File

@ -609,7 +609,7 @@ void cmCacheManager::OutputKey(std::ostream& fout, std::string const& key)
void cmCacheManager::OutputValue(std::ostream& fout, std::string const& value)
{
// if value has trailing space or tab, enclose it in single quotes
if (value.size() &&
if (!value.empty() &&
(value[value.size() - 1] == ' ' ||
value[value.size() - 1] == '\t'))
{

View File

@ -201,13 +201,13 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
else
{
// only valid for srcfile signatures
if (compileDefs.size())
if (!compileDefs.empty())
{
this->Makefile->IssueMessage(cmake::FATAL_ERROR,
"COMPILE_DEFINITIONS specified on a srcdir type TRY_COMPILE");
return -1;
}
if (copyFile.size())
if (!copyFile.empty())
{
this->Makefile->IssueMessage(cmake::FATAL_ERROR,
"COPY_FILE specified on a srcdir type TRY_COMPILE");
@ -371,7 +371,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
fprintf(fout, "set(CMAKE_SUPPRESS_REGENERATION 1)\n");
fprintf(fout, "link_directories(${LINK_DIRECTORIES})\n");
// handle any compile flags we need to pass on
if (compileDefs.size())
if (!compileDefs.empty())
{
fprintf(fout, "add_definitions( ");
for (size_t i = 0; i < compileDefs.size(); ++i)
@ -547,7 +547,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
std::string copyFileErrorMessage;
this->FindOutputFile(targetName);
if ((res==0) && (copyFile.size()))
if ((res==0) && !copyFile.empty())
{
if(this->OutputFile.empty() ||
!cmSystemTools::CopyFileAlways(this->OutputFile,

View File

@ -145,12 +145,12 @@ bool cmCreateTestSourceList
" },\n";
numTests++;
}
if(extraInclude.size())
if(!extraInclude.empty())
{
this->Makefile->AddDefinition("CMAKE_TESTDRIVER_EXTRA_INCLUDES",
extraInclude.c_str());
}
if(function.size())
if(!function.empty())
{
this->Makefile->AddDefinition("CMAKE_TESTDRIVER_ARGVC_FUNCTION",
function.c_str());

View File

@ -201,7 +201,7 @@ void cmDocumentationFormatter
for(std::vector<cmDocumentationEntry>::const_iterator op = entries.begin();
op != entries.end(); ++op)
{
if(op->Name.size())
if(!op->Name.empty())
{
os << " " << op->Name;
this->TextIndent = " ";

View File

@ -84,7 +84,7 @@ bool cmExecProgramCommand
}
std::string command;
if(arguments.size())
if(!arguments.empty())
{
command = cmSystemTools::ConvertToRunCommandPath(args[0].c_str());
command += " ";

View File

@ -324,12 +324,12 @@ bool cmExecuteProcessCommand
error_strip_trailing_whitespace);
// Store the output obtained.
if(!output_variable.empty() && tempOutput.size())
if(!output_variable.empty() && !tempOutput.empty())
{
this->Makefile->AddDefinition(output_variable,
&*tempOutput.begin());
}
if(!merge_output && !error_variable.empty() && tempError.size())
if(!merge_output && !error_variable.empty() && !tempError.empty())
{
this->Makefile->AddDefinition(error_variable,
&*tempError.begin());

View File

@ -2992,7 +2992,7 @@ cmFileCommand::HandleDownloadCommand(std::vector<std::string> const& args)
msg = "returning early; file already exists with expected ";
msg += hashMatchMSG;
msg += "\"";
if(statusVar.size())
if(!statusVar.empty())
{
std::ostringstream result;
result << (int)0 << ";\"" << msg;
@ -3085,7 +3085,7 @@ cmFileCommand::HandleDownloadCommand(std::vector<std::string> const& args)
res = ::curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
check_curl_result(res, "DOWNLOAD cannot set follow-redirect option: ");
if(verboseLog.size())
if(!verboseLog.empty())
{
res = ::curl_easy_setopt(curl, CURLOPT_VERBOSE, 1);
check_curl_result(res, "DOWNLOAD cannot set verbose: ");
@ -3131,7 +3131,7 @@ cmFileCommand::HandleDownloadCommand(std::vector<std::string> const& args)
g_curl.release();
::curl_easy_cleanup(curl);
if(statusVar.size())
if(!statusVar.empty())
{
std::ostringstream result;
result << (int)res << ";\"" << ::curl_easy_strerror(res) << "\"";
@ -3172,14 +3172,14 @@ cmFileCommand::HandleDownloadCommand(std::vector<std::string> const& args)
}
}
if(chunkDebug.size())
if(!chunkDebug.empty())
{
chunkDebug.push_back(0);
if(CURLE_OPERATION_TIMEOUTED == res)
{
std::string output = &*chunkDebug.begin();
if(verboseLog.size())
if(!verboseLog.empty())
{
this->Makefile->AddDefinition(verboseLog,
&*chunkDebug.begin());
@ -3335,7 +3335,7 @@ cmFileCommand::HandleUploadCommand(std::vector<std::string> const& args)
res = ::curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
check_curl_result(res, "UPLOAD cannot set follow-redirect option: ");
if(logVar.size())
if(!logVar.empty())
{
res = ::curl_easy_setopt(curl, CURLOPT_VERBOSE, 1);
check_curl_result(res, "UPLOAD cannot set verbose: ");
@ -3390,7 +3390,7 @@ cmFileCommand::HandleUploadCommand(std::vector<std::string> const& args)
g_curl.release();
::curl_easy_cleanup(curl);
if(statusVar.size())
if(!statusVar.empty())
{
std::ostringstream result;
result << (int)res << ";\"" << ::curl_easy_strerror(res) << "\"";
@ -3403,11 +3403,11 @@ cmFileCommand::HandleUploadCommand(std::vector<std::string> const& args)
fclose(fin);
fin = NULL;
if(logVar.size())
if(!logVar.empty())
{
std::string log;
if(chunkResponse.size())
if(!chunkResponse.empty())
{
chunkResponse.push_back(0);
log += "Response:\n";
@ -3415,7 +3415,7 @@ cmFileCommand::HandleUploadCommand(std::vector<std::string> const& args)
log += "\n";
}
if(chunkDebug.size())
if(!chunkDebug.empty())
{
chunkDebug.push_back(0);
log += "Debug:\n";

View File

@ -622,7 +622,7 @@ bool cmFindPackageCommand::FindModule(bool& found)
module += this->Name;
module += ".cmake";
std::string mfile = this->Makefile->GetModulesFile(module.c_str());
if ( mfile.size() )
if (!mfile.empty())
{
// Load the module we found, and set "<name>_FIND_MODULE" to true
// while inside it.

View File

@ -108,7 +108,7 @@ cmFindPathCommand::FindHeaderInFramework(std::string const& file,
fileName = file;
frameWorkName = "";
}
if(frameWorkName.size())
if(!frameWorkName.empty())
{
std::string fpath = dir;
fpath += frameWorkName;
@ -134,7 +134,7 @@ cmFindPathCommand::FindHeaderInFramework(std::string const& file,
cmsys::Glob globIt;
globIt.FindFiles(glob);
std::vector<std::string> files = globIt.GetFiles();
if(files.size())
if(!files.empty())
{
std::string fheader = cmSystemTools::CollapseFullPath(files[0]);
if(this->IncludeFileInPath)

View File

@ -113,7 +113,7 @@ bool cmGetFilenameComponentCommand
if(args.size() == 4 && args[3] == "CACHE")
{
if(programArgs.size() && storeArgs.size())
if(!programArgs.empty() && !storeArgs.empty())
{
this->Makefile->AddCacheDefinition
(storeArgs, programArgs.c_str(),
@ -127,7 +127,7 @@ bool cmGetFilenameComponentCommand
}
else
{
if(programArgs.size() && storeArgs.size())
if(!programArgs.empty() && !storeArgs.empty())
{
this->Makefile->AddDefinition(storeArgs, programArgs.c_str());
}

View File

@ -276,7 +276,7 @@ void cmGlobalGenerator::FindMakeProgram(cmMakefile* mf)
{
std::string setMakeProgram =
mf->GetModulesFile(this->FindMakeProgramFile.c_str());
if(setMakeProgram.size())
if(!setMakeProgram.empty())
{
mf->ReadListFile(0, setMakeProgram.c_str());
}
@ -426,7 +426,7 @@ cmGlobalGenerator::EnableLanguage(std::vector<std::string>const& languages,
// If the configuration files path has been set,
// then we are in a try compile and need to copy the enable language
// files from the parent cmake bin dir, into the try compile bin dir
if(this->ConfiguredFilesPath.size())
if(!this->ConfiguredFilesPath.empty())
{
rootBin = this->ConfiguredFilesPath;
}
@ -1636,7 +1636,7 @@ void cmGlobalGenerator::CheckLocalGenerators()
static_cast<float>(this->LocalGenerators.size()));
}
if(notFoundMap.size())
if(!notFoundMap.empty())
{
std::string notFoundVars;
for(std::map<std::string, std::string>::const_iterator
@ -2460,19 +2460,19 @@ void cmGlobalGenerator::EnableMinGWLanguage(cmMakefile *mf)
locations.push_back("c:/mingw/bin");
std::string tgcc = cmSystemTools::FindProgram("gcc", locations);
std::string gcc = "gcc.exe";
if(tgcc.size())
if(!tgcc.empty())
{
gcc = tgcc;
}
std::string tgxx = cmSystemTools::FindProgram("g++", locations);
std::string gxx = "g++.exe";
if(tgxx.size())
if(!tgxx.empty())
{
gxx = tgxx;
}
std::string trc = cmSystemTools::FindProgram("windres", locations);
std::string rc = "windres.exe";
if(trc.size())
if(!trc.empty())
{
rc = trc;
}

View File

@ -236,7 +236,7 @@ bool cmGlobalKdevelopGenerator
// make it relative to the project dir
cmSystemTools::ReplaceString(tmp, projectDir.c_str(), "");
// only put relative paths
if (tmp.size() && tmp[0] != '/')
if (!tmp.empty() && tmp[0] != '/')
{
fout << tmp.c_str() <<"\n";
}

View File

@ -572,7 +572,7 @@ void cmGlobalUnixMakefileGenerator3
if (!targetName.empty())
{
cmLocalUnixMakefileGenerator3 *lg;
if (this->LocalGenerators.size())
if (!this->LocalGenerators.empty())
{
lg = static_cast<cmLocalUnixMakefileGenerator3 *>
(this->LocalGenerators[0]);

View File

@ -116,7 +116,7 @@ IsFunctionBlocked(const cmListFileFunction& lff,
bool isTrue = conditionEvaluator.IsTrue(
expandedArguments, errorString, messType);
if (errorString.size())
if (!errorString.empty())
{
std::string err = cmIfCommandError(&mf, expandedArguments);
err += errorString;
@ -204,7 +204,7 @@ bool cmIfCommand
bool isTrue = conditionEvaluator.IsTrue(
expandedArguments, errorString, status);
if (errorString.size())
if (!errorString.empty())
{
std::string err = cmIfCommandError(this->Makefile, expandedArguments);
err += errorString;

View File

@ -83,7 +83,7 @@ bool cmIncludeCommand
std::string module = fname;
module += ".cmake";
std::string mfile = this->Makefile->GetModulesFile(module.c_str());
if ( mfile.size() )
if (!mfile.empty())
{
fname = mfile.c_str();
}
@ -137,7 +137,7 @@ bool cmIncludeCommand
noPolicyScope);
// add the location of the included file if a result variable was given
if (resultVarName.size())
if (!resultVarName.empty())
{
this->Makefile->AddDefinition(resultVarName,
readit?fullFilePath.c_str():"NOTFOUND");

View File

@ -257,7 +257,7 @@ bool cmListCommand::HandleAppendCommand(std::vector<std::string> const& args)
size_t cc;
for ( cc = 2; cc < args.size(); ++ cc )
{
if(listString.size())
if(!listString.empty())
{
listString += ";";
}

View File

@ -936,7 +936,7 @@ cmLocalGenerator::ExpandRuleVariable(std::string const& variable,
if(variable == "TARGET_QUOTED")
{
std::string targetQuoted = replaceValues.Target;
if(targetQuoted.size() && targetQuoted[0] != '\"')
if(!targetQuoted.empty() && targetQuoted[0] != '\"')
{
targetQuoted = '\"';
targetQuoted += replaceValues.Target;
@ -1414,12 +1414,12 @@ std::string cmLocalGenerator::GetIncludeFlags(
}
std::string includePath =
this->ConvertToIncludeReference(*i, shellFormat, forceFullPaths);
if(quotePaths && includePath.size() && includePath[0] != '\"')
if(quotePaths && !includePath.empty() && includePath[0] != '\"')
{
includeFlags << "\"";
}
includeFlags << includePath;
if(quotePaths && includePath.size() && includePath[0] != '\"')
if(quotePaths && !includePath.empty() && includePath[0] != '\"')
{
includeFlags << "\"";
}
@ -2514,7 +2514,7 @@ void cmLocalGenerator::AppendFlags(std::string& flags,
{
if(!newFlags.empty())
{
if(flags.size())
if(!flags.empty())
{
flags += " ";
}

View File

@ -1160,7 +1160,7 @@ cmLocalUnixMakefileGenerator3
{
// Build the command line in a single string.
std::string cmd = ccg.GetCommand(c);
if (cmd.size())
if (!cmd.empty())
{
// Use "call " before any invocations of .bat or .cmd files
// invoked as custom commands in the WindowsShell.
@ -2173,7 +2173,7 @@ cmLocalUnixMakefileGenerator3
cmd += " ";
// Pass down verbosity level.
if(this->GetMakeSilentFlag().size())
if(!this->GetMakeSilentFlag().empty())
{
cmd += this->GetMakeSilentFlag();
cmd += " ";

View File

@ -116,7 +116,7 @@ bool cmMacroHelperCommand::InvokeInitialPass
std::string argnDef;
bool argnDefInitialized = false;
bool argvDefInitialized = false;
if( this->Functions.size())
if(!this->Functions.empty())
{
this->FilePath = this->Functions[0].FilePath;
}

View File

@ -175,7 +175,7 @@ void cmMakeDepend::GenerateDependInformation(cmDependInformation* info)
t != this->IncludeDirectories.end(); ++t)
{
std::string incpath = *t;
if (incpath.size() && incpath[incpath.size() - 1] != '/')
if (!incpath.empty() && incpath[incpath.size() - 1] != '/')
{
incpath = incpath + "/";
}
@ -318,7 +318,7 @@ std::string cmMakeDepend::FullPath(const char* fname, const char *extraPath)
i != this->IncludeDirectories.end(); ++i)
{
std::string path = *i;
if (path.size() && path[path.size() - 1] != '/')
if (!path.empty() && path[path.size() - 1] != '/')
{
path = path + "/";
}
@ -335,7 +335,7 @@ std::string cmMakeDepend::FullPath(const char* fname, const char *extraPath)
if (extraPath)
{
std::string path = extraPath;
if (path.size() && path[path.size() - 1] != '/')
if (!path.empty() && path[path.size() - 1] != '/')
{
path = path + "/";
}

View File

@ -1798,7 +1798,7 @@ void cmMakefile::AddDefinition(const std::string& name, const char* value)
}
this->Internal->VarStack.top().Set(name, value);
if (this->Internal->VarUsageStack.size() &&
if (!this->Internal->VarUsageStack.empty() &&
this->VariableInitialized(name))
{
this->CheckForUnused("changing definition", name);
@ -1873,7 +1873,7 @@ void cmMakefile::AddCacheDefinition(const std::string& name, const char* value,
void cmMakefile::AddDefinition(const std::string& name, bool value)
{
this->Internal->VarStack.top().Set(name, value? "ON" : "OFF");
if (this->Internal->VarUsageStack.size() &&
if (!this->Internal->VarUsageStack.empty() &&
this->VariableInitialized(name))
{
this->CheckForUnused("changing definition", name);
@ -1937,7 +1937,7 @@ void cmMakefile::CheckForUnused(const char* reason,
{
std::string path;
cmListFileBacktrace bt(this->GetLocalGenerator());
if (this->CallStack.size())
if (!this->CallStack.empty())
{
const cmListFileContext* file = this->CallStack.back().Context;
bt.push_back(*file);
@ -1972,7 +1972,7 @@ void cmMakefile::CheckForUnused(const char* reason,
void cmMakefile::RemoveDefinition(const std::string& name)
{
this->Internal->VarStack.top().Set(name, 0);
if (this->Internal->VarUsageStack.size() &&
if (!this->Internal->VarUsageStack.empty() &&
this->VariableInitialized(name))
{
this->CheckForUnused("unsetting", name);

View File

@ -57,7 +57,7 @@ bool cmRemoveCommand
}
if (!found)
{
if (value.size())
if (!value.empty())
{
value += ";";
}

View File

@ -37,7 +37,7 @@ bool cmSetCommand
delete [] varName;
// will it be set to something, then set it
if (args.size() > 1 && args[1].size())
if (args.size() > 1 && !args[1].empty())
{
// but only if it is different from current value
if (!currValue || strcmp(currValue,args[1].c_str()))

View File

@ -104,8 +104,8 @@ bool cmTryRunCommand
// although they could be used together, don't allow it, because
// using OUTPUT_VARIABLE makes crosscompiling harder
if (this->OutputVariable.size()
&& ((this->RunOutputVariable.size())
|| (this->CompileOutputVariable.size())))
&& (!this->RunOutputVariable.empty()
|| !this->CompileOutputVariable.empty()))
{
cmSystemTools::Error(
"You cannot use OUTPUT_VARIABLE together with COMPILE_OUTPUT_VARIABLE "
@ -115,18 +115,18 @@ bool cmTryRunCommand
}
bool captureRunOutput = false;
if (this->OutputVariable.size())
if (!this->OutputVariable.empty())
{
captureRunOutput = true;
tryCompile.push_back("OUTPUT_VARIABLE");
tryCompile.push_back(this->OutputVariable);
}
if (this->CompileOutputVariable.size())
if (!this->CompileOutputVariable.empty())
{
tryCompile.push_back("OUTPUT_VARIABLE");
tryCompile.push_back(this->CompileOutputVariable);
}
if (this->RunOutputVariable.size())
if (!this->RunOutputVariable.empty())
{
captureRunOutput = true;
}
@ -160,13 +160,13 @@ bool cmTryRunCommand
}
// now put the output into the variables
if(this->RunOutputVariable.size())
if(!this->RunOutputVariable.empty())
{
this->Makefile->AddDefinition(this->RunOutputVariable,
runOutputContents.c_str());
}
if(this->OutputVariable.size())
if(!this->OutputVariable.empty())
{
// if the TryCompileCore saved output in this outputVariable then
// prepend that output to this output
@ -196,7 +196,7 @@ void cmTryRunCommand::RunExecutable(const std::string& runArgs,
int retVal = -1;
std::string finalCommand = cmSystemTools::ConvertToRunCommandPath(
this->OutputFile.c_str());
if (runArgs.size())
if (!runArgs.empty())
{
finalCommand += runArgs;
}

View File

@ -95,7 +95,7 @@ bool cmUtilitySourceCommand
{
exePath = this->Makefile->GetDefinition("EXECUTABLE_OUTPUT_PATH");
}
if(exePath.size())
if(!exePath.empty())
{
utilityDirectory = exePath;
}

View File

@ -66,7 +66,7 @@ void cmUuid::CreateHashInput(std::vector<unsigned char> const& uuidNamespace,
{
output = uuidNamespace;
if(name.size())
if(!name.empty())
{
output.resize(output.size() + name.size());

View File

@ -47,7 +47,7 @@ IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf,
while (isTrue)
{
if (errorString.size())
if (!errorString.empty())
{
std::string err = "had incorrect arguments: ";
unsigned int i;

View File

@ -1123,13 +1123,13 @@ void cmake::SetGlobalGenerator(cmGlobalGenerator *gg)
// restore the original environment variables CXX and CC
// Restore CC
std::string env = "CC=";
if(this->CCEnvironment.size())
if(!this->CCEnvironment.empty())
{
env += this->CCEnvironment;
}
cmSystemTools::PutEnv(env);
env = "CXX=";
if(this->CXXEnvironment.size())
if(!this->CXXEnvironment.empty())
{
env += this->CXXEnvironment;
}
@ -2277,7 +2277,7 @@ const char *cmake::GetProperty(const std::string& prop,
this->GetCacheManager()->GetCacheIterator();
for ( cit.Begin(); !cit.IsAtEnd(); cit.Next() )
{
if ( output.size() )
if (!output.empty())
{
output += ";";
}