Skip to content

Commit a22c181

Browse files
authored
fixed "Redundant elaborated type specifier" Rider warnings (#5517)
1 parent 3ba53c6 commit a22c181

32 files changed

+115
-115
lines changed

cli/filelister.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ static std::string addFiles2(std::map<std::string, std::size_t> &files,
188188
std::string new_path = path;
189189
new_path += '/';
190190

191-
while (const struct dirent* dir_result = readdir(dir)) {
191+
while (const dirent* dir_result = readdir(dir)) {
192192
if ((std::strcmp(dir_result->d_name, ".") == 0) ||
193193
(std::strcmp(dir_result->d_name, "..") == 0))
194194
continue;

cli/processexecutor.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ unsigned int ProcessExecutor::check()
307307
FD_ZERO(&rfds);
308308
for (std::list<int>::const_iterator rp = rpipes.cbegin(); rp != rpipes.cend(); ++rp)
309309
FD_SET(*rp, &rfds);
310-
struct timeval tv; // for every second polling of load average condition
310+
timeval tv; // for every second polling of load average condition
311311
tv.tv_sec = 1;
312312
tv.tv_usec = 0;
313313
const int r = select(*std::max_element(rpipes.cbegin(), rpipes.cend()) + 1, &rfds, nullptr, nullptr, &tv);

gui/cppchecklibrarydata.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ static CppcheckLibraryData::Container loadContainer(QXmlStreamReader &xmlReader)
8282
break;
8383
if (type != QXmlStreamReader::StartElement)
8484
continue;
85-
struct CppcheckLibraryData::Container::Function function;
85+
CppcheckLibraryData::Container::Function function;
8686
function.name = xmlReader.attributes().value("name").toString();
8787
function.action = xmlReader.attributes().value("action").toString();
8888
function.yields = xmlReader.attributes().value("yields").toString();
@@ -91,7 +91,7 @@ static CppcheckLibraryData::Container loadContainer(QXmlStreamReader &xmlReader)
9191
else if (elementName == "access")
9292
container.accessFunctions.append(function);
9393
else if (elementName == "rangeItemRecordType") {
94-
struct CppcheckLibraryData::Container::RangeItemRecordType rangeItemRecordType;
94+
CppcheckLibraryData::Container::RangeItemRecordType rangeItemRecordType;
9595
rangeItemRecordType.name = xmlReader.attributes().value("name").toString();
9696
rangeItemRecordType.templateParameter = xmlReader.attributes().value("templateParameter").toString();
9797
container.rangeItemRecordTypeList.append(rangeItemRecordType);
@@ -518,7 +518,7 @@ QString CppcheckLibraryData::open(QIODevice &file)
518518
return QString();
519519
}
520520

521-
static void writeContainerFunctions(QXmlStreamWriter &xmlWriter, const QString &name, int extra, const QList<struct CppcheckLibraryData::Container::Function> &functions)
521+
static void writeContainerFunctions(QXmlStreamWriter &xmlWriter, const QString &name, int extra, const QList<CppcheckLibraryData::Container::Function> &functions)
522522
{
523523
if (functions.isEmpty() && extra < 0)
524524
return;
@@ -541,7 +541,7 @@ static void writeContainerFunctions(QXmlStreamWriter &xmlWriter, const QString &
541541
xmlWriter.writeEndElement();
542542
}
543543

544-
static void writeContainerRangeItemRecords(QXmlStreamWriter &xmlWriter, const QList<struct CppcheckLibraryData::Container::RangeItemRecordType> &rangeItemRecords)
544+
static void writeContainerRangeItemRecords(QXmlStreamWriter &xmlWriter, const QList<CppcheckLibraryData::Container::RangeItemRecordType> &rangeItemRecords)
545545
{
546546
if (rangeItemRecords.isEmpty())
547547
return;

gui/cppchecklibrarydata.h

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,10 @@ class CppcheckLibraryData {
5858
QString yields;
5959
QString action;
6060
};
61-
QList<struct Function> accessFunctions;
62-
QList<struct Function> otherFunctions;
63-
QList<struct Function> sizeFunctions;
64-
QList<struct RangeItemRecordType> rangeItemRecordTypeList;
61+
QList<Function> accessFunctions;
62+
QList<Function> otherFunctions;
63+
QList<Function> sizeFunctions;
64+
QList<RangeItemRecordType> rangeItemRecordTypeList;
6565
};
6666

6767
struct Define {
@@ -106,13 +106,13 @@ class CppcheckLibraryData {
106106
QString arg;
107107
QString arg2;
108108
};
109-
QList<struct MinSize> minsizes;
109+
QList<MinSize> minsizes;
110110
struct Iterator {
111111
int container = -1;
112112
QString type;
113113
} iterator;
114114
};
115-
QList<struct Arg> args;
115+
QList<Arg> args;
116116

117117
struct {
118118
QString severity;
@@ -149,8 +149,8 @@ class CppcheckLibraryData {
149149
QString name;
150150
};
151151

152-
QList<struct Alloc> alloc;
153-
QList<struct Dealloc> dealloc;
152+
QList<Alloc> alloc;
153+
QList<Dealloc> dealloc;
154154
QStringList use;
155155
};
156156

@@ -176,7 +176,7 @@ class CppcheckLibraryData {
176176
QString name;
177177
};
178178

179-
QList<struct Call> calls;
179+
QList<Call> calls;
180180
};
181181

182182
struct Markup {
@@ -244,18 +244,18 @@ class CppcheckLibraryData {
244244
QString open(QIODevice &file);
245245
QString toString() const;
246246

247-
QList<struct Container> containers;
248-
QList<struct Define> defines;
249-
QList<struct Function> functions;
250-
QList<struct MemoryResource> memoryresource;
251-
QList<struct PodType> podtypes;
247+
QList<Container> containers;
248+
QList<Define> defines;
249+
QList<Function> functions;
250+
QList<MemoryResource> memoryresource;
251+
QList<PodType> podtypes;
252252
QList<TypeChecks> typeChecks;
253-
QList<struct PlatformType> platformTypes;
253+
QList<PlatformType> platformTypes;
254254
QStringList undefines;
255-
QList<struct SmartPointer> smartPointers;
256-
QList<struct Reflection> reflections;
257-
QList<struct Markup> markups;
258-
QList<struct Entrypoint> entrypoints;
255+
QList<SmartPointer> smartPointers;
256+
QList<Reflection> reflections;
257+
QList<Markup> markups;
258+
QList<Entrypoint> entrypoints;
259259
};
260260

261261
#endif // CPPCHECKLIBRARYDATA_H

lib/check64bit.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@
3333
//---------------------------------------------------------------------------
3434

3535
// CWE ids used
36-
static const struct CWE CWE398(398U); // Indicator of Poor Code Quality
37-
static const struct CWE CWE758(758U); // Reliance on Undefined, Unspecified, or Implementation-Defined Behavior
36+
static const CWE CWE398(398U); // Indicator of Poor Code Quality
37+
static const CWE CWE758(758U); // Reliance on Undefined, Unspecified, or Implementation-Defined Behavior
3838

3939
// Register this check class (by creating a static instance of it)
4040
namespace {

lib/checkassert.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
//---------------------------------------------------------------------------
3333

3434
// CWE ids used
35-
static const struct CWE CWE398(398U); // Indicator of Poor Code Quality
35+
static const CWE CWE398(398U); // Indicator of Poor Code Quality
3636

3737
// Register this check class (by creating a static instance of it)
3838
namespace {

lib/checkclass.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2154,7 +2154,7 @@ void CheckClass::checkConst()
21542154
if (!scope->definedType->derivedFrom.empty() && func.isImplicitlyVirtual(true))
21552155
continue;
21562156

2157-
enum MemberAccess memberAccessed = MemberAccess::NONE;
2157+
MemberAccess memberAccessed = MemberAccess::NONE;
21582158
// if nothing non-const was found. write error..
21592159
if (!checkConstFunc(scope, &func, memberAccessed))
21602160
continue;

lib/checkcondition.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,10 @@
4343
#include <vector>
4444

4545
// CWE ids used
46-
static const struct CWE uncheckedErrorConditionCWE(391U);
47-
static const struct CWE CWE398(398U); // Indicator of Poor Code Quality
48-
static const struct CWE CWE570(570U); // Expression is Always False
49-
static const struct CWE CWE571(571U); // Expression is Always True
46+
static const CWE uncheckedErrorConditionCWE(391U);
47+
static const CWE CWE398(398U); // Indicator of Poor Code Quality
48+
static const CWE CWE570(570U); // Expression is Always False
49+
static const CWE CWE571(571U); // Expression is Always True
5050

5151
//---------------------------------------------------------------------------
5252

lib/checkexceptionsafety.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ namespace {
3737
CheckExceptionSafety instance;
3838
}
3939

40-
static const struct CWE CWE398(398U); // Indicator of Poor Code Quality
41-
static const struct CWE CWE703(703U); // Improper Check or Handling of Exceptional Conditions
42-
static const struct CWE CWE480(480U); // Use of Incorrect Operator
40+
static const CWE CWE398(398U); // Indicator of Poor Code Quality
41+
static const CWE CWE703(703U); // Improper Check or Handling of Exceptional Conditions
42+
static const CWE CWE480(480U); // Use of Incorrect Operator
4343

4444
//---------------------------------------------------------------------------
4545

lib/checknullpointer.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@
4040
//---------------------------------------------------------------------------
4141

4242
// CWE ids used:
43-
static const struct CWE CWE_NULL_POINTER_DEREFERENCE(476U);
44-
static const struct CWE CWE_INCORRECT_CALCULATION(682U);
43+
static const CWE CWE_NULL_POINTER_DEREFERENCE(476U);
44+
static const CWE CWE_INCORRECT_CALCULATION(682U);
4545

4646
// Register this check class (by creating a static instance of it)
4747
namespace {

lib/checkother.cpp

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -50,24 +50,24 @@ namespace {
5050
CheckOther instance;
5151
}
5252

53-
static const struct CWE CWE128(128U); // Wrap-around Error
54-
static const struct CWE CWE131(131U); // Incorrect Calculation of Buffer Size
55-
static const struct CWE CWE197(197U); // Numeric Truncation Error
56-
static const struct CWE CWE362(362U); // Concurrent Execution using Shared Resource with Improper Synchronization ('Race Condition')
57-
static const struct CWE CWE369(369U); // Divide By Zero
58-
static const struct CWE CWE398(398U); // Indicator of Poor Code Quality
59-
static const struct CWE CWE475(475U); // Undefined Behavior for Input to API
60-
static const struct CWE CWE561(561U); // Dead Code
61-
static const struct CWE CWE563(563U); // Assignment to Variable without Use ('Unused Variable')
62-
static const struct CWE CWE570(570U); // Expression is Always False
63-
static const struct CWE CWE571(571U); // Expression is Always True
64-
static const struct CWE CWE672(672U); // Operation on a Resource after Expiration or Release
65-
static const struct CWE CWE628(628U); // Function Call with Incorrectly Specified Arguments
66-
static const struct CWE CWE683(683U); // Function Call With Incorrect Order of Arguments
67-
static const struct CWE CWE704(704U); // Incorrect Type Conversion or Cast
68-
static const struct CWE CWE758(758U); // Reliance on Undefined, Unspecified, or Implementation-Defined Behavior
69-
static const struct CWE CWE768(768U); // Incorrect Short Circuit Evaluation
70-
static const struct CWE CWE783(783U); // Operator Precedence Logic Error
53+
static const CWE CWE128(128U); // Wrap-around Error
54+
static const CWE CWE131(131U); // Incorrect Calculation of Buffer Size
55+
static const CWE CWE197(197U); // Numeric Truncation Error
56+
static const CWE CWE362(362U); // Concurrent Execution using Shared Resource with Improper Synchronization ('Race Condition')
57+
static const CWE CWE369(369U); // Divide By Zero
58+
static const CWE CWE398(398U); // Indicator of Poor Code Quality
59+
static const CWE CWE475(475U); // Undefined Behavior for Input to API
60+
static const CWE CWE561(561U); // Dead Code
61+
static const CWE CWE563(563U); // Assignment to Variable without Use ('Unused Variable')
62+
static const CWE CWE570(570U); // Expression is Always False
63+
static const CWE CWE571(571U); // Expression is Always True
64+
static const CWE CWE672(672U); // Operation on a Resource after Expiration or Release
65+
static const CWE CWE628(628U); // Function Call with Incorrectly Specified Arguments
66+
static const CWE CWE683(683U); // Function Call With Incorrect Order of Arguments
67+
static const CWE CWE704(704U); // Incorrect Type Conversion or Cast
68+
static const CWE CWE758(758U); // Reliance on Undefined, Unspecified, or Implementation-Defined Behavior
69+
static const CWE CWE768(768U); // Incorrect Short Circuit Evaluation
70+
static const CWE CWE783(783U); // Operator Precedence Logic Error
7171

7272
//----------------------------------------------------------------------------------
7373
// The return value of fgetc(), getc(), ungetc(), getchar() etc. is an integer value.
@@ -2793,7 +2793,7 @@ void CheckOther::checkComparisonFunctionIsAlwaysTrueOrFalse()
27932793
void CheckOther::checkComparisonFunctionIsAlwaysTrueOrFalseError(const Token* tok, const std::string &functionName, const std::string &varName, const bool result)
27942794
{
27952795
const std::string strResult = bool_to_string(result);
2796-
const struct CWE cweResult = result ? CWE571 : CWE570;
2796+
const CWE cweResult = result ? CWE571 : CWE570;
27972797

27982798
reportError(tok, Severity::warning, "comparisonFunctionIsAlwaysTrueOrFalse",
27992799
"$symbol:" + functionName + "\n"

lib/checkpostfixoperator.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ namespace {
4040

4141

4242
// CWE ids used
43-
static const struct CWE CWE398(398U); // Indicator of Poor Code Quality
43+
static const CWE CWE398(398U); // Indicator of Poor Code Quality
4444

4545

4646
void CheckPostfixOperator::postfixOperator()

lib/checksizeof.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ namespace {
4040
}
4141

4242
// CWE IDs used:
43-
static const struct CWE CWE398(398U); // Indicator of Poor Code Quality
44-
static const struct CWE CWE467(467U); // Use of sizeof() on a Pointer Type
45-
static const struct CWE CWE682(682U); // Incorrect Calculation
43+
static const CWE CWE398(398U); // Indicator of Poor Code Quality
44+
static const CWE CWE467(467U); // Use of sizeof() on a Pointer Type
45+
static const CWE CWE682(682U); // Incorrect Calculation
4646
//---------------------------------------------------------------------------
4747
//---------------------------------------------------------------------------
4848
void CheckSizeof::checkSizeofForNumericParameter()

lib/checkstl.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -52,18 +52,18 @@ namespace {
5252
}
5353

5454
// CWE IDs used:
55-
static const struct CWE CWE398(398U); // Indicator of Poor Code Quality
56-
static const struct CWE CWE597(597U); // Use of Wrong Operator in String Comparison
57-
static const struct CWE CWE628(628U); // Function Call with Incorrectly Specified Arguments
58-
static const struct CWE CWE664(664U); // Improper Control of a Resource Through its Lifetime
59-
static const struct CWE CWE667(667U); // Improper Locking
60-
static const struct CWE CWE704(704U); // Incorrect Type Conversion or Cast
61-
static const struct CWE CWE762(762U); // Mismatched Memory Management Routines
62-
static const struct CWE CWE786(786U); // Access of Memory Location Before Start of Buffer
63-
static const struct CWE CWE788(788U); // Access of Memory Location After End of Buffer
64-
static const struct CWE CWE825(825U); // Expired Pointer Dereference
65-
static const struct CWE CWE833(833U); // Deadlock
66-
static const struct CWE CWE834(834U); // Excessive Iteration
55+
static const CWE CWE398(398U); // Indicator of Poor Code Quality
56+
static const CWE CWE597(597U); // Use of Wrong Operator in String Comparison
57+
static const CWE CWE628(628U); // Function Call with Incorrectly Specified Arguments
58+
static const CWE CWE664(664U); // Improper Control of a Resource Through its Lifetime
59+
static const CWE CWE667(667U); // Improper Locking
60+
static const CWE CWE704(704U); // Incorrect Type Conversion or Cast
61+
static const CWE CWE762(762U); // Mismatched Memory Management Routines
62+
static const CWE CWE786(786U); // Access of Memory Location Before Start of Buffer
63+
static const CWE CWE788(788U); // Access of Memory Location After End of Buffer
64+
static const CWE CWE825(825U); // Expired Pointer Dereference
65+
static const CWE CWE833(833U); // Deadlock
66+
static const CWE CWE834(834U); // Excessive Iteration
6767

6868
static bool isElementAccessYield(Library::Container::Yield yield)
6969
{

lib/checkstring.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,12 @@ namespace {
4242
}
4343

4444
// CWE ids used:
45-
static const struct CWE CWE570(570U); // Expression is Always False
46-
static const struct CWE CWE571(571U); // Expression is Always True
47-
static const struct CWE CWE595(595U); // Comparison of Object References Instead of Object Contents
48-
static const struct CWE CWE628(628U); // Function Call with Incorrectly Specified Arguments
49-
static const struct CWE CWE665(665U); // Improper Initialization
50-
static const struct CWE CWE758(758U); // Reliance on Undefined, Unspecified, or Implementation-Defined Behavior
45+
static const CWE CWE570(570U); // Expression is Always False
46+
static const CWE CWE571(571U); // Expression is Always True
47+
static const CWE CWE595(595U); // Comparison of Object References Instead of Object Contents
48+
static const CWE CWE628(628U); // Function Call with Incorrectly Specified Arguments
49+
static const CWE CWE665(665U); // Improper Initialization
50+
static const CWE CWE758(758U); // Reliance on Undefined, Unspecified, or Implementation-Defined Behavior
5151

5252
//---------------------------------------------------------------------------
5353
// Writing string literal is UB

lib/checktype.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,10 @@ namespace {
4848
//
4949

5050
// CWE ids used:
51-
static const struct CWE CWE195(195U); // Signed to Unsigned Conversion Error
52-
static const struct CWE CWE197(197U); // Numeric Truncation Error
53-
static const struct CWE CWE758(758U); // Reliance on Undefined, Unspecified, or Implementation-Defined Behavior
54-
static const struct CWE CWE190(190U); // Integer Overflow or Wraparound
51+
static const CWE CWE195(195U); // Signed to Unsigned Conversion Error
52+
static const CWE CWE197(197U); // Numeric Truncation Error
53+
static const CWE CWE758(758U); // Reliance on Undefined, Unspecified, or Implementation-Defined Behavior
54+
static const CWE CWE190(190U); // Integer Overflow or Wraparound
5555

5656

5757
void CheckType::checkTooBigBitwiseShift()

lib/checkuninitvar.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ namespace tinyxml2 {
4949
//---------------------------------------------------------------------------
5050

5151
// CWE ids used:
52-
static const struct CWE CWE_USE_OF_UNINITIALIZED_VARIABLE(457U);
52+
static const CWE CWE_USE_OF_UNINITIALIZED_VARIABLE(457U);
5353

5454
// Register this check class (by creating a static instance of it)
5555
namespace {

lib/checkunusedfunctions.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ namespace {
5454
CheckUnusedFunctions instance;
5555
}
5656

57-
static const struct CWE CWE561(561U); // Dead Code
57+
static const CWE CWE561(561U); // Dead Code
5858

5959
static std::string stripTemplateParameters(const std::string& funcName) {
6060
std::string name = funcName;

lib/checkunusedvar.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ namespace {
4545
CheckUnusedVar instance;
4646
}
4747

48-
static const struct CWE CWE563(563U); // Assignment to Variable without Use ('Unused Variable')
49-
static const struct CWE CWE665(665U); // Improper Initialization
48+
static const CWE CWE563(563U); // Assignment to Variable without Use ('Unused Variable')
49+
static const CWE CWE665(665U); // Improper Initialization
5050

5151
/** Is scope a raii class scope */
5252
static bool isRaiiClassScope(const Scope *classScope)

lib/checkvaarg.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ namespace {
4141
//---------------------------------------------------------------------------
4242

4343
// CWE ids used:
44-
static const struct CWE CWE664(664U); // Improper Control of a Resource Through its Lifetime
45-
static const struct CWE CWE688(688U); // Function Call With Incorrect Variable or Reference as Argument
46-
static const struct CWE CWE758(758U); // Reliance on Undefined, Unspecified, or Implementation-Defined Behavior
44+
static const CWE CWE664(664U); // Improper Control of a Resource Through its Lifetime
45+
static const CWE CWE688(688U); // Function Call With Incorrect Variable or Reference as Argument
46+
static const CWE CWE758(758U); // Reliance on Undefined, Unspecified, or Implementation-Defined Behavior
4747

4848
void CheckVaarg::va_start_argument()
4949
{

lib/cppcheck.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1503,7 +1503,7 @@ void CppCheck::executeAddons(const std::vector<std::string>& files)
15031503
}
15041504

15051505
for (const std::string &addon : mSettings.addons) {
1506-
struct AddonInfo addonInfo;
1506+
AddonInfo addonInfo;
15071507
const std::string &failedToGetAddonInfo = addonInfo.getAddonInfo(addon, mSettings.exename);
15081508
if (!failedToGetAddonInfo.empty()) {
15091509
reportOut(failedToGetAddonInfo, Color::FgRed);

0 commit comments

Comments
 (0)