From a22c181553ccdf3acf643dbf3da2dbc177221f42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20St=C3=B6neberg?= Date: Sun, 8 Oct 2023 09:10:17 +0200 Subject: [PATCH] fixed "Redundant elaborated type specifier" Rider warnings (#5517) --- cli/filelister.cpp | 2 +- cli/processexecutor.cpp | 2 +- gui/cppchecklibrarydata.cpp | 8 ++++---- gui/cppchecklibrarydata.h | 38 ++++++++++++++++++------------------ lib/check64bit.cpp | 4 ++-- lib/checkassert.cpp | 2 +- lib/checkclass.cpp | 2 +- lib/checkcondition.cpp | 8 ++++---- lib/checkexceptionsafety.cpp | 6 +++--- lib/checknullpointer.cpp | 4 ++-- lib/checkother.cpp | 38 ++++++++++++++++++------------------ lib/checkpostfixoperator.cpp | 2 +- lib/checksizeof.cpp | 6 +++--- lib/checkstl.cpp | 24 +++++++++++------------ lib/checkstring.cpp | 12 ++++++------ lib/checktype.cpp | 8 ++++---- lib/checkuninitvar.cpp | 2 +- lib/checkunusedfunctions.cpp | 2 +- lib/checkunusedvar.cpp | 4 ++-- lib/checkvaarg.cpp | 6 +++--- lib/cppcheck.cpp | 2 +- lib/fwdanalysis.cpp | 4 ++-- lib/fwdanalysis.h | 4 ++-- lib/importproject.cpp | 2 +- lib/library.cpp | 2 +- lib/library.h | 8 ++++---- lib/symboldatabase.h | 6 +++--- lib/timer.cpp | 2 +- lib/timer.h | 2 +- lib/token.cpp | 6 +++--- lib/tokenize.cpp | 2 +- test/testlibrary.cpp | 10 +++++----- 32 files changed, 115 insertions(+), 115 deletions(-) diff --git a/cli/filelister.cpp b/cli/filelister.cpp index df0c7a343..e25e9a6b4 100644 --- a/cli/filelister.cpp +++ b/cli/filelister.cpp @@ -188,7 +188,7 @@ static std::string addFiles2(std::map &files, std::string new_path = path; new_path += '/'; - while (const struct dirent* dir_result = readdir(dir)) { + while (const dirent* dir_result = readdir(dir)) { if ((std::strcmp(dir_result->d_name, ".") == 0) || (std::strcmp(dir_result->d_name, "..") == 0)) continue; diff --git a/cli/processexecutor.cpp b/cli/processexecutor.cpp index 29affc2ab..2e9409286 100644 --- a/cli/processexecutor.cpp +++ b/cli/processexecutor.cpp @@ -307,7 +307,7 @@ unsigned int ProcessExecutor::check() FD_ZERO(&rfds); for (std::list::const_iterator rp = rpipes.cbegin(); rp != rpipes.cend(); ++rp) FD_SET(*rp, &rfds); - struct timeval tv; // for every second polling of load average condition + timeval tv; // for every second polling of load average condition tv.tv_sec = 1; tv.tv_usec = 0; const int r = select(*std::max_element(rpipes.cbegin(), rpipes.cend()) + 1, &rfds, nullptr, nullptr, &tv); diff --git a/gui/cppchecklibrarydata.cpp b/gui/cppchecklibrarydata.cpp index 23291e5da..5911d6fc4 100644 --- a/gui/cppchecklibrarydata.cpp +++ b/gui/cppchecklibrarydata.cpp @@ -82,7 +82,7 @@ static CppcheckLibraryData::Container loadContainer(QXmlStreamReader &xmlReader) break; if (type != QXmlStreamReader::StartElement) continue; - struct CppcheckLibraryData::Container::Function function; + CppcheckLibraryData::Container::Function function; function.name = xmlReader.attributes().value("name").toString(); function.action = xmlReader.attributes().value("action").toString(); function.yields = xmlReader.attributes().value("yields").toString(); @@ -91,7 +91,7 @@ static CppcheckLibraryData::Container loadContainer(QXmlStreamReader &xmlReader) else if (elementName == "access") container.accessFunctions.append(function); else if (elementName == "rangeItemRecordType") { - struct CppcheckLibraryData::Container::RangeItemRecordType rangeItemRecordType; + CppcheckLibraryData::Container::RangeItemRecordType rangeItemRecordType; rangeItemRecordType.name = xmlReader.attributes().value("name").toString(); rangeItemRecordType.templateParameter = xmlReader.attributes().value("templateParameter").toString(); container.rangeItemRecordTypeList.append(rangeItemRecordType); @@ -518,7 +518,7 @@ QString CppcheckLibraryData::open(QIODevice &file) return QString(); } -static void writeContainerFunctions(QXmlStreamWriter &xmlWriter, const QString &name, int extra, const QList &functions) +static void writeContainerFunctions(QXmlStreamWriter &xmlWriter, const QString &name, int extra, const QList &functions) { if (functions.isEmpty() && extra < 0) return; @@ -541,7 +541,7 @@ static void writeContainerFunctions(QXmlStreamWriter &xmlWriter, const QString & xmlWriter.writeEndElement(); } -static void writeContainerRangeItemRecords(QXmlStreamWriter &xmlWriter, const QList &rangeItemRecords) +static void writeContainerRangeItemRecords(QXmlStreamWriter &xmlWriter, const QList &rangeItemRecords) { if (rangeItemRecords.isEmpty()) return; diff --git a/gui/cppchecklibrarydata.h b/gui/cppchecklibrarydata.h index 07fc2a811..2ccf9d93b 100644 --- a/gui/cppchecklibrarydata.h +++ b/gui/cppchecklibrarydata.h @@ -58,10 +58,10 @@ public: QString yields; QString action; }; - QList accessFunctions; - QList otherFunctions; - QList sizeFunctions; - QList rangeItemRecordTypeList; + QList accessFunctions; + QList otherFunctions; + QList sizeFunctions; + QList rangeItemRecordTypeList; }; struct Define { @@ -106,13 +106,13 @@ public: QString arg; QString arg2; }; - QList minsizes; + QList minsizes; struct Iterator { int container = -1; QString type; } iterator; }; - QList args; + QList args; struct { QString severity; @@ -149,8 +149,8 @@ public: QString name; }; - QList alloc; - QList dealloc; + QList alloc; + QList dealloc; QStringList use; }; @@ -176,7 +176,7 @@ public: QString name; }; - QList calls; + QList calls; }; struct Markup { @@ -244,18 +244,18 @@ public: QString open(QIODevice &file); QString toString() const; - QList containers; - QList defines; - QList functions; - QList memoryresource; - QList podtypes; + QList containers; + QList defines; + QList functions; + QList memoryresource; + QList podtypes; QList typeChecks; - QList platformTypes; + QList platformTypes; QStringList undefines; - QList smartPointers; - QList reflections; - QList markups; - QList entrypoints; + QList smartPointers; + QList reflections; + QList markups; + QList entrypoints; }; #endif // CPPCHECKLIBRARYDATA_H diff --git a/lib/check64bit.cpp b/lib/check64bit.cpp index dc9ba26ec..c87bb2048 100644 --- a/lib/check64bit.cpp +++ b/lib/check64bit.cpp @@ -33,8 +33,8 @@ //--------------------------------------------------------------------------- // CWE ids used -static const struct CWE CWE398(398U); // Indicator of Poor Code Quality -static const struct CWE CWE758(758U); // Reliance on Undefined, Unspecified, or Implementation-Defined Behavior +static const CWE CWE398(398U); // Indicator of Poor Code Quality +static const CWE CWE758(758U); // Reliance on Undefined, Unspecified, or Implementation-Defined Behavior // Register this check class (by creating a static instance of it) namespace { diff --git a/lib/checkassert.cpp b/lib/checkassert.cpp index c6eae27c4..a96191288 100644 --- a/lib/checkassert.cpp +++ b/lib/checkassert.cpp @@ -32,7 +32,7 @@ //--------------------------------------------------------------------------- // CWE ids used -static const struct CWE CWE398(398U); // Indicator of Poor Code Quality +static const CWE CWE398(398U); // Indicator of Poor Code Quality // Register this check class (by creating a static instance of it) namespace { diff --git a/lib/checkclass.cpp b/lib/checkclass.cpp index 49613c069..d3a84229a 100644 --- a/lib/checkclass.cpp +++ b/lib/checkclass.cpp @@ -2154,7 +2154,7 @@ void CheckClass::checkConst() if (!scope->definedType->derivedFrom.empty() && func.isImplicitlyVirtual(true)) continue; - enum MemberAccess memberAccessed = MemberAccess::NONE; + MemberAccess memberAccessed = MemberAccess::NONE; // if nothing non-const was found. write error.. if (!checkConstFunc(scope, &func, memberAccessed)) continue; diff --git a/lib/checkcondition.cpp b/lib/checkcondition.cpp index a8d7eef9a..9fa5f797b 100644 --- a/lib/checkcondition.cpp +++ b/lib/checkcondition.cpp @@ -43,10 +43,10 @@ #include // CWE ids used -static const struct CWE uncheckedErrorConditionCWE(391U); -static const struct CWE CWE398(398U); // Indicator of Poor Code Quality -static const struct CWE CWE570(570U); // Expression is Always False -static const struct CWE CWE571(571U); // Expression is Always True +static const CWE uncheckedErrorConditionCWE(391U); +static const CWE CWE398(398U); // Indicator of Poor Code Quality +static const CWE CWE570(570U); // Expression is Always False +static const CWE CWE571(571U); // Expression is Always True //--------------------------------------------------------------------------- diff --git a/lib/checkexceptionsafety.cpp b/lib/checkexceptionsafety.cpp index a77eddc16..2c404e831 100644 --- a/lib/checkexceptionsafety.cpp +++ b/lib/checkexceptionsafety.cpp @@ -37,9 +37,9 @@ namespace { CheckExceptionSafety instance; } -static const struct CWE CWE398(398U); // Indicator of Poor Code Quality -static const struct CWE CWE703(703U); // Improper Check or Handling of Exceptional Conditions -static const struct CWE CWE480(480U); // Use of Incorrect Operator +static const CWE CWE398(398U); // Indicator of Poor Code Quality +static const CWE CWE703(703U); // Improper Check or Handling of Exceptional Conditions +static const CWE CWE480(480U); // Use of Incorrect Operator //--------------------------------------------------------------------------- diff --git a/lib/checknullpointer.cpp b/lib/checknullpointer.cpp index 4110426f1..2c6aae00c 100644 --- a/lib/checknullpointer.cpp +++ b/lib/checknullpointer.cpp @@ -40,8 +40,8 @@ //--------------------------------------------------------------------------- // CWE ids used: -static const struct CWE CWE_NULL_POINTER_DEREFERENCE(476U); -static const struct CWE CWE_INCORRECT_CALCULATION(682U); +static const CWE CWE_NULL_POINTER_DEREFERENCE(476U); +static const CWE CWE_INCORRECT_CALCULATION(682U); // Register this check class (by creating a static instance of it) namespace { diff --git a/lib/checkother.cpp b/lib/checkother.cpp index 778b4c1c2..416885a5e 100644 --- a/lib/checkother.cpp +++ b/lib/checkother.cpp @@ -50,24 +50,24 @@ namespace { CheckOther instance; } -static const struct CWE CWE128(128U); // Wrap-around Error -static const struct CWE CWE131(131U); // Incorrect Calculation of Buffer Size -static const struct CWE CWE197(197U); // Numeric Truncation Error -static const struct CWE CWE362(362U); // Concurrent Execution using Shared Resource with Improper Synchronization ('Race Condition') -static const struct CWE CWE369(369U); // Divide By Zero -static const struct CWE CWE398(398U); // Indicator of Poor Code Quality -static const struct CWE CWE475(475U); // Undefined Behavior for Input to API -static const struct CWE CWE561(561U); // Dead Code -static const struct CWE CWE563(563U); // Assignment to Variable without Use ('Unused Variable') -static const struct CWE CWE570(570U); // Expression is Always False -static const struct CWE CWE571(571U); // Expression is Always True -static const struct CWE CWE672(672U); // Operation on a Resource after Expiration or Release -static const struct CWE CWE628(628U); // Function Call with Incorrectly Specified Arguments -static const struct CWE CWE683(683U); // Function Call With Incorrect Order of Arguments -static const struct CWE CWE704(704U); // Incorrect Type Conversion or Cast -static const struct CWE CWE758(758U); // Reliance on Undefined, Unspecified, or Implementation-Defined Behavior -static const struct CWE CWE768(768U); // Incorrect Short Circuit Evaluation -static const struct CWE CWE783(783U); // Operator Precedence Logic Error +static const CWE CWE128(128U); // Wrap-around Error +static const CWE CWE131(131U); // Incorrect Calculation of Buffer Size +static const CWE CWE197(197U); // Numeric Truncation Error +static const CWE CWE362(362U); // Concurrent Execution using Shared Resource with Improper Synchronization ('Race Condition') +static const CWE CWE369(369U); // Divide By Zero +static const CWE CWE398(398U); // Indicator of Poor Code Quality +static const CWE CWE475(475U); // Undefined Behavior for Input to API +static const CWE CWE561(561U); // Dead Code +static const CWE CWE563(563U); // Assignment to Variable without Use ('Unused Variable') +static const CWE CWE570(570U); // Expression is Always False +static const CWE CWE571(571U); // Expression is Always True +static const CWE CWE672(672U); // Operation on a Resource after Expiration or Release +static const CWE CWE628(628U); // Function Call with Incorrectly Specified Arguments +static const CWE CWE683(683U); // Function Call With Incorrect Order of Arguments +static const CWE CWE704(704U); // Incorrect Type Conversion or Cast +static const CWE CWE758(758U); // Reliance on Undefined, Unspecified, or Implementation-Defined Behavior +static const CWE CWE768(768U); // Incorrect Short Circuit Evaluation +static const CWE CWE783(783U); // Operator Precedence Logic Error //---------------------------------------------------------------------------------- // The return value of fgetc(), getc(), ungetc(), getchar() etc. is an integer value. @@ -2793,7 +2793,7 @@ void CheckOther::checkComparisonFunctionIsAlwaysTrueOrFalse() void CheckOther::checkComparisonFunctionIsAlwaysTrueOrFalseError(const Token* tok, const std::string &functionName, const std::string &varName, const bool result) { const std::string strResult = bool_to_string(result); - const struct CWE cweResult = result ? CWE571 : CWE570; + const CWE cweResult = result ? CWE571 : CWE570; reportError(tok, Severity::warning, "comparisonFunctionIsAlwaysTrueOrFalse", "$symbol:" + functionName + "\n" diff --git a/lib/checkpostfixoperator.cpp b/lib/checkpostfixoperator.cpp index 91250e8b7..eb8d57a39 100644 --- a/lib/checkpostfixoperator.cpp +++ b/lib/checkpostfixoperator.cpp @@ -40,7 +40,7 @@ namespace { // CWE ids used -static const struct CWE CWE398(398U); // Indicator of Poor Code Quality +static const CWE CWE398(398U); // Indicator of Poor Code Quality void CheckPostfixOperator::postfixOperator() diff --git a/lib/checksizeof.cpp b/lib/checksizeof.cpp index c49527d1f..059ca614f 100644 --- a/lib/checksizeof.cpp +++ b/lib/checksizeof.cpp @@ -40,9 +40,9 @@ namespace { } // CWE IDs used: -static const struct CWE CWE398(398U); // Indicator of Poor Code Quality -static const struct CWE CWE467(467U); // Use of sizeof() on a Pointer Type -static const struct CWE CWE682(682U); // Incorrect Calculation +static const CWE CWE398(398U); // Indicator of Poor Code Quality +static const CWE CWE467(467U); // Use of sizeof() on a Pointer Type +static const CWE CWE682(682U); // Incorrect Calculation //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- void CheckSizeof::checkSizeofForNumericParameter() diff --git a/lib/checkstl.cpp b/lib/checkstl.cpp index dd611356d..489899868 100644 --- a/lib/checkstl.cpp +++ b/lib/checkstl.cpp @@ -52,18 +52,18 @@ namespace { } // CWE IDs used: -static const struct CWE CWE398(398U); // Indicator of Poor Code Quality -static const struct CWE CWE597(597U); // Use of Wrong Operator in String Comparison -static const struct CWE CWE628(628U); // Function Call with Incorrectly Specified Arguments -static const struct CWE CWE664(664U); // Improper Control of a Resource Through its Lifetime -static const struct CWE CWE667(667U); // Improper Locking -static const struct CWE CWE704(704U); // Incorrect Type Conversion or Cast -static const struct CWE CWE762(762U); // Mismatched Memory Management Routines -static const struct CWE CWE786(786U); // Access of Memory Location Before Start of Buffer -static const struct CWE CWE788(788U); // Access of Memory Location After End of Buffer -static const struct CWE CWE825(825U); // Expired Pointer Dereference -static const struct CWE CWE833(833U); // Deadlock -static const struct CWE CWE834(834U); // Excessive Iteration +static const CWE CWE398(398U); // Indicator of Poor Code Quality +static const CWE CWE597(597U); // Use of Wrong Operator in String Comparison +static const CWE CWE628(628U); // Function Call with Incorrectly Specified Arguments +static const CWE CWE664(664U); // Improper Control of a Resource Through its Lifetime +static const CWE CWE667(667U); // Improper Locking +static const CWE CWE704(704U); // Incorrect Type Conversion or Cast +static const CWE CWE762(762U); // Mismatched Memory Management Routines +static const CWE CWE786(786U); // Access of Memory Location Before Start of Buffer +static const CWE CWE788(788U); // Access of Memory Location After End of Buffer +static const CWE CWE825(825U); // Expired Pointer Dereference +static const CWE CWE833(833U); // Deadlock +static const CWE CWE834(834U); // Excessive Iteration static bool isElementAccessYield(Library::Container::Yield yield) { diff --git a/lib/checkstring.cpp b/lib/checkstring.cpp index 0010d54a7..6c0110b66 100644 --- a/lib/checkstring.cpp +++ b/lib/checkstring.cpp @@ -42,12 +42,12 @@ namespace { } // CWE ids used: -static const struct CWE CWE570(570U); // Expression is Always False -static const struct CWE CWE571(571U); // Expression is Always True -static const struct CWE CWE595(595U); // Comparison of Object References Instead of Object Contents -static const struct CWE CWE628(628U); // Function Call with Incorrectly Specified Arguments -static const struct CWE CWE665(665U); // Improper Initialization -static const struct CWE CWE758(758U); // Reliance on Undefined, Unspecified, or Implementation-Defined Behavior +static const CWE CWE570(570U); // Expression is Always False +static const CWE CWE571(571U); // Expression is Always True +static const CWE CWE595(595U); // Comparison of Object References Instead of Object Contents +static const CWE CWE628(628U); // Function Call with Incorrectly Specified Arguments +static const CWE CWE665(665U); // Improper Initialization +static const CWE CWE758(758U); // Reliance on Undefined, Unspecified, or Implementation-Defined Behavior //--------------------------------------------------------------------------- // Writing string literal is UB diff --git a/lib/checktype.cpp b/lib/checktype.cpp index c0ddd639c..d321cb69c 100644 --- a/lib/checktype.cpp +++ b/lib/checktype.cpp @@ -48,10 +48,10 @@ namespace { // // CWE ids used: -static const struct CWE CWE195(195U); // Signed to Unsigned Conversion Error -static const struct CWE CWE197(197U); // Numeric Truncation Error -static const struct CWE CWE758(758U); // Reliance on Undefined, Unspecified, or Implementation-Defined Behavior -static const struct CWE CWE190(190U); // Integer Overflow or Wraparound +static const CWE CWE195(195U); // Signed to Unsigned Conversion Error +static const CWE CWE197(197U); // Numeric Truncation Error +static const CWE CWE758(758U); // Reliance on Undefined, Unspecified, or Implementation-Defined Behavior +static const CWE CWE190(190U); // Integer Overflow or Wraparound void CheckType::checkTooBigBitwiseShift() diff --git a/lib/checkuninitvar.cpp b/lib/checkuninitvar.cpp index 945c0cbc0..b1684a1d7 100644 --- a/lib/checkuninitvar.cpp +++ b/lib/checkuninitvar.cpp @@ -49,7 +49,7 @@ namespace tinyxml2 { //--------------------------------------------------------------------------- // CWE ids used: -static const struct CWE CWE_USE_OF_UNINITIALIZED_VARIABLE(457U); +static const CWE CWE_USE_OF_UNINITIALIZED_VARIABLE(457U); // Register this check class (by creating a static instance of it) namespace { diff --git a/lib/checkunusedfunctions.cpp b/lib/checkunusedfunctions.cpp index 530ebbc84..f1f8abae0 100644 --- a/lib/checkunusedfunctions.cpp +++ b/lib/checkunusedfunctions.cpp @@ -54,7 +54,7 @@ namespace { CheckUnusedFunctions instance; } -static const struct CWE CWE561(561U); // Dead Code +static const CWE CWE561(561U); // Dead Code static std::string stripTemplateParameters(const std::string& funcName) { std::string name = funcName; diff --git a/lib/checkunusedvar.cpp b/lib/checkunusedvar.cpp index a8ab5b0f5..8b33b49b5 100644 --- a/lib/checkunusedvar.cpp +++ b/lib/checkunusedvar.cpp @@ -45,8 +45,8 @@ namespace { CheckUnusedVar instance; } -static const struct CWE CWE563(563U); // Assignment to Variable without Use ('Unused Variable') -static const struct CWE CWE665(665U); // Improper Initialization +static const CWE CWE563(563U); // Assignment to Variable without Use ('Unused Variable') +static const CWE CWE665(665U); // Improper Initialization /** Is scope a raii class scope */ static bool isRaiiClassScope(const Scope *classScope) diff --git a/lib/checkvaarg.cpp b/lib/checkvaarg.cpp index 247f8b926..446c8731e 100644 --- a/lib/checkvaarg.cpp +++ b/lib/checkvaarg.cpp @@ -41,9 +41,9 @@ namespace { //--------------------------------------------------------------------------- // CWE ids used: -static const struct CWE CWE664(664U); // Improper Control of a Resource Through its Lifetime -static const struct CWE CWE688(688U); // Function Call With Incorrect Variable or Reference as Argument -static const struct CWE CWE758(758U); // Reliance on Undefined, Unspecified, or Implementation-Defined Behavior +static const CWE CWE664(664U); // Improper Control of a Resource Through its Lifetime +static const CWE CWE688(688U); // Function Call With Incorrect Variable or Reference as Argument +static const CWE CWE758(758U); // Reliance on Undefined, Unspecified, or Implementation-Defined Behavior void CheckVaarg::va_start_argument() { diff --git a/lib/cppcheck.cpp b/lib/cppcheck.cpp index 70d90763d..e5e35385e 100644 --- a/lib/cppcheck.cpp +++ b/lib/cppcheck.cpp @@ -1503,7 +1503,7 @@ void CppCheck::executeAddons(const std::vector& files) } for (const std::string &addon : mSettings.addons) { - struct AddonInfo addonInfo; + AddonInfo addonInfo; const std::string &failedToGetAddonInfo = addonInfo.getAddonInfo(addon, mSettings.exename); if (!failedToGetAddonInfo.empty()) { reportOut(failedToGetAddonInfo, Color::FgRed); diff --git a/lib/fwdanalysis.cpp b/lib/fwdanalysis.cpp index f3598412f..f2431fce3 100644 --- a/lib/fwdanalysis.cpp +++ b/lib/fwdanalysis.cpp @@ -93,7 +93,7 @@ static bool hasVolatileCastOrVar(const Token *expr) return ret; } -struct FwdAnalysis::Result FwdAnalysis::checkRecursive(const Token *expr, const Token *startToken, const Token *endToken, const std::set &exprVarIds, bool local, bool inInnerClass, int depth) +FwdAnalysis::Result FwdAnalysis::checkRecursive(const Token *expr, const Token *startToken, const Token *endToken, const std::set &exprVarIds, bool local, bool inInnerClass, int depth) { // Parse the given tokens if (++depth > 1000) @@ -182,7 +182,7 @@ struct FwdAnalysis::Result FwdAnalysis::checkRecursive(const Token *expr, const } // check loop body again.. - const struct FwdAnalysis::Result &result = checkRecursive(expr, tok->link(), tok, exprVarIds, local, inInnerClass, depth); + const FwdAnalysis::Result &result = checkRecursive(expr, tok->link(), tok, exprVarIds, local, inInnerClass, depth); if (result.type == Result::Type::BAILOUT || result.type == Result::Type::READ) return result; } diff --git a/lib/fwdanalysis.h b/lib/fwdanalysis.h index 0e83c2251..bc87ff2a5 100644 --- a/lib/fwdanalysis.h +++ b/lib/fwdanalysis.h @@ -79,8 +79,8 @@ private: const Token* token{}; }; - struct Result check(const Token *expr, const Token *startToken, const Token *endToken); - struct Result checkRecursive(const Token *expr, const Token *startToken, const Token *endToken, const std::set &exprVarIds, bool local, bool inInnerClass, int depth=0); + Result check(const Token *expr, const Token *startToken, const Token *endToken); + Result checkRecursive(const Token *expr, const Token *startToken, const Token *endToken, const std::set &exprVarIds, bool local, bool inInnerClass, int depth=0); // Is expression a l-value global data? bool isGlobalData(const Token *expr) const; diff --git a/lib/importproject.cpp b/lib/importproject.cpp index aeb66089d..e212f9dbf 100644 --- a/lib/importproject.cpp +++ b/lib/importproject.cpp @@ -397,7 +397,7 @@ bool ImportProject::importCompileCommands(std::istream &istr) if (!Path::acceptFile(file)) continue; - struct FileSettings fs; + FileSettings fs; if (Path::isAbsolute(file)) fs.filename = Path::simplifyPath(file); #ifdef _WIN32 diff --git a/lib/library.cpp b/lib/library.cpp index 201bd1e38..d87866603 100644 --- a/lib/library.cpp +++ b/lib/library.cpp @@ -511,7 +511,7 @@ Library::Error Library::load(const tinyxml2::XMLDocument &doc) for (const tinyxml2::XMLElement* memberNode = node->FirstChildElement(); memberNode; memberNode = memberNode->NextSiblingElement()) { const char *memberName = memberNode->Attribute("name"); const char *memberTemplateParameter = memberNode->Attribute("templateParameter"); - struct Container::RangeItemRecordTypeItem member; + Container::RangeItemRecordTypeItem member; member.name = memberName ? memberName : ""; member.templateParameter = memberTemplateParameter ? strToInt(memberTemplateParameter) : -1; container.rangeItemRecordType.emplace_back(std::move(member)); diff --git a/lib/library.h b/lib/library.h index 6474699ea..11be46e8c 100644 --- a/lib/library.h +++ b/lib/library.h @@ -439,8 +439,8 @@ public: char sign; enum class Type { NO, BOOL, CHAR, SHORT, INT, LONG, LONGLONG } stdtype; }; - const struct PodType *podtype(const std::string &name) const { - const std::unordered_map::const_iterator it = mPodTypes.find(name); + const PodType *podtype(const std::string &name) const { + const std::unordered_map::const_iterator it = mPodTypes.find(name); return (it != mPodTypes.end()) ? &(it->second) : nullptr; } @@ -468,7 +468,7 @@ public: struct Platform { const PlatformType *platform_type(const std::string &name) const { - const std::map::const_iterator it = mPlatformTypes.find(name); + const std::map::const_iterator it = mPlatformTypes.find(name); return (it != mPlatformTypes.end()) ? &(it->second) : nullptr; } std::map mPlatformTypes; @@ -579,7 +579,7 @@ private: std::map mExporters; // keywords that export variables/functions to libraries (meta-code/macros) std::map> mImporters; // keywords that import variables/functions std::map mReflection; // invocation of reflection - std::unordered_map mPodTypes; // pod types + std::unordered_map mPodTypes; // pod types std::map mPlatformTypes; // platform independent typedefs std::map mPlatforms; // platform dependent typedefs std::map, TypeCheck> mTypeChecks; diff --git a/lib/symboldatabase.h b/lib/symboldatabase.h index cb929a653..d9aba94eb 100644 --- a/lib/symboldatabase.h +++ b/lib/symboldatabase.h @@ -1251,18 +1251,18 @@ public: ErrorPath debugPath; ///< debug path to the type ValueType() = default; - ValueType(enum Sign s, enum Type t, nonneg int p) + ValueType(Sign s, Type t, nonneg int p) : sign(s), type(t), pointer(p) {} - ValueType(enum Sign s, enum Type t, nonneg int p, nonneg int c) + ValueType(Sign s, Type t, nonneg int p, nonneg int c) : sign(s), type(t), pointer(p), constness(c) {} - ValueType(enum Sign s, enum Type t, nonneg int p, nonneg int c, std::string otn) + ValueType(Sign s, Type t, nonneg int p, nonneg int c, std::string otn) : sign(s), type(t), pointer(p), diff --git a/lib/timer.cpp b/lib/timer.cpp index 69a56d168..78a176e9e 100644 --- a/lib/timer.cpp +++ b/lib/timer.cpp @@ -26,7 +26,7 @@ #include namespace { - using dataElementType = std::pair; + using dataElementType = std::pair; bool more_second_sec(const dataElementType& lhs, const dataElementType& rhs) { return lhs.second.seconds() > rhs.second.seconds(); diff --git a/lib/timer.h b/lib/timer.h index bc409d18c..a42f72b57 100644 --- a/lib/timer.h +++ b/lib/timer.h @@ -63,7 +63,7 @@ public: void reset(); private: - std::map mResults; + std::map mResults; mutable std::mutex mResultsSync; }; diff --git a/lib/token.cpp b/lib/token.cpp index 02f285234..a395b4b55 100644 --- a/lib/token.cpp +++ b/lib/token.cpp @@ -2558,7 +2558,7 @@ TokenImpl::~TokenImpl() delete mTemplateSimplifierPointers; while (mCppcheckAttributes) { - struct CppcheckAttributes *c = mCppcheckAttributes; + CppcheckAttributes *c = mCppcheckAttributes; mCppcheckAttributes = mCppcheckAttributes->next; delete c; } @@ -2566,7 +2566,7 @@ TokenImpl::~TokenImpl() void TokenImpl::setCppcheckAttribute(TokenImpl::CppcheckAttributes::Type type, MathLib::bigint value) { - struct CppcheckAttributes *attr = mCppcheckAttributes; + CppcheckAttributes *attr = mCppcheckAttributes; while (attr && attr->type != type) attr = attr->next; if (attr) @@ -2582,7 +2582,7 @@ void TokenImpl::setCppcheckAttribute(TokenImpl::CppcheckAttributes::Type type, M bool TokenImpl::getCppcheckAttribute(TokenImpl::CppcheckAttributes::Type type, MathLib::bigint &value) const { - struct CppcheckAttributes *attr = mCppcheckAttributes; + CppcheckAttributes *attr = mCppcheckAttributes; while (attr && attr->type != type) attr = attr->next; if (attr) diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index 6c291e7da..7e319e4de 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -10298,7 +10298,7 @@ void Tokenizer::setPodTypes() continue; // pod type - const struct Library::PodType *podType = mSettings->library.podtype(tok->str()); + const Library::PodType *podType = mSettings->library.podtype(tok->str()); if (podType) { const Token *prev = tok->previous(); while (prev && prev->isName()) diff --git a/test/testlibrary.cpp b/test/testlibrary.cpp index 16caaa4f6..f4bb1cab9 100644 --- a/test/testlibrary.cpp +++ b/test/testlibrary.cpp @@ -748,7 +748,7 @@ private: ASSERT(loadxmldata(library, xmldata, sizeof(xmldata))); // s8 { - const struct Library::PodType * const type = library.podtype("s8"); + const Library::PodType * const type = library.podtype("s8"); ASSERT_EQUALS(true, type != nullptr); if (type) { ASSERT_EQUALS(1U, type->size); @@ -757,7 +757,7 @@ private: } // u8 { - const struct Library::PodType * const type = library.podtype("u8"); + const Library::PodType * const type = library.podtype("u8"); ASSERT_EQUALS(true, type != nullptr); if (type) { ASSERT_EQUALS(1U, type->size); @@ -766,7 +766,7 @@ private: } // u16 { - const struct Library::PodType * const type = library.podtype("u16"); + const Library::PodType * const type = library.podtype("u16"); ASSERT_EQUALS(true, type != nullptr); if (type) { ASSERT_EQUALS(2U, type->size); @@ -775,7 +775,7 @@ private: } // s16 { - const struct Library::PodType * const type = library.podtype("s16"); + const Library::PodType * const type = library.podtype("s16"); ASSERT_EQUALS(true, type != nullptr); if (type) { ASSERT_EQUALS(2U, type->size); @@ -784,7 +784,7 @@ private: } // robustness test: provide cfg without PodType { - const struct Library::PodType * const type = library.podtype("nonExistingPodType"); + const Library::PodType * const type = library.podtype("nonExistingPodType"); ASSERT_EQUALS(true, type == nullptr); } }