Rename strict-mode to warn-uninitialized

This commit is contained in:
Ben Boeckel 2010-08-25 12:35:40 -04:00
parent e141bc950a
commit d7999e9b29
9 changed files with 27 additions and 28 deletions

View File

@ -117,9 +117,9 @@ CMakeSetupDialog::CMakeSetupDialog()
this->SuppressDevWarningsAction =
OptionsMenu->addAction(tr("&Suppress dev Warnings (-Wno-dev)"));
this->SuppressDevWarningsAction->setCheckable(true);
this->StrictModeAction =
OptionsMenu->addAction(tr("&Strict Mode (--strict-mode)"));
this->StrictModeAction->setCheckable(true);
this->WarnUninitializedAction =
OptionsMenu->addAction(tr("&Warn Uninitialized (--warn-uninitialized)"));
this->WarnUninitializedAction->setCheckable(true);
QAction* debugAction = OptionsMenu->addAction(tr("&Debug Output"));
debugAction->setCheckable(true);
@ -244,9 +244,9 @@ void CMakeSetupDialog::initialize()
QObject::connect(this->SuppressDevWarningsAction, SIGNAL(triggered(bool)),
this->CMakeThread->cmakeInstance(), SLOT(setSuppressDevWarnings(bool)));
QObject::connect(this->StrictModeAction, SIGNAL(triggered(bool)),
QObject::connect(this->WarnUninitializedAction, SIGNAL(triggered(bool)),
this->CMakeThread->cmakeInstance(),
SLOT(setStrictMode(bool)));
SLOT(setWarnUninitializedMode(bool)));
if(!this->SourceDirectory->text().isEmpty() ||
!this->BinaryDirectory->lineEdit()->text().isEmpty())

View File

@ -93,7 +93,7 @@ protected:
QAction* ConfigureAction;
QAction* GenerateAction;
QAction* SuppressDevWarningsAction;
QAction* StrictModeAction;
QAction* WarnUninitializedAction;
QAction* InstallForCommandLineAction;
State CurrentState;

View File

@ -28,7 +28,7 @@ QCMake::QCMake(QObject* p)
: QObject(p)
{
this->SuppressDevWarnings = false;
this->StrictMode = false;
this->WarnUninitializedMode = false;
qRegisterMetaType<QCMakeProperty>();
qRegisterMetaType<QCMakePropertyList>();
@ -165,8 +165,8 @@ void QCMake::configure()
this->CMakeInstance->CreateGlobalGenerator(this->Generator.toAscii().data()));
this->CMakeInstance->LoadCache();
this->CMakeInstance->SetSuppressDevWarnings(this->SuppressDevWarnings);
std::cerr << "set strict " << this->StrictMode << "\n";
this->CMakeInstance->SetStrictMode(this->StrictMode);
std::cerr << "set warn uninitialized " << this->WarnUninitializedMode << "\n";
this->CMakeInstance->SetWarnUninitialized(this->WarnUninitializedMode);
this->CMakeInstance->PreLoadCMakeFiles();
cmSystemTools::ResetErrorOccuredFlag();
@ -421,7 +421,7 @@ void QCMake::setSuppressDevWarnings(bool value)
this->SuppressDevWarnings = value;
}
void QCMake::setStrictMode(bool value)
void QCMake::setWarnUninitializedMode(bool value)
{
this->StrictMode = value;
this->WarnUninitializedMode = value;
}

View File

@ -88,8 +88,8 @@ public slots:
void setDebugOutput(bool);
/// set whether to do suppress dev warnings
void setSuppressDevWarnings(bool value);
/// set whether to run cmake in strict mode
void setStrictMode(bool value);
/// set whether to run cmake with warnings about uninitialized variables
void setWarnUninitializedMode(bool value);
public:
/// get the list of cache properties
@ -135,7 +135,7 @@ protected:
static void errorCallback(const char* msg, const char* title,
bool&, void* cd);
bool SuppressDevWarnings;
bool StrictMode;
bool WarnUninitializedMode;
QString SourceDirectory;
QString BinaryDirectory;
QString Generator;

View File

@ -20,7 +20,7 @@ int cmCommandArgument_yyparse( yyscan_t yyscanner );
//
cmCommandArgumentParserHelper::cmCommandArgumentParserHelper()
{
this->StrictMode = false;
this->WarnUninitialized = false;
this->FileLine = -1;
this->FileName = 0;
this->RemoveEmpty = true;
@ -127,7 +127,7 @@ char* cmCommandArgumentParserHelper::ExpandVariable(const char* var)
// check to see if we need to print a warning
// if strict mode is on and the variable has
// 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;
msg << this->FileName << ":" << this->FileLine << ":" <<
@ -330,7 +330,7 @@ void cmCommandArgumentParserHelper::Error(const char* str)
void cmCommandArgumentParserHelper::SetMakefile(const cmMakefile* mf)
{
this->Makefile = mf;
this->StrictMode = mf->GetCMakeInstance()->GetStrictMode();
this->WarnUninitialized = mf->GetCMakeInstance()->GetWarnUninitialized();
}
void cmCommandArgumentParserHelper::SetResult(const char* value)

View File

@ -96,7 +96,7 @@ private:
const cmMakefile* Makefile;
std::string Result;
const char* FileName;
bool StrictMode;
bool WarnUninitialized;
long FileLine;
bool EscapeQuotes;
std::string ErrorString;

View File

@ -140,7 +140,7 @@ void cmNeedBackwardsCompatibility(const std::string& variable,
cmake::cmake()
{
this->Trace = false;
this->StrictMode = false;
this->WarnUninitialized = false;
this->FindUnused = false;
this->DefaultToUsed = 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";
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";
this->SetStrictMode(true);
std::cout << "Warn about uninitialized values.\n";
this->SetWarnUninitialized(true);
}
else if(arg.find("--find-unused",0) == 0)
{

View File

@ -306,8 +306,8 @@ class cmake
// Do we want trace output during the cmake run.
bool GetTrace() { return this->Trace;}
void SetTrace(bool b) { this->Trace = b;}
bool GetStrictMode() { return this->StrictMode;}
void SetStrictMode(bool b) { this->StrictMode = b;}
bool GetWarnUninitialized() { return this->WarnUninitialized;}
void SetWarnUninitialized(bool b) { this->WarnUninitialized = b;}
bool GetFindUnused() { return this->FindUnused;}
void SetFindUnused(bool b) { this->FindUnused = b;}
bool GetDefaultToUsed() { return this->DefaultToUsed;}
@ -449,7 +449,7 @@ private:
bool ScriptMode;
bool DebugOutput;
bool Trace;
bool StrictMode;
bool WarnUninitialized;
bool FindUnused;
bool DefaultToUsed;
std::string CMakeEditCommand;

View File

@ -120,9 +120,8 @@ static const char * cmDocumentationOptions[][3] =
{"--trace", "Put cmake in trace mode.",
"Print a trace of all calls made and from where with "
"message(send_error ) calls."},
{"--strict-mode", "Put cmake in strict mode.",
"In strict mode cmake will print a warning when an uninitialized variable "
"is used."},
{"--warn-uninitialized", "Warn about uninitialized values.",
"Print a warning when an uninitialized variable is used."},
{"--find-unused", "Find unused variables.",
"Find variables that are declared on the command line, but not used."},
{"--find-unused-all", "Find all unused variables.",