Merge topic 'small-cleanups'

9f25fc4d Prefer std::ostream& over derivatives as parameters
f9cc43ea cmake: remove unnused member Verbose
6e658085 cmake: Fix constness of methods
87ffd76d cmake: Make internal method file static
fa169fe8 Parser: Merge identical conditions
This commit is contained in:
Brad King 2016-06-09 09:18:23 -04:00 committed by CMake Topic Stage
commit 065bb0ffeb
9 changed files with 32 additions and 43 deletions

View File

@ -516,8 +516,8 @@ int cmCPackNSISGenerator::InitializeInternal()
return this->Superclass::InitializeInternal();
}
void cmCPackNSISGenerator::CreateMenuLinks(std::ostringstream& str,
std::ostringstream& deleteStr)
void cmCPackNSISGenerator::CreateMenuLinks(std::ostream& str,
std::ostream& deleteStr)
{
const char* cpackMenuLinks = this->GetOption("CPACK_NSIS_MENU_LINKS");
if (!cpackMenuLinks) {
@ -621,7 +621,7 @@ bool cmCPackNSISGenerator::SupportsComponentInstallation() const
}
std::string cmCPackNSISGenerator::CreateComponentDescription(
cmCPackComponent* component, std::ostringstream& macrosOut)
cmCPackComponent* component, std::ostream& macrosOut)
{
// Basic description of the component
std::string componentCode = "Section ";
@ -873,7 +873,7 @@ std::string cmCPackNSISGenerator::CreateDeselectionDependenciesDescription(
}
std::string cmCPackNSISGenerator::CreateComponentGroupDescription(
cmCPackComponentGroup* group, std::ostringstream& macrosOut)
cmCPackComponentGroup* group, std::ostream& macrosOut)
{
if (group->Components.empty() && group->Subgroups.empty()) {
// Silently skip empty groups. NSIS doesn't support them.

View File

@ -40,7 +40,7 @@ public:
protected:
virtual int InitializeInternal();
void CreateMenuLinks(std::ostringstream& str, std::ostringstream& deleteStr);
void CreateMenuLinks(std::ostream& str, std::ostream& deleteStr);
int PackageFiles();
virtual const char* GetOutputExtension() { return ".exe"; }
virtual const char* GetOutputPostfix() { return "win32"; }
@ -56,7 +56,7 @@ protected:
/// particular component. Any added macros will be emitted via
/// macrosOut.
std::string CreateComponentDescription(cmCPackComponent* component,
std::ostringstream& macrosOut);
std::ostream& macrosOut);
/// Produce NSIS code that selects all of the components that this component
/// depends on, recursively.
@ -72,7 +72,7 @@ protected:
/// particular component group, including its components. Any
/// added macros will be emitted via macrosOut.
std::string CreateComponentGroupDescription(cmCPackComponentGroup* group,
std::ostringstream& macrosOut);
std::ostream& macrosOut);
/// Translations any newlines found in the string into \\r\\n, so that the
/// resulting string can be used within NSIS.

View File

