forked from qt-creator/qt-creator
ProjectExplorer: Hide GccToolChain::WarningFlagAdder declaration
It's only used in the .cpp. Change-Id: Ib9ce5ca49dfe2440d553c98cf688dcd6d31ac084 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -48,6 +48,49 @@ using namespace Utils;
|
||||
namespace ProjectExplorer {
|
||||
namespace Internal {
|
||||
|
||||
class WarningFlagAdder
|
||||
{
|
||||
public:
|
||||
WarningFlagAdder(const QString &flag, WarningFlags &flags) :
|
||||
m_flags(flags)
|
||||
{
|
||||
if (!flag.startsWith("-W")) {
|
||||
m_triggered = true;
|
||||
return;
|
||||
}
|
||||
|
||||
m_doesEnable = !flag.startsWith("-Wno-");
|
||||
if (m_doesEnable)
|
||||
m_flagUtf8 = flag.mid(2).toUtf8();
|
||||
else
|
||||
m_flagUtf8 = flag.mid(5).toUtf8();
|
||||
}
|
||||
|
||||
void operator()(const char name[], WarningFlags flagsSet)
|
||||
{
|
||||
if (m_triggered)
|
||||
return;
|
||||
if (0 == strcmp(m_flagUtf8.data(), name)) {
|
||||
m_triggered = true;
|
||||
if (m_doesEnable)
|
||||
m_flags |= flagsSet;
|
||||
else
|
||||
m_flags &= ~flagsSet;
|
||||
}
|
||||
}
|
||||
|
||||
bool triggered() const
|
||||
{
|
||||
return m_triggered;
|
||||
}
|
||||
|
||||
private:
|
||||
QByteArray m_flagUtf8;
|
||||
WarningFlags &m_flags;
|
||||
bool m_doesEnable = false;
|
||||
bool m_triggered = false;
|
||||
};
|
||||
|
||||
static const QStringList languageOption(Id languageId)
|
||||
{
|
||||
if (languageId == Constants::C_LANGUAGE_ID)
|
||||
@@ -1975,40 +2018,6 @@ void GccToolChainConfigWidget::updateParentToolChainComboBox()
|
||||
}
|
||||
}
|
||||
|
||||
GccToolChain::WarningFlagAdder::WarningFlagAdder(const QString &flag, WarningFlags &flags) :
|
||||
m_flags(flags)
|
||||
{
|
||||
if (!flag.startsWith("-W")) {
|
||||
m_triggered = true;
|
||||
return;
|
||||
}
|
||||
|
||||
m_doesEnable = !flag.startsWith("-Wno-");
|
||||
if (m_doesEnable)
|
||||
m_flagUtf8 = flag.mid(2).toUtf8();
|
||||
else
|
||||
m_flagUtf8 = flag.mid(5).toUtf8();
|
||||
}
|
||||
|
||||
void GccToolChain::WarningFlagAdder::operator ()(const char name[], WarningFlags flagsSet)
|
||||
{
|
||||
if (m_triggered)
|
||||
return;
|
||||
if (0 == strcmp(m_flagUtf8.data(), name))
|
||||
{
|
||||
m_triggered = true;
|
||||
if (m_doesEnable)
|
||||
m_flags |= flagsSet;
|
||||
else
|
||||
m_flags &= ~flagsSet;
|
||||
}
|
||||
}
|
||||
|
||||
bool GccToolChain::WarningFlagAdder::triggered() const
|
||||
{
|
||||
return m_triggered;
|
||||
}
|
||||
|
||||
} // namespace ProjectExplorer
|
||||
|
||||
// Unit tests:
|
||||
|
||||
@@ -127,20 +127,6 @@ protected:
|
||||
|
||||
int priority() const override { return m_priority; }
|
||||
|
||||
class WarningFlagAdder
|
||||
{
|
||||
public:
|
||||
WarningFlagAdder(const QString &flag, Utils::WarningFlags &flags);
|
||||
void operator ()(const char name[], Utils::WarningFlags flagsSet);
|
||||
|
||||
bool triggered() const;
|
||||
private:
|
||||
QByteArray m_flagUtf8;
|
||||
Utils::WarningFlags &m_flags;
|
||||
bool m_doesEnable = false;
|
||||
bool m_triggered = false;
|
||||
};
|
||||
|
||||
QString sysRoot() const override;
|
||||
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user