forked from qt-creator/qt-creator
Move ProjectExplorer::WarningFlags to a more suitable location
No need to waste a (badly named) header file on that one type. Also fix typo in enum value. Change-Id: I0cd4e3cda9383c3ab197ae6788666324a1dce43d Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -59,6 +59,35 @@ enum class LanguageExtension : unsigned char {
|
||||
All = Gnu | Microsoft | Borland | OpenMP | ObjectiveC
|
||||
};
|
||||
|
||||
enum class WarningFlags {
|
||||
// General settings
|
||||
NoWarnings = 0,
|
||||
AsErrors = 1 << 0,
|
||||
Default = 1 << 1,
|
||||
All = 1 << 2,
|
||||
Extra = 1 << 3,
|
||||
Pedantic = 1 << 4,
|
||||
|
||||
// Any language
|
||||
UnusedLocals = 1 << 7,
|
||||
UnusedParams = 1 << 8,
|
||||
UnusedFunctions = 1 << 9,
|
||||
UnusedResult = 1 << 10,
|
||||
UnusedValue = 1 << 11,
|
||||
Documentation = 1 << 12,
|
||||
UninitializedVars = 1 << 13,
|
||||
HiddenLocals = 1 << 14,
|
||||
UnknownPragma = 1 << 15,
|
||||
Deprecated = 1 << 16,
|
||||
SignedComparison = 1 << 17,
|
||||
IgnoredQualifiers = 1 << 18,
|
||||
|
||||
// C++
|
||||
OverloadedVirtual = 1 << 24,
|
||||
EffectiveCxx = 1 << 25,
|
||||
NonVirtualDestructor = 1 << 26
|
||||
};
|
||||
|
||||
Q_DECLARE_FLAGS(LanguageExtensions, LanguageExtension)
|
||||
|
||||
enum class QtVersion { Unknown = -1, None, Qt4, Qt5 };
|
||||
@@ -76,3 +105,28 @@ constexpr bool operator&&(Utils::LanguageExtension first, Utils::LanguageExtensi
|
||||
{
|
||||
return static_cast<unsigned char>(first) & static_cast<unsigned char>(second);
|
||||
}
|
||||
|
||||
inline Utils::WarningFlags operator|(Utils::WarningFlags first, Utils::WarningFlags second)
|
||||
{
|
||||
return Utils::WarningFlags(int(first) | int(second));
|
||||
}
|
||||
|
||||
inline Utils::WarningFlags operator&(Utils::WarningFlags first, Utils::WarningFlags second)
|
||||
{
|
||||
return Utils::WarningFlags(int(first) & int(second));
|
||||
}
|
||||
|
||||
inline void operator|=(Utils::WarningFlags &first, Utils::WarningFlags second)
|
||||
{
|
||||
first = first | second;
|
||||
}
|
||||
|
||||
inline void operator&=(Utils::WarningFlags &first, Utils::WarningFlags second)
|
||||
{
|
||||
first = first & second;
|
||||
}
|
||||
|
||||
inline Utils::WarningFlags operator~(Utils::WarningFlags flags)
|
||||
{
|
||||
return Utils::WarningFlags(~int(flags));
|
||||
}
|
||||
|
@@ -61,7 +61,7 @@ public:
|
||||
ProjectExplorer::Macros predefinedMacros(const QStringList &cxxflags) const final;
|
||||
|
||||
Utils::LanguageExtensions languageExtensions(const QStringList &cxxflags) const final;
|
||||
ProjectExplorer::WarningFlags warningFlags(const QStringList &cxxflags) const final;
|
||||
Utils::WarningFlags warningFlags(const QStringList &cxxflags) const final;
|
||||
|
||||
BuiltInHeaderPathsRunner createBuiltInHeaderPathsRunner(const Utils::Environment &) const final;
|
||||
ProjectExplorer::HeaderPaths builtInHeaderPaths(const QStringList &cxxFlags,
|
||||
|
@@ -61,7 +61,7 @@ public:
|
||||
ProjectExplorer::Macros predefinedMacros(const QStringList &cxxflags) const final;
|
||||
|
||||
Utils::LanguageExtensions languageExtensions(const QStringList &cxxflags) const final;
|
||||
ProjectExplorer::WarningFlags warningFlags(const QStringList &cxxflags) const final;
|
||||
Utils::WarningFlags warningFlags(const QStringList &cxxflags) const final;
|
||||
|
||||
BuiltInHeaderPathsRunner createBuiltInHeaderPathsRunner(
|
||||
const Utils::Environment &) const final;
|
||||
|
@@ -61,7 +61,7 @@ public:
|
||||
ProjectExplorer::Macros predefinedMacros(const QStringList &cxxflags) const final;
|
||||
|
||||
Utils::LanguageExtensions languageExtensions(const QStringList &cxxflags) const final;
|
||||
ProjectExplorer::WarningFlags warningFlags(const QStringList &cxxflags) const final;
|
||||
Utils::WarningFlags warningFlags(const QStringList &cxxflags) const final;
|
||||
|
||||
BuiltInHeaderPathsRunner createBuiltInHeaderPathsRunner(
|
||||
const Utils::Environment &) const final;
|
||||
|
@@ -31,7 +31,6 @@
|
||||
|
||||
#include <projectexplorer/buildtargettype.h>
|
||||
#include <projectexplorer/headerpath.h>
|
||||
#include <projectexplorer/projectexplorer_global.h>
|
||||
#include <projectexplorer/projectmacro.h>
|
||||
#include <projectexplorer/rawprojectpart.h>
|
||||
|
||||
@@ -110,7 +109,7 @@ public:
|
||||
QString toolChainTargetTriple;
|
||||
ToolChainWordWidth toolChainWordWidth = WordWidth32Bit;
|
||||
Utils::FilePath toolChainInstallDir;
|
||||
ProjectExplorer::WarningFlags warningFlags = ProjectExplorer::WarningFlags::Default;
|
||||
Utils::WarningFlags warningFlags = Utils::WarningFlags::Default;
|
||||
|
||||
// Misc
|
||||
QStringList extraCodeModelFlags;
|
||||
|
@@ -42,7 +42,7 @@ public:
|
||||
MacroInspectionRunner createMacroInspectionRunner() const override;
|
||||
ProjectExplorer::Macros predefinedMacros(const QStringList &flags) const final;
|
||||
Utils::LanguageExtensions languageExtensions(const QStringList &flags) const final;
|
||||
ProjectExplorer::WarningFlags warningFlags(const QStringList &flags) const final;
|
||||
Utils::WarningFlags warningFlags(const QStringList &flags) const final;
|
||||
|
||||
BuiltInHeaderPathsRunner createBuiltInHeaderPathsRunner(
|
||||
const Utils::Environment &) const override;
|
||||
|
@@ -133,7 +133,6 @@ add_qtc_plugin(ProjectExplorer
|
||||
projectexplorer.cpp projectexplorer.h
|
||||
projectexplorer.qrc
|
||||
projectexplorer_export.h
|
||||
projectexplorer_global.h
|
||||
projectexplorerconstants.h
|
||||
projectexplorericons.cpp projectexplorericons.h
|
||||
projectexplorersettings.h
|
||||
|
@@ -26,7 +26,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "projectconfigurationaspects.h"
|
||||
#include "projectexplorer_global.h"
|
||||
|
||||
namespace ProjectExplorer {
|
||||
|
||||
|
@@ -25,8 +25,6 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "projectexplorer_global.h"
|
||||
|
||||
#include "projectexplorer/runconfigurationaspects.h"
|
||||
|
||||
namespace ProjectExplorer {
|
||||
|
@@ -73,7 +73,7 @@ public:
|
||||
MacroInspectionRunner createMacroInspectionRunner() const override;
|
||||
Macros predefinedMacros(const QStringList &cxxflags) const override;
|
||||
Utils::LanguageExtensions languageExtensions(const QStringList &cxxflags) const override;
|
||||
WarningFlags warningFlags(const QStringList &cxxflags) const override;
|
||||
Utils::WarningFlags warningFlags(const QStringList &cxxflags) const override;
|
||||
const Macros &rawPredefinedMacros() const;
|
||||
void setPredefinedMacros(const Macros ¯os);
|
||||
|
||||
|
@@ -507,12 +507,12 @@ Utils::LanguageExtensions GccToolChain::languageExtensions(const QStringList &cx
|
||||
WarningFlags GccToolChain::warningFlags(const QStringList &cflags) const
|
||||
{
|
||||
// based on 'LC_ALL="en" gcc -Q --help=warnings | grep enabled'
|
||||
WarningFlags flags(WarningFlags::Deprecated | WarningFlags::IgnoredQualfiers
|
||||
WarningFlags flags(WarningFlags::Deprecated | WarningFlags::IgnoredQualifiers
|
||||
| WarningFlags::SignedComparison | WarningFlags::UninitializedVars);
|
||||
WarningFlags groupWall(WarningFlags::All | WarningFlags::UnknownPragma | WarningFlags::UnusedFunctions
|
||||
| WarningFlags::UnusedLocals | WarningFlags::UnusedResult | WarningFlags::UnusedValue
|
||||
| WarningFlags::SignedComparison | WarningFlags::UninitializedVars);
|
||||
WarningFlags groupWextra(WarningFlags::Extra | WarningFlags::IgnoredQualfiers | WarningFlags::UnusedParams);
|
||||
WarningFlags groupWextra(WarningFlags::Extra | WarningFlags::IgnoredQualifiers | WarningFlags::UnusedParams);
|
||||
|
||||
foreach (const QString &flag, cflags) {
|
||||
if (flag == "--all-warnings")
|
||||
@@ -530,7 +530,7 @@ WarningFlags GccToolChain::warningFlags(const QStringList &cflags) const
|
||||
add("extra", groupWextra);
|
||||
add("deprecated", WarningFlags::Deprecated);
|
||||
add("effc++", WarningFlags::EffectiveCxx);
|
||||
add("ignored-qualifiers", WarningFlags::IgnoredQualfiers);
|
||||
add("ignored-qualifiers", WarningFlags::IgnoredQualifiers);
|
||||
add("non-virtual-dtor", WarningFlags::NonVirtualDestructor);
|
||||
add("overloaded-virtual", WarningFlags::OverloadedVirtual);
|
||||
add("shadow", WarningFlags::HiddenLocals);
|
||||
|
@@ -79,7 +79,7 @@ public:
|
||||
bool isValid() const override;
|
||||
|
||||
Utils::LanguageExtensions languageExtensions(const QStringList &cxxflags) const override;
|
||||
WarningFlags warningFlags(const QStringList &cflags) const override;
|
||||
Utils::WarningFlags warningFlags(const QStringList &cflags) const override;
|
||||
|
||||
MacroInspectionRunner createMacroInspectionRunner() const override;
|
||||
Macros predefinedMacros(const QStringList &cxxflags) const override;
|
||||
@@ -166,13 +166,13 @@ protected:
|
||||
class WarningFlagAdder
|
||||
{
|
||||
public:
|
||||
WarningFlagAdder(const QString &flag, WarningFlags &flags);
|
||||
void operator ()(const char name[], WarningFlags flagsSet);
|
||||
WarningFlagAdder(const QString &flag, Utils::WarningFlags &flags);
|
||||
void operator ()(const char name[], Utils::WarningFlags flagsSet);
|
||||
|
||||
bool triggered() const;
|
||||
private:
|
||||
QByteArray m_flagUtf8;
|
||||
WarningFlags &m_flags;
|
||||
Utils::WarningFlags &m_flags;
|
||||
bool m_doesEnable = false;
|
||||
bool m_triggered = false;
|
||||
};
|
||||
@@ -220,7 +220,7 @@ public:
|
||||
Utils::FilePath makeCommand(const Utils::Environment &environment) const override;
|
||||
|
||||
Utils::LanguageExtensions languageExtensions(const QStringList &cxxflags) const override;
|
||||
WarningFlags warningFlags(const QStringList &cflags) const override;
|
||||
Utils::WarningFlags warningFlags(const QStringList &cflags) const override;
|
||||
|
||||
IOutputParser *outputParser() const override;
|
||||
|
||||
|
@@ -26,7 +26,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "abstractprocessstep.h"
|
||||
#include "projectexplorer_global.h"
|
||||
|
||||
#include <utils/fileutils.h>
|
||||
|
||||
|
@@ -870,7 +870,7 @@ void MsvcToolChain::inferWarningsForLevel(int warningLevel, WarningFlags &flags)
|
||||
flags = flags & WarningFlags::AsErrors;
|
||||
|
||||
if (warningLevel >= 1)
|
||||
flags |= WarningFlags(WarningFlags::Default | WarningFlags::IgnoredQualfiers
|
||||
flags |= WarningFlags(WarningFlags::Default | WarningFlags::IgnoredQualifiers
|
||||
| WarningFlags::HiddenLocals | WarningFlags::UnknownPragma);
|
||||
if (warningLevel >= 2)
|
||||
flags |= WarningFlags::All;
|
||||
@@ -1112,7 +1112,7 @@ WarningFlags MsvcToolChain::warningFlags(const QStringList &cflags) const
|
||||
// http://msdn.microsoft.com/en-us/library/ay4h0tc9.aspx
|
||||
add(4263, WarningFlags::OverloadedVirtual);
|
||||
// http://msdn.microsoft.com/en-us/library/ytxde1x7.aspx
|
||||
add(4230, WarningFlags::IgnoredQualfiers);
|
||||
add(4230, WarningFlags::IgnoredQualifiers);
|
||||
// not exact match, http://msdn.microsoft.com/en-us/library/0hx5ckb0.aspx
|
||||
add(4258, WarningFlags::HiddenLocals);
|
||||
// http://msdn.microsoft.com/en-us/library/wzxffy8c.aspx
|
||||
|
@@ -78,7 +78,7 @@ public:
|
||||
MacroInspectionRunner createMacroInspectionRunner() const override;
|
||||
Macros predefinedMacros(const QStringList &cxxflags) const override;
|
||||
Utils::LanguageExtensions languageExtensions(const QStringList &cxxflags) const override;
|
||||
WarningFlags warningFlags(const QStringList &cflags) const override;
|
||||
Utils::WarningFlags warningFlags(const QStringList &cflags) const override;
|
||||
BuiltInHeaderPathsRunner createBuiltInHeaderPathsRunner(
|
||||
const Utils::Environment &env) const override;
|
||||
HeaderPaths builtInHeaderPaths(const QStringList &cxxflags,
|
||||
@@ -108,18 +108,18 @@ protected:
|
||||
class WarningFlagAdder
|
||||
{
|
||||
int m_warningCode = 0;
|
||||
WarningFlags &m_flags;
|
||||
Utils::WarningFlags &m_flags;
|
||||
bool m_doesEnable = false;
|
||||
bool m_triggered = false;
|
||||
|
||||
public:
|
||||
WarningFlagAdder(const QString &flag, WarningFlags &flags);
|
||||
void operator()(int warningCode, WarningFlags flagsSet);
|
||||
WarningFlagAdder(const QString &flag, Utils::WarningFlags &flags);
|
||||
void operator()(int warningCode, Utils::WarningFlags flagsSet);
|
||||
|
||||
bool triggered() const;
|
||||
};
|
||||
|
||||
static void inferWarningsForLevel(int warningLevel, WarningFlags &flags);
|
||||
static void inferWarningsForLevel(int warningLevel, Utils::WarningFlags &flags);
|
||||
|
||||
Utils::Environment readEnvironmentSetting(const Utils::Environment &env) const;
|
||||
// Function must be thread-safe!
|
||||
|
@@ -159,7 +159,6 @@ HEADERS += projectexplorer.h \
|
||||
expanddata.h \
|
||||
waitforstopdialog.h \
|
||||
projectexplorericons.h \
|
||||
projectexplorer_global.h \
|
||||
extracompiler.h \
|
||||
customexecutablerunconfiguration.h \
|
||||
projectmacro.h \
|
||||
|
@@ -113,7 +113,6 @@ Project {
|
||||
"projectexplorer.cpp", "projectexplorer.h",
|
||||
"projectexplorer.qrc",
|
||||
"projectexplorer_export.h",
|
||||
"projectexplorer_global.h",
|
||||
"projectexplorerconstants.h",
|
||||
"projectexplorericons.h", "projectexplorericons.cpp",
|
||||
"projectexplorersettings.h",
|
||||
|
@@ -1,86 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2016 The Qt Company Ltd.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of Qt Creator.
|
||||
**
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at https://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3 as published by the Free Software
|
||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
||||
** included in the packaging of this file. Please review the following
|
||||
** information to ensure the GNU General Public License requirements will
|
||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
namespace ProjectExplorer {
|
||||
|
||||
enum class WarningFlags {
|
||||
// General settings
|
||||
NoWarnings = 0,
|
||||
AsErrors = 1 << 0,
|
||||
Default = 1 << 1,
|
||||
All = 1 << 2,
|
||||
Extra = 1 << 3,
|
||||
Pedantic = 1 << 4,
|
||||
|
||||
// Any language
|
||||
UnusedLocals = 1 << 7,
|
||||
UnusedParams = 1 << 8,
|
||||
UnusedFunctions = 1 << 9,
|
||||
UnusedResult = 1 << 10,
|
||||
UnusedValue = 1 << 11,
|
||||
Documentation = 1 << 12,
|
||||
UninitializedVars = 1 << 13,
|
||||
HiddenLocals = 1 << 14,
|
||||
UnknownPragma = 1 << 15,
|
||||
Deprecated = 1 << 16,
|
||||
SignedComparison = 1 << 17,
|
||||
IgnoredQualfiers = 1 << 18,
|
||||
|
||||
// C++
|
||||
OverloadedVirtual = 1 << 24,
|
||||
EffectiveCxx = 1 << 25,
|
||||
NonVirtualDestructor = 1 << 26
|
||||
};
|
||||
|
||||
} // namespace ProjectExplorer
|
||||
|
||||
inline ProjectExplorer::WarningFlags operator|(ProjectExplorer::WarningFlags first,
|
||||
ProjectExplorer::WarningFlags second)
|
||||
{
|
||||
return ProjectExplorer::WarningFlags(int(first) | int(second));
|
||||
}
|
||||
|
||||
inline ProjectExplorer::WarningFlags operator&(ProjectExplorer::WarningFlags first,
|
||||
ProjectExplorer::WarningFlags second)
|
||||
{
|
||||
return ProjectExplorer::WarningFlags(int(first) & int(second));
|
||||
}
|
||||
|
||||
inline void operator|=(ProjectExplorer::WarningFlags &first, ProjectExplorer::WarningFlags second)
|
||||
{
|
||||
first = first | second;
|
||||
}
|
||||
|
||||
inline void operator&=(ProjectExplorer::WarningFlags &first, ProjectExplorer::WarningFlags second)
|
||||
{
|
||||
first = first & second;
|
||||
}
|
||||
|
||||
inline ProjectExplorer::WarningFlags operator~(ProjectExplorer::WarningFlags flags)
|
||||
{
|
||||
return ProjectExplorer::WarningFlags(~int(flags));
|
||||
}
|
@@ -28,7 +28,6 @@
|
||||
#include "buildtargettype.h"
|
||||
#include "headerpath.h"
|
||||
#include "projectexplorer_export.h"
|
||||
#include "projectexplorer_global.h"
|
||||
#include "projectmacro.h"
|
||||
|
||||
// this include style is forced for the cpp unit test mocks
|
||||
@@ -56,7 +55,7 @@ public:
|
||||
public:
|
||||
QStringList commandLineFlags;
|
||||
// The following are deduced from commandLineFlags.
|
||||
WarningFlags warningFlags = WarningFlags::Default;
|
||||
Utils::WarningFlags warningFlags = Utils::WarningFlags::Default;
|
||||
Utils::LanguageExtensions languageExtensions = Utils::LanguageExtension::None;
|
||||
};
|
||||
|
||||
|
@@ -26,7 +26,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "projectexplorer_export.h"
|
||||
#include "projectexplorer_global.h"
|
||||
|
||||
#include "abi.h"
|
||||
#include "headerpath.h"
|
||||
@@ -120,7 +119,7 @@ public:
|
||||
virtual bool isValid() const = 0;
|
||||
|
||||
virtual Utils::LanguageExtensions languageExtensions(const QStringList &cxxflags) const = 0;
|
||||
virtual WarningFlags warningFlags(const QStringList &cflags) const = 0;
|
||||
virtual Utils::WarningFlags warningFlags(const QStringList &cflags) const = 0;
|
||||
virtual QString sysRoot() const;
|
||||
|
||||
class MacroInspectionReport
|
||||
|
Reference in New Issue
Block a user