diff --git a/Makefile b/Makefile index b00b09f4944..3fac13f0872 100644 --- a/Makefile +++ b/Makefile @@ -136,7 +136,7 @@ ifeq (clang++, $(findstring clang++,$(CXX))) CPPCHK_GLIBCXX_DEBUG= endif ifndef CXXFLAGS - CXXFLAGS=-pedantic -Wall -Wextra -Wcast-qual -Wfloat-equal -Wmissing-declarations -Wmissing-format-attribute -Wno-long-long -Wpacked -Wredundant-decls -Wundef -Wno-shadow -Wno-missing-field-initializers -Wno-missing-braces -Wno-sign-compare -Wno-multichar -Woverloaded-virtual $(CPPCHK_GLIBCXX_DEBUG) -g + CXXFLAGS=-pedantic -Wall -Wextra -Wcast-qual -Wfloat-equal -Wmissing-declarations -Wmissing-format-attribute -Wno-long-long -Wpacked -Wredundant-decls -Wundef -Wno-shadow -Wno-missing-braces -Wno-sign-compare -Wno-multichar -Woverloaded-virtual $(CPPCHK_GLIBCXX_DEBUG) -g endif ifeq (g++, $(findstring g++,$(CXX))) diff --git a/cmake/compileroptions.cmake b/cmake/compileroptions.cmake index 5673aed88de..8ade56487a3 100644 --- a/cmake/compileroptions.cmake +++ b/cmake/compileroptions.cmake @@ -47,7 +47,6 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang" add_compile_options(-Wpacked) # add_compile_options(-Wredundant-decls) # if anything is declared more than once in the same scope add_compile_options(-Wundef) - add_compile_options(-Wno-missing-field-initializers) add_compile_options(-Wno-missing-braces) add_compile_options(-Wno-sign-compare) add_compile_options(-Wno-multichar) diff --git a/lib/library.cpp b/lib/library.cpp index 922e0a9dd10..bf9d0ce5f74 100644 --- a/lib/library.cpp +++ b/lib/library.cpp @@ -359,7 +359,7 @@ Library::Error Library::load(const tinyxml2::XMLDocument &doc) const std::string memorynodename = memorynode->Name(); const auto names = getnames(memorynode->GetText()); if (memorynodename == "alloc" || memorynodename == "realloc") { - AllocFunc temp = {0}; + AllocFunc temp; temp.groupId = allocationId; temp.initData = memorynode->BoolAttribute("init", true); @@ -396,7 +396,7 @@ Library::Error Library::load(const tinyxml2::XMLDocument &doc) for (const auto& n : names) map[n] = temp; } else if (memorynodename == "dealloc") { - AllocFunc temp = {0}; + AllocFunc temp; temp.groupId = allocationId; temp.arg = memorynode->IntAttribute("arg", 1); for (const auto& n : names) @@ -689,7 +689,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) { diff --git a/lib/library.h b/lib/library.h index 8e8db581c00..47642c84e9d 100644 --- a/lib/library.h +++ b/lib/library.h @@ -78,14 +78,14 @@ class CPPCHECKLIB Library { Error load(const char exename[], const char path[], bool debug = false); struct AllocFunc { - int groupId; - int arg; + int groupId{}; + int arg{}; enum class BufferSize : std::uint8_t {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 */ @@ -416,9 +416,9 @@ class CPPCHECKLIB Library { const SmartPointer* detectSmartPointer(const Token* tok, bool withoutStd = false) const; struct PodType { - unsigned int size; - char sign; - enum class Type : std::uint8_t { NO, BOOL, CHAR, SHORT, INT, LONG, LONGLONG } stdtype; + unsigned int size{}; + char sign{}; + enum class Type : std::uint8_t { NO, BOOL, CHAR, SHORT, INT, LONG, LONGLONG } stdtype = Type::NO; }; const PodType *podtype(const std::string &name) const; diff --git a/tools/dmake/dmake.cpp b/tools/dmake/dmake.cpp index 056b98b7354..eb879f32b4d 100644 --- a/tools/dmake/dmake.cpp +++ b/tools/dmake/dmake.cpp @@ -716,7 +716,6 @@ int main(int argc, char **argv) "-Wredundant-decls " "-Wundef " "-Wno-shadow " - "-Wno-missing-field-initializers " "-Wno-missing-braces " "-Wno-sign-compare " "-Wno-multichar "