Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cli/filelister.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ static std::string addFiles2(std::map<std::string, std::size_t> &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;
Expand Down
2 changes: 1 addition & 1 deletion cli/processexecutor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ unsigned int ProcessExecutor::check()
FD_ZERO(&rfds);
for (std::list<int>::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);
Expand Down
8 changes: 4 additions & 4 deletions gui/cppchecklibrarydata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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);
Expand Down Expand Up @@ -518,7 +518,7 @@ QString CppcheckLibraryData::open(QIODevice &file)
return QString();
}

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

static void writeContainerRangeItemRecords(QXmlStreamWriter &xmlWriter, const QList<struct CppcheckLibraryData::Container::RangeItemRecordType> &rangeItemRecords)
static void writeContainerRangeItemRecords(QXmlStreamWriter &xmlWriter, const QList<CppcheckLibraryData::Container::RangeItemRecordType> &rangeItemRecords)
{
if (rangeItemRecords.isEmpty())
return;
Expand Down
38 changes: 19 additions & 19 deletions gui/cppchecklibrarydata.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ class CppcheckLibraryData {
QString yields;
QString action;
};
QList<struct Function> accessFunctions;
QList<struct Function> otherFunctions;
QList<struct Function> sizeFunctions;
QList<struct RangeItemRecordType> rangeItemRecordTypeList;
QList<Function> accessFunctions;
QList<Function> otherFunctions;
QList<Function> sizeFunctions;
QList<RangeItemRecordType> rangeItemRecordTypeList;
};

struct Define {
Expand Down Expand Up @@ -106,13 +106,13 @@ class CppcheckLibraryData {
QString arg;
QString arg2;
};
QList<struct MinSize> minsizes;
QList<MinSize> minsizes;
struct Iterator {
int container = -1;
QString type;
} iterator;
};
QList<struct Arg> args;
QList<Arg> args;

struct {
QString severity;
Expand Down Expand Up @@ -149,8 +149,8 @@ class CppcheckLibraryData {
QString name;
};

QList<struct Alloc> alloc;
QList<struct Dealloc> dealloc;
QList<Alloc> alloc;
QList<Dealloc> dealloc;
QStringList use;
};

Expand All @@ -176,7 +176,7 @@ class CppcheckLibraryData {
QString name;
};

QList<struct Call> calls;
QList<Call> calls;
};

struct Markup {
Expand Down Expand Up @@ -244,18 +244,18 @@ class CppcheckLibraryData {
QString open(QIODevice &file);
QString toString() const;

QList<struct Container> containers;
QList<struct Define> defines;
QList<struct Function> functions;
QList<struct MemoryResource> memoryresource;
QList<struct PodType> podtypes;
QList<Container> containers;
QList<Define> defines;
QList<Function> functions;
QList<MemoryResource> memoryresource;
QList<PodType> podtypes;
QList<TypeChecks> typeChecks;
QList<struct PlatformType> platformTypes;
QList<PlatformType> platformTypes;
QStringList undefines;
QList<struct SmartPointer> smartPointers;
QList<struct Reflection> reflections;
QList<struct Markup> markups;
QList<struct Entrypoint> entrypoints;
QList<SmartPointer> smartPointers;
QList<Reflection> reflections;
QList<Markup> markups;
QList<Entrypoint> entrypoints;
};

#endif // CPPCHECKLIBRARYDATA_H
4 changes: 2 additions & 2 deletions lib/check64bit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion lib/checkassert.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion lib/checkclass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions lib/checkcondition.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@
#include <vector>

// 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

//---------------------------------------------------------------------------

Expand Down
6 changes: 3 additions & 3 deletions lib/checkexceptionsafety.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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

//---------------------------------------------------------------------------

Expand Down
4 changes: 2 additions & 2 deletions lib/checknullpointer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
38 changes: 19 additions & 19 deletions lib/checkother.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion lib/checkpostfixoperator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
6 changes: 3 additions & 3 deletions lib/checksizeof.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
24 changes: 12 additions & 12 deletions lib/checkstl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
12 changes: 6 additions & 6 deletions lib/checkstring.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions lib/checktype.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion lib/checkuninitvar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion lib/checkunusedfunctions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions lib/checkunusedvar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions lib/checkvaarg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()
{
Expand Down
2 changes: 1 addition & 1 deletion lib/cppcheck.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1503,7 +1503,7 @@ void CppCheck::executeAddons(const std::vector<std::string>& 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);
Expand Down
Loading