Add warn-unused to the Qt interface

This commit is contained in:
Ben Boeckel 2010-08-25 12:43:02 -04:00
parent 636e6c4ef7
commit 786e2695cb
4 changed files with 34 additions and 0 deletions

View File

@ -120,6 +120,12 @@ CMakeSetupDialog::CMakeSetupDialog()
this->WarnUninitializedAction = this->WarnUninitializedAction =
OptionsMenu->addAction(tr("&Warn Uninitialized (--warn-uninitialized)")); OptionsMenu->addAction(tr("&Warn Uninitialized (--warn-uninitialized)"));
this->WarnUninitializedAction->setCheckable(true); this->WarnUninitializedAction->setCheckable(true);
this->WarnUnusedAction =
OptionsMenu->addAction(tr("&Warn Unused (--warn-unused)"));
this->WarnUnusedAction->setCheckable(true);
this->WarnUnusedAllAction =
OptionsMenu->addAction(tr("&Warn Unused All (--warn-unused-all)"));
this->WarnUnusedAllAction->setCheckable(true);
QAction* debugAction = OptionsMenu->addAction(tr("&Debug Output")); QAction* debugAction = OptionsMenu->addAction(tr("&Debug Output"));
debugAction->setCheckable(true); debugAction->setCheckable(true);
@ -247,6 +253,12 @@ void CMakeSetupDialog::initialize()
QObject::connect(this->WarnUninitializedAction, SIGNAL(triggered(bool)), QObject::connect(this->WarnUninitializedAction, SIGNAL(triggered(bool)),
this->CMakeThread->cmakeInstance(), this->CMakeThread->cmakeInstance(),
SLOT(setWarnUninitializedMode(bool))); SLOT(setWarnUninitializedMode(bool)));
QObject::connect(this->WarnUnusedAction, SIGNAL(triggered(bool)),
this->CMakeThread->cmakeInstance(),
SLOT(setWarnUnusedMode(bool)));
QObject::connect(this->WarnUnusedAllAction, SIGNAL(triggered(bool)),
this->CMakeThread->cmakeInstance(),
SLOT(setWarnUnusedAllMode(bool)));
if(!this->SourceDirectory->text().isEmpty() || if(!this->SourceDirectory->text().isEmpty() ||
!this->BinaryDirectory->lineEdit()->text().isEmpty()) !this->BinaryDirectory->lineEdit()->text().isEmpty())

View File

@ -94,6 +94,8 @@ protected:
QAction* GenerateAction; QAction* GenerateAction;
QAction* SuppressDevWarningsAction; QAction* SuppressDevWarningsAction;
QAction* WarnUninitializedAction; QAction* WarnUninitializedAction;
QAction* WarnUnusedAction;
QAction* WarnUnusedAllAction;
QAction* InstallForCommandLineAction; QAction* InstallForCommandLineAction;
State CurrentState; State CurrentState;

View File

@ -29,6 +29,8 @@ QCMake::QCMake(QObject* p)
{ {
this->SuppressDevWarnings = false; this->SuppressDevWarnings = false;
this->WarnUninitializedMode = false; this->WarnUninitializedMode = false;
this->WarnUnusedMode = false;
this->WarnUnusedAllMode = false;
qRegisterMetaType<QCMakeProperty>(); qRegisterMetaType<QCMakeProperty>();
qRegisterMetaType<QCMakePropertyList>(); qRegisterMetaType<QCMakePropertyList>();
@ -167,6 +169,8 @@ void QCMake::configure()
this->CMakeInstance->SetSuppressDevWarnings(this->SuppressDevWarnings); this->CMakeInstance->SetSuppressDevWarnings(this->SuppressDevWarnings);
std::cerr << "set warn uninitialized " << this->WarnUninitializedMode << "\n"; std::cerr << "set warn uninitialized " << this->WarnUninitializedMode << "\n";
this->CMakeInstance->SetWarnUninitialized(this->WarnUninitializedMode); this->CMakeInstance->SetWarnUninitialized(this->WarnUninitializedMode);
this->CMakeInstance->SetWarnUnused(this->WarnUnusedMode);
this->CMakeInstance->SetDefaultToUsed(!this->WarnUnusedAllMode);
this->CMakeInstance->PreLoadCMakeFiles(); this->CMakeInstance->PreLoadCMakeFiles();
cmSystemTools::ResetErrorOccuredFlag(); cmSystemTools::ResetErrorOccuredFlag();
@ -425,3 +429,13 @@ void QCMake::setWarnUninitializedMode(bool value)
{ {
this->WarnUninitializedMode = value; this->WarnUninitializedMode = value;
} }
void QCMake::setWarnUnusedMode(bool value)
{
this->WarnUnusedMode = value;
}
void QCMake::setWarnUnusedAllMode(bool value)
{
this->WarnUnusedAllMode = value;
}

View File

@ -90,6 +90,10 @@ public slots:
void setSuppressDevWarnings(bool value); void setSuppressDevWarnings(bool value);
/// set whether to run cmake with warnings about uninitialized variables /// set whether to run cmake with warnings about uninitialized variables
void setWarnUninitializedMode(bool value); void setWarnUninitializedMode(bool value);
/// set whether to run cmake with warnings about unused variables
void setWarnUnusedMode(bool value);
/// set whether to run cmake with warnings about all unused variables
void setWarnUnusedAllMode(bool value);
public: public:
/// get the list of cache properties /// get the list of cache properties
@ -136,6 +140,8 @@ protected:
bool&, void* cd); bool&, void* cd);
bool SuppressDevWarnings; bool SuppressDevWarnings;
bool WarnUninitializedMode; bool WarnUninitializedMode;
bool WarnUnusedMode;
bool WarnUnusedAllMode;
QString SourceDirectory; QString SourceDirectory;
QString BinaryDirectory; QString BinaryDirectory;
QString Generator; QString Generator;