@ -45,7 +45,7 @@ void cmCTestBatchTestHandler::WriteBatchScript()
fout.close();
}
void cmCTestBatchTestHandler::WriteSrunArgs(int test, cmsys::ofstream& fout)
void cmCTestBatchTestHandler::WriteSrunArgs(int test, std::ostream& fout)
{
cmCTestTestHandler::cmCTestTestProperties* properties =
this->Properties[test];
@ -73,7 +73,7 @@ void cmCTestBatchTestHandler::WriteSrunArgs(int test, cmsys::ofstream& fout)
}
}
void cmCTestBatchTestHandler::WriteTestCommand(int test, cmsys::ofstream& fout)
void cmCTestBatchTestHandler::WriteTestCommand(int test, std::ostream& fout)
{
std::vector<std::string> args = this->Properties[test]->Args;
std::vector<std::string> processArgs;

View File

@ -33,8 +33,8 @@ public:
protected:
void WriteBatchScript();
void WriteSrunArgs(int test, cmsys::ofstream& fout);
void WriteTestCommand(int test, cmsys::ofstream& fout);
void WriteSrunArgs(int test, std::ostream& fout);
void WriteTestCommand(int test, std::ostream& fout);
void SubmitBatchScript();

View File

@ -181,9 +181,6 @@ bool cmListFile::ParseFile(const char* filename, bool topLevel, cmMakefile* mf)
mf->SetPolicyVersion("2.4");
}
}
}
if (topLevel) {
bool hasProject = false;
// search for a project command
for (std::vector<cmListFileFunction>::iterator i = this->Functions.begin();

View File

@ -580,8 +580,7 @@ bool cmTarget::PushTLLCommandTrace(TLLSignature signature,
return ret;
}
void cmTarget::GetTllSignatureTraces(std::ostringstream& s,
TLLSignature sig) const
void cmTarget::GetTllSignatureTraces(std::ostream& s, TLLSignature sig) const
{
const char* sigString =
(sig == cmTarget::KeywordTLLSignature ? "keyword" : "plain");

View File

@ -156,7 +156,7 @@ public:
};
bool PushTLLCommandTrace(TLLSignature signature,
cmListFileContext const& lfc);
void GetTllSignatureTraces(std::ostringstream& s, TLLSignature sig) const;
void GetTllSignatureTraces(std::ostream& s, TLLSignature sig) const;
void MergeLinkLibraries(cmMakefile& mf, const std::string& selfname,
const LinkLibraryVectorType& libs);

View File

@ -145,7 +145,6 @@ cmake::cmake()
}
#endif
this->Verbose = false;
this->GlobalGenerator = 0;
this->ProgressCallback = 0;
this->ProgressCallbackClientData = 0;
@ -555,9 +554,7 @@ void cmake::SetArgs(const std::vector<std::string>& args,
this->VSSolutionFile = args[++i];
}
#endif
else if (arg.find("-V", 0) == 0) {
this->Verbose = true;
} else if (arg.find("-D", 0) == 0) {
else if (arg.find("-D", 0) == 0) {
// skip for now
} else if (arg.find("-U", 0) == 0) {
// skip for now
@ -1989,9 +1986,7 @@ int cmake::GetSystemInformation(std::vector<std::string>& args)
bool writeToStdout = true;
for (unsigned int i = 1; i < args.size(); ++i) {
std::string arg = args[i];
if (arg.find("-V", 0) == 0) {
this->Verbose = true;
} else if (arg.find("-G", 0) == 0) {
if (arg.find("-G", 0) == 0) {
std::string value = arg.substr(2);
if (value.empty()) {
++i;
@ -2176,7 +2171,7 @@ static bool cmakeCheckStampList(const char* stampList)
return true;
}
cmake::MessageType cmake::ConvertMessageType(cmake::MessageType t)
cmake::MessageType cmake::ConvertMessageType(cmake::MessageType t) const
{
bool warningsAsErrors;
@ -2200,7 +2195,7 @@ cmake::MessageType cmake::ConvertMessageType(cmake::MessageType t)
return t;
}
bool cmake::IsMessageTypeVisible(cmake::MessageType t)
bool cmake::IsMessageTypeVisible(cmake::MessageType t) const
{
bool isVisible = true;
@ -2225,7 +2220,7 @@ bool cmake::IsMessageTypeVisible(cmake::MessageType t)
return isVisible;
}
bool cmake::PrintMessagePreamble(cmake::MessageType t, std::ostream& msg)
static bool printMessagePreamble(cmake::MessageType t, std::ostream& msg)
{
// Construct the message header.
if (t == cmake::FATAL_ERROR) {
@ -2296,7 +2291,8 @@ void displayMessage(cmake::MessageType t, std::ostringstream& msg)
}
void cmake::IssueMessage(cmake::MessageType t, std::string const& text,
cmListFileBacktrace const& backtrace, bool force)
cmListFileBacktrace const& backtrace,
bool force) const
{
if (!force) {
// override the message type, if needed, for warnings and errors
@ -2312,7 +2308,7 @@ void cmake::IssueMessage(cmake::MessageType t, std::string const& text,
}
std::ostringstream msg;
if (!this->PrintMessagePreamble(t, msg)) {
if (!printMessagePreamble(t, msg)) {
return;
}
@ -2448,7 +2444,7 @@ void cmake::RunCheckForUnusedVariables()
#endif
}
bool cmake::GetSuppressDevWarnings(cmMakefile const* mf)
bool cmake::GetSuppressDevWarnings(cmMakefile const* mf) const
{
/*
* The suppression CMake variable may be set in the CMake configuration file
@ -2482,7 +2478,7 @@ void cmake::SetSuppressDevWarnings(bool b)
cmState::INTERNAL);
}
bool cmake::GetSuppressDeprecatedWarnings(cmMakefile const* mf)
bool cmake::GetSuppressDeprecatedWarnings(cmMakefile const* mf) const
{
/*
* The suppression CMake variable may be set in the CMake configuration file
@ -2517,7 +2513,7 @@ void cmake::SetSuppressDeprecatedWarnings(bool b)
cmState::INTERNAL);
}
bool cmake::GetDevWarningsAsErrors(cmMakefile const* mf)
bool cmake::GetDevWarningsAsErrors(cmMakefile const* mf) const
{
if (mf) {
return (mf->IsSet("CMAKE_SUPPRESS_DEVELOPER_ERRORS") &&
@ -2548,7 +2544,7 @@ void cmake::SetDevWarningsAsErrors(bool b)
cmState::INTERNAL);
}
bool cmake::GetDeprecatedWarningsAsErrors(cmMakefile const* mf)
bool cmake::GetDeprecatedWarningsAsErrors(cmMakefile const* mf) const
{
if (mf) {
return mf->IsOn("CMAKE_ERROR_DEPRECATED");

View File

@ -339,7 +339,7 @@ public:
* Returns false, by default, if developer warnings should be shown, true
* otherwise.
*/
bool GetSuppressDevWarnings(cmMakefile const* mf = NULL);
bool GetSuppressDevWarnings(cmMakefile const* mf = NULL) const;
/*
* Set the state of the suppression of developer (author) warnings.
*/
@ -350,7 +350,7 @@ public:
* Returns false, by default, if deprecated warnings should be shown, true
* otherwise.
*/
bool GetSuppressDeprecatedWarnings(cmMakefile const* mf = NULL);
bool GetSuppressDeprecatedWarnings(cmMakefile const* mf = NULL) const;
/*
* Set the state of the suppression of deprecated warnings.
*/
@ -361,7 +361,7 @@ public:
* Returns false, by default, if warnings should not be treated as errors,
* true otherwise.
*/
bool GetDevWarningsAsErrors(cmMakefile const* mf = NULL);
bool GetDevWarningsAsErrors(cmMakefile const* mf = NULL) const;
/**
* Set the state of treating developer (author) warnings as errors.
*/
@ -372,7 +372,7 @@ public:
* Returns false, by default, if warnings should not be treated as errors,
* true otherwise.
*/
bool GetDeprecatedWarningsAsErrors(cmMakefile const* mf = NULL);
bool GetDeprecatedWarningsAsErrors(cmMakefile const* mf = NULL) const;
/**
* Set the state of treating developer (author) warnings as errors.
*/
@ -382,7 +382,7 @@ public:
void IssueMessage(
cmake::MessageType t, std::string const& text,
cmListFileBacktrace const& backtrace = cmListFileBacktrace(),
bool force = false);
bool force = false) const;
///! run the --build option
int Build(const std::string& dir, const std::string& target,
@ -455,7 +455,6 @@ private:
void operator=(const cmake&); // Not implemented.
ProgressCallbackType ProgressCallback;
void* ProgressCallbackClientData;
bool Verbose;
bool InTryCompile;
WorkingMode CurrentWorkingMode;
bool DebugOutput;
@ -493,15 +492,13 @@ private:
* Convert a message type between a warning and an error, based on the state
* of the error output CMake variables, in the cache.
*/
cmake::MessageType ConvertMessageType(cmake::MessageType t);
cmake::MessageType ConvertMessageType(cmake::MessageType t) const;
/*
* Check if messages of this type should be output, based on the state of the
* warning and error output CMake variables, in the cache.
*/
bool IsMessageTypeVisible(cmake::MessageType t);
bool PrintMessagePreamble(cmake::MessageType t, std::ostream& msg);
bool IsMessageTypeVisible(cmake::MessageType t) const;
};
#define CMAKE_STANDARD_OPTIONS_TABLE \