diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp index 024fddb46..501ff6e07 100644 --- a/gui/mainwindow.cpp +++ b/gui/mainwindow.cpp @@ -891,10 +891,10 @@ Settings MainWindow::getCppcheckSettings() result.maxCtuDepth = mProjectFile->getMaxCtuDepth(); result.checkHeaders = mProjectFile->getCheckHeaders(); result.checkUnusedTemplates = mProjectFile->getCheckUnusedTemplates(); - result.safeChecks.classes = mProjectFile->getSafeChecks().classes; - result.safeChecks.externalFunctions = mProjectFile->getSafeChecks().externalFunctions; - result.safeChecks.internalFunctions = mProjectFile->getSafeChecks().internalFunctions; - result.safeChecks.externalVariables = mProjectFile->getSafeChecks().externalVariables; + result.safeChecks.classes = mProjectFile->safeChecks.classes; + result.safeChecks.externalFunctions = mProjectFile->safeChecks.externalFunctions; + result.safeChecks.internalFunctions = mProjectFile->safeChecks.internalFunctions; + result.safeChecks.externalVariables = mProjectFile->safeChecks.externalVariables; foreach (QString s, mProjectFile->getCheckUnknownFunctionReturn()) result.checkUnknownFunctionReturn.insert(s.toStdString()); } diff --git a/gui/projectfile.cpp b/gui/projectfile.cpp index f5bce9ebf..d4c2f9bc7 100644 --- a/gui/projectfile.cpp +++ b/gui/projectfile.cpp @@ -66,7 +66,7 @@ void ProjectFile::clear() mCheckUnusedTemplates = false; mMaxCtuDepth = 10; mCheckUnknownFunctionReturn.clear(); - mSafeChecks.clear(); + safeChecks.clear(); mVsConfigurations.clear(); } @@ -163,7 +163,7 @@ bool ProjectFile::read(const QString &filename) // check all function parameter values if (xmlReader.name() == Settings::SafeChecks::XmlRootName) - mSafeChecks.loadFromXml(xmlReader); + safeChecks.loadFromXml(xmlReader); // Addons if (xmlReader.name() == CppcheckXml::AddonsElementName) @@ -819,7 +819,7 @@ bool ProjectFile::write(const QString &filename) CppcheckXml::CheckUnknownFunctionReturn, CppcheckXml::Name); - mSafeChecks.saveToXml(xmlWriter); + safeChecks.saveToXml(xmlWriter); writeStringList(xmlWriter, mAddons, diff --git a/gui/projectfile.h b/gui/projectfile.h index b0a5c4705..84e475147 100644 --- a/gui/projectfile.h +++ b/gui/projectfile.h @@ -26,6 +26,8 @@ #include "suppressions.h" +#include + /// @addtogroup GUI /// @{ @@ -308,52 +310,15 @@ public: } /** Do not only check how interface is used. Also check that interface is safe. */ - class SafeChecks { + class SafeChecks : public Settings::SafeChecks { public: - SafeChecks() : classes(false), externalFunctions(false), internalFunctions(false), externalVariables(false) {} - - void clear() { - classes = externalFunctions = internalFunctions = externalVariables = false; - } + SafeChecks() : Settings::SafeChecks() {} void loadFromXml(QXmlStreamReader &xmlReader); void saveToXml(QXmlStreamWriter &xmlWriter) const; - - /** - * Public interface of classes - * - public function parameters can have any value - * - public functions can be called in any order - * - public variables can have any value - */ - bool classes; - - /** - * External functions - * - external functions can be called in any order - * - function parameters can have any values - */ - bool externalFunctions; - - /** - * Experimental: assume that internal functions can be used in any way - * This is only available in the GUI. - */ - bool internalFunctions; - - /** - * Global variables that can be modified outside the TU. - * - Such variable can have "any" value - */ - bool externalVariables; }; - /** Safe checks */ - SafeChecks getSafeChecks() const { - return mSafeChecks; - } - void setSafeChecks(SafeChecks safeChecks) { - mSafeChecks = safeChecks; - } + SafeChecks safeChecks; /** Check unknown function return values */ QStringList getCheckUnknownFunctionReturn() const { @@ -550,8 +515,6 @@ private: /** Max CTU depth */ int mMaxCtuDepth; - SafeChecks mSafeChecks; - QStringList mCheckUnknownFunctionReturn; }; diff --git a/gui/projectfiledialog.ui b/gui/projectfiledialog.ui index d2b0b7163..bedac9622 100644 --- a/gui/projectfiledialog.ui +++ b/gui/projectfiledialog.ui @@ -6,8 +6,8 @@ 0 0 - 888 - 600 + 800 + 617 @@ -17,7 +17,7 @@ - 0 + 2 @@ -131,6 +131,12 @@ + + + 16777215 + 100 + + QAbstractItemView::MultiSelection @@ -168,7 +174,14 @@ - + + + + 16777215 + 140 + + + @@ -354,11 +367,52 @@ - + - Checking + Types and Functions + + + + Platform + + + + + + + + + + + + Libraries + + + + + + + + + Note: Put your own custom .cfg files in the same folder as the project file. You should see them above. + + + true + + + + + + + + + + + Analysis + + @@ -407,28 +461,38 @@ - Platform + Check that code is safe - + - + + + Bug hunting -- Detect all bugs. Generates mostly noise. + + + + + + + Check that each class has a safe public interface + + + + + 0 + 0 + + - Analysis + Limit analysis - - - - Bug hunting - - - @@ -476,28 +540,6 @@ - - - - Libraries - - - - - - - - - Note: Put your own custom .cfg files in the same folder as the project file. You should see them above. - - - true - - - - - - @@ -506,7 +548,7 @@ 20 - 96 + 73 @@ -650,9 +692,9 @@ - + - Addons and tools + Addons diff --git a/lib/settings.h b/lib/settings.h index 4da9a2d3e..0e5aaad0f 100644 --- a/lib/settings.h +++ b/lib/settings.h @@ -170,6 +170,10 @@ public: static const char XmlInternalFunctions[]; static const char XmlExternalVariables[]; + void clear() { + classes = externalFunctions = internalFunctions = externalVariables = false; + } + /** * Public interface of classes * - public function parameters can have any value