Skip to content

Commit

Permalink
Library: fixed -Wmissing-field-initializers GCC compiler warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
firewave committed Sep 29, 2023
1 parent 6d75912 commit eb70a58
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions lib/library.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ Library::Error Library::load(const tinyxml2::XMLDocument &doc)
for (const tinyxml2::XMLElement *memorynode = node->FirstChildElement(); memorynode; memorynode = memorynode->NextSiblingElement()) {
const std::string memorynodename = memorynode->Name();
if (memorynodename == "alloc" || memorynodename == "realloc") {
AllocFunc temp = {0};
AllocFunc temp;
temp.groupId = allocationId;

temp.initData = memorynode->BoolAttribute("init", true);
Expand Down Expand Up @@ -270,7 +270,7 @@ Library::Error Library::load(const tinyxml2::XMLDocument &doc)
else
mRealloc[memorynode->GetText()] = temp;
} else if (memorynodename == "dealloc") {
AllocFunc temp = {0};
AllocFunc temp;
temp.groupId = allocationId;
temp.arg = memorynode->IntAttribute("arg", 1);
mDealloc[memorynode->GetText()] = temp;
Expand Down Expand Up @@ -557,7 +557,7 @@ Library::Error Library::load(const tinyxml2::XMLDocument &doc)
const char * const name = node->Attribute("name");
if (!name)
return Error(ErrorCode::MISSING_ATTRIBUTE, "name");
PodType podType = {0};
PodType podType;
podType.stdtype = PodType::Type::NO;
const char * const stdtype = node->Attribute("stdtype");
if (stdtype) {
Expand Down
14 changes: 7 additions & 7 deletions lib/library.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,14 @@ class CPPCHECKLIB Library {
Error load(const tinyxml2::XMLDocument &doc);

struct AllocFunc {
int groupId;
int arg;
int groupId{};
int arg{};
enum class BufferSize {none,malloc,calloc,strdup};
BufferSize bufferSize;
int bufferSizeArg1;
int bufferSizeArg2;
int reallocArg;
bool initData;
BufferSize bufferSize{BufferSize::none};
int bufferSizeArg1{};
int bufferSizeArg2{};
int reallocArg{};
bool initData{};
};

/** get allocation info for function */
Expand Down

0 comments on commit eb70a58

Please sign in to comment.