Rename strict-mode to warn-uninitialized
This commit is contained in:
parent
e141bc950a
commit
d7999e9b29
|
@ -117,9 +117,9 @@ CMakeSetupDialog::CMakeSetupDialog()
|
||||||
this->SuppressDevWarningsAction =
|
this->SuppressDevWarningsAction =
|
||||||
OptionsMenu->addAction(tr("&Suppress dev Warnings (-Wno-dev)"));
|
OptionsMenu->addAction(tr("&Suppress dev Warnings (-Wno-dev)"));
|
||||||
this->SuppressDevWarningsAction->setCheckable(true);
|
this->SuppressDevWarningsAction->setCheckable(true);
|
||||||
this->StrictModeAction =
|
this->WarnUninitializedAction =
|
||||||
OptionsMenu->addAction(tr("&Strict Mode (--strict-mode)"));
|
OptionsMenu->addAction(tr("&Warn Uninitialized (--warn-uninitialized)"));
|
||||||
this->StrictModeAction->setCheckable(true);
|
this->WarnUninitializedAction->setCheckable(true);
|
||||||
|
|
||||||
QAction* debugAction = OptionsMenu->addAction(tr("&Debug Output"));
|
QAction* debugAction = OptionsMenu->addAction(tr("&Debug Output"));
|
||||||
debugAction->setCheckable(true);
|
debugAction->setCheckable(true);
|
||||||
|
@ -244,9 +244,9 @@ void CMakeSetupDialog::initialize()
|
||||||
|
|
||||||
QObject::connect(this->SuppressDevWarningsAction, SIGNAL(triggered(bool)),
|
QObject::connect(this->SuppressDevWarningsAction, SIGNAL(triggered(bool)),
|
||||||
this->CMakeThread->cmakeInstance(), SLOT(setSuppressDevWarnings(bool)));
|
this->CMakeThread->cmakeInstance(), SLOT(setSuppressDevWarnings(bool)));
|
||||||
QObject::connect(this->StrictModeAction, SIGNAL(triggered(bool)),
|
QObject::connect(this->WarnUninitializedAction, SIGNAL(triggered(bool)),
|
||||||
this->CMakeThread->cmakeInstance(),
|
this->CMakeThread->cmakeInstance(),
|
||||||
SLOT(setStrictMode(bool)));
|
SLOT(setWarnUninitializedMode(bool)));
|
||||||
|
|
||||||
if(!this->SourceDirectory->text().isEmpty() ||
|
if(!this->SourceDirectory->text().isEmpty() ||
|
||||||
!this->BinaryDirectory->lineEdit()->text().isEmpty())
|
!this->BinaryDirectory->lineEdit()->text().isEmpty())
|
||||||
|
|
|
@ -93,7 +93,7 @@ protected:
|
||||||
QAction* ConfigureAction;
|
QAction* ConfigureAction;
|
||||||
QAction* GenerateAction;
|
QAction* GenerateAction;
|
||||||
QAction* SuppressDevWarningsAction;
|
QAction* SuppressDevWarningsAction;
|
||||||
QAction* StrictModeAction;
|
QAction* WarnUninitializedAction;
|
||||||
QAction* InstallForCommandLineAction;
|
QAction* InstallForCommandLineAction;
|
||||||
State CurrentState;
|
State CurrentState;
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@ QCMake::QCMake(QObject* p)
|
||||||
: QObject(p)
|
: QObject(p)
|
||||||
{
|
{
|
||||||
this->SuppressDevWarnings = false;
|
this->SuppressDevWarnings = false;
|
||||||
this->StrictMode = false;
|
this->WarnUninitializedMode = false;
|
||||||
qRegisterMetaType<QCMakeProperty>();
|
qRegisterMetaType<QCMakeProperty>();
|
||||||
qRegisterMetaType<QCMakePropertyList>();
|
qRegisterMetaType<QCMakePropertyList>();
|
||||||
|
|
||||||
|
@ -165,8 +165,8 @@ void QCMake::configure()
|
||||||
this->CMakeInstance->CreateGlobalGenerator(this->Generator.toAscii().data()));
|
this->CMakeInstance->CreateGlobalGenerator(this->Generator.toAscii().data()));
|
||||||
this->CMakeInstance->LoadCache();
|
this->CMakeInstance->LoadCache();
|
||||||
this->CMakeInstance->SetSuppressDevWarnings(this->SuppressDevWarnings);
|
this->CMakeInstance->SetSuppressDevWarnings(this->SuppressDevWarnings);
|
||||||
std::cerr << "set strict " << this->StrictMode << "\n";
|
std::cerr << "set warn uninitialized " << this->WarnUninitializedMode << "\n";
|
||||||
this->CMakeInstance->SetStrictMode(this->StrictMode);
|
this->CMakeInstance->SetWarnUninitialized(this->WarnUninitializedMode);
|
||||||
this->CMakeInstance->PreLoadCMakeFiles();
|
this->CMakeInstance->PreLoadCMakeFiles();
|
||||||
|
|
||||||
cmSystemTools::ResetErrorOccuredFlag();
|
cmSystemTools::ResetErrorOccuredFlag();
|
||||||
|
@ -421,7 +421,7 @@ void QCMake::setSuppressDevWarnings(bool value)
|
||||||
this->SuppressDevWarnings = value;
|
this->SuppressDevWarnings = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QCMake::setStrictMode(bool value)
|
void QCMake::setWarnUninitializedMode(bool value)
|
||||||
{
|
{
|
||||||
this->StrictMode = value;
|
this->WarnUninitializedMode = value;
|
||||||
}
|
}
|
||||||
|
|
|
@ -88,8 +88,8 @@ public slots:
|
||||||
void setDebugOutput(bool);
|
void setDebugOutput(bool);
|
||||||
/// set whether to do suppress dev warnings
|
/// set whether to do suppress dev warnings
|
||||||
void setSuppressDevWarnings(bool value);
|
void setSuppressDevWarnings(bool value);
|
||||||
/// set whether to run cmake in strict mode
|
/// set whether to run cmake with warnings about uninitialized variables
|
||||||
void setStrictMode(bool value);
|
void setWarnUninitializedMode(bool value);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/// get the list of cache properties
|
/// get the list of cache properties
|
||||||
|
@ -135,7 +135,7 @@ protected:
|
||||||
static void errorCallback(const char* msg, const char* title,
|
static void errorCallback(const char* msg, const char* title,
|
||||||
bool&, void* cd);
|
bool&, void* cd);
|
||||||
bool SuppressDevWarnings;
|
bool SuppressDevWarnings;
|
||||||
bool StrictMode;
|
bool WarnUninitializedMode;
|
||||||
QString SourceDirectory;
|
QString SourceDirectory;
|
||||||
QString BinaryDirectory;
|
QString BinaryDirectory;
|
||||||
QString Generator;
|
QString Generator;
|
||||||
|
|
|
@ -20,7 +20,7 @@ int cmCommandArgument_yyparse( yyscan_t yyscanner );
|
||||||
//
|
//
|
||||||
cmCommandArgumentParserHelper::cmCommandArgumentParserHelper()
|
cmCommandArgumentParserHelper::cmCommandArgumentParserHelper()
|
||||||
{
|
{
|
||||||
this->StrictMode = false;
|
this->WarnUninitialized = false;
|
||||||
this->FileLine = -1;
|
this->FileLine = -1;
|
||||||
this->FileName = 0;
|
this->FileName = 0;
|
||||||
this->RemoveEmpty = true;
|
this->RemoveEmpty = true;
|
||||||
|
@ -127,7 +127,7 @@ char* cmCommandArgumentParserHelper::ExpandVariable(const char* var)
|
||||||
// check to see if we need to print a warning
|
// check to see if we need to print a warning
|
||||||
// if strict mode is on and the variable has
|
// if strict mode is on and the variable has
|
||||||
// not been "cleared"/initialized with a set(foo ) call
|
// not been "cleared"/initialized with a set(foo ) call
|
||||||
if(this->StrictMode && !this->Makefile->VariableInitialized(var))
|
if(this->WarnUninitialized && !this->Makefile->VariableInitialized(var))
|
||||||
{
|
{
|
||||||
cmOStringStream msg;
|
cmOStringStream msg;
|
||||||
msg << this->FileName << ":" << this->FileLine << ":" <<
|
msg << this->FileName << ":" << this->FileLine << ":" <<
|
||||||
|
@ -330,7 +330,7 @@ void cmCommandArgumentParserHelper::Error(const char* str)
|
||||||
void cmCommandArgumentParserHelper::SetMakefile(const cmMakefile* mf)
|
void cmCommandArgumentParserHelper::SetMakefile(const cmMakefile* mf)
|
||||||
{
|
{
|
||||||
this->Makefile = mf;
|
this->Makefile = mf;
|
||||||
this->StrictMode = mf->GetCMakeInstance()->GetStrictMode();
|
this->WarnUninitialized = mf->GetCMakeInstance()->GetWarnUninitialized();
|
||||||
}
|
}
|
||||||
|
|
||||||
void cmCommandArgumentParserHelper::SetResult(const char* value)
|
void cmCommandArgumentParserHelper::SetResult(const char* value)
|
||||||
|
|
|
@ -96,7 +96,7 @@ private:
|
||||||
const cmMakefile* Makefile;
|
const cmMakefile* Makefile;
|
||||||
std::string Result;
|
std::string Result;
|
||||||
const char* FileName;
|
const char* FileName;
|
||||||
bool StrictMode;
|
bool WarnUninitialized;
|
||||||
long FileLine;
|
long FileLine;
|
||||||
bool EscapeQuotes;
|
bool EscapeQuotes;
|
||||||
std::string ErrorString;
|
std::string ErrorString;
|
||||||
|
|
|
@ -140,7 +140,7 @@ void cmNeedBackwardsCompatibility(const std::string& variable,
|
||||||
cmake::cmake()
|
cmake::cmake()
|
||||||
{
|
{
|
||||||
this->Trace = false;
|
this->Trace = false;
|
||||||
this->StrictMode = false;
|
this->WarnUninitialized = false;
|
||||||
this->FindUnused = false;
|
this->FindUnused = false;
|
||||||
this->DefaultToUsed = false;
|
this->DefaultToUsed = false;
|
||||||
this->SuppressDevWarnings = false;
|
this->SuppressDevWarnings = false;
|
||||||
|
@ -616,10 +616,10 @@ void cmake::SetArgs(const std::vector<std::string>& args)
|
||||||
std::cout << "Running with trace output on.\n";
|
std::cout << "Running with trace output on.\n";
|
||||||
this->SetTrace(true);
|
this->SetTrace(true);
|
||||||
}
|
}
|
||||||
else if(arg.find("--strict-mode",0) == 0)
|
else if(arg.find("--warn-uninitialized",0) == 0)
|
||||||
{
|
{
|
||||||
std::cout << "Running in strict mode.\n";
|
std::cout << "Warn about uninitialized values.\n";
|
||||||
this->SetStrictMode(true);
|
this->SetWarnUninitialized(true);
|
||||||
}
|
}
|
||||||
else if(arg.find("--find-unused",0) == 0)
|
else if(arg.find("--find-unused",0) == 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -306,8 +306,8 @@ class cmake
|
||||||
// Do we want trace output during the cmake run.
|
// Do we want trace output during the cmake run.
|
||||||
bool GetTrace() { return this->Trace;}
|
bool GetTrace() { return this->Trace;}
|
||||||
void SetTrace(bool b) { this->Trace = b;}
|
void SetTrace(bool b) { this->Trace = b;}
|
||||||
bool GetStrictMode() { return this->StrictMode;}
|
bool GetWarnUninitialized() { return this->WarnUninitialized;}
|
||||||
void SetStrictMode(bool b) { this->StrictMode = b;}
|
void SetWarnUninitialized(bool b) { this->WarnUninitialized = b;}
|
||||||
bool GetFindUnused() { return this->FindUnused;}
|
bool GetFindUnused() { return this->FindUnused;}
|
||||||
void SetFindUnused(bool b) { this->FindUnused = b;}
|
void SetFindUnused(bool b) { this->FindUnused = b;}
|
||||||
bool GetDefaultToUsed() { return this->DefaultToUsed;}
|
bool GetDefaultToUsed() { return this->DefaultToUsed;}
|
||||||
|
@ -449,7 +449,7 @@ private:
|
||||||
bool ScriptMode;
|
bool ScriptMode;
|
||||||
bool DebugOutput;
|
bool DebugOutput;
|
||||||
bool Trace;
|
bool Trace;
|
||||||
bool StrictMode;
|
bool WarnUninitialized;
|
||||||
bool FindUnused;
|
bool FindUnused;
|
||||||
bool DefaultToUsed;
|
bool DefaultToUsed;
|
||||||
std::string CMakeEditCommand;
|
std::string CMakeEditCommand;
|
||||||
|
|
|
@ -120,9 +120,8 @@ static const char * cmDocumentationOptions[][3] =
|
||||||
{"--trace", "Put cmake in trace mode.",
|
{"--trace", "Put cmake in trace mode.",
|
||||||
"Print a trace of all calls made and from where with "
|
"Print a trace of all calls made and from where with "
|
||||||
"message(send_error ) calls."},
|
"message(send_error ) calls."},
|
||||||
{"--strict-mode", "Put cmake in strict mode.",
|
{"--warn-uninitialized", "Warn about uninitialized values.",
|
||||||
"In strict mode cmake will print a warning when an uninitialized variable "
|
"Print a warning when an uninitialized variable is used."},
|
||||||
"is used."},
|
|
||||||
{"--find-unused", "Find unused variables.",
|
{"--find-unused", "Find unused variables.",
|
||||||
"Find variables that are declared on the command line, but not used."},
|
"Find variables that are declared on the command line, but not used."},
|
||||||
{"--find-unused-all", "Find all unused variables.",
|
{"--find-unused-all", "Find all unused variables.",
|
||||||
|
|
Loading…
Reference in New Issue