diff --git a/Makefile b/Makefile index 36567d26387..dbd82d5db14 100644 --- a/Makefile +++ b/Makefile @@ -709,7 +709,7 @@ test/testbool.o: test/testbool.cpp lib/check.h lib/checkbool.h lib/color.h lib/c test/testboost.o: test/testboost.cpp lib/check.h lib/checkboost.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/importproject.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/templatesimplifier.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/vfvalue.h test/fixture.h $(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ test/testboost.cpp -test/testbufferoverrun.o: test/testbufferoverrun.cpp externals/simplecpp/simplecpp.h lib/check.h lib/checkbufferoverrun.h lib/color.h lib/config.h lib/ctu.h lib/errorlogger.h lib/errortypes.h lib/importproject.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/sourcelocation.h lib/standards.h lib/suppressions.h lib/symboldatabase.h lib/templatesimplifier.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/vfvalue.h test/fixture.h +test/testbufferoverrun.o: test/testbufferoverrun.cpp externals/simplecpp/simplecpp.h lib/check.h lib/checkbufferoverrun.h lib/color.h lib/config.h lib/ctu.h lib/errorlogger.h lib/errortypes.h lib/importproject.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/sourcelocation.h lib/standards.h lib/suppressions.h lib/symboldatabase.h lib/templatesimplifier.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/vfvalue.h test/fixture.h test/helpers.h $(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ test/testbufferoverrun.cpp test/testcharvar.o: test/testcharvar.cpp lib/check.h lib/checkother.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/importproject.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/templatesimplifier.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/vfvalue.h test/fixture.h @@ -721,7 +721,7 @@ test/testcheck.o: test/testcheck.cpp lib/check.h lib/color.h lib/config.h lib/er test/testclangimport.o: test/testclangimport.cpp lib/check.h lib/clangimport.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/importproject.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/sourcelocation.h lib/standards.h lib/suppressions.h lib/symboldatabase.h lib/templatesimplifier.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/vfvalue.h test/fixture.h $(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ test/testclangimport.cpp -test/testclass.o: test/testclass.cpp externals/simplecpp/simplecpp.h lib/check.h lib/checkclass.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/importproject.h lib/library.h lib/mathlib.h lib/platform.h lib/preprocessor.h lib/settings.h lib/sourcelocation.h lib/standards.h lib/suppressions.h lib/symboldatabase.h lib/templatesimplifier.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/vfvalue.h test/fixture.h +test/testclass.o: test/testclass.cpp externals/simplecpp/simplecpp.h lib/check.h lib/checkclass.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/importproject.h lib/library.h lib/mathlib.h lib/platform.h lib/preprocessor.h lib/settings.h lib/sourcelocation.h lib/standards.h lib/suppressions.h lib/symboldatabase.h lib/templatesimplifier.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/vfvalue.h test/fixture.h test/helpers.h $(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ test/testclass.cpp test/testcmdlineparser.o: test/testcmdlineparser.cpp cli/cmdlinelogger.h cli/cmdlineparser.h cli/cppcheckexecutor.h lib/check.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/importproject.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/templatesimplifier.h lib/timer.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/vfvalue.h test/fixture.h test/helpers.h test/redirect.h @@ -730,7 +730,7 @@ test/testcmdlineparser.o: test/testcmdlineparser.cpp cli/cmdlinelogger.h cli/cmd test/testcolor.o: test/testcolor.cpp lib/check.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/importproject.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/utils.h test/fixture.h $(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ test/testcolor.cpp -test/testcondition.o: test/testcondition.cpp externals/simplecpp/simplecpp.h lib/check.h lib/checkcondition.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/importproject.h lib/library.h lib/mathlib.h lib/platform.h lib/preprocessor.h lib/settings.h lib/standards.h lib/suppressions.h lib/templatesimplifier.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/vfvalue.h test/fixture.h +test/testcondition.o: test/testcondition.cpp externals/simplecpp/simplecpp.h lib/check.h lib/checkcondition.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/importproject.h lib/library.h lib/mathlib.h lib/platform.h lib/preprocessor.h lib/settings.h lib/standards.h lib/suppressions.h lib/templatesimplifier.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/vfvalue.h test/fixture.h test/helpers.h $(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ test/testcondition.cpp test/testconstructors.o: test/testconstructors.cpp lib/check.h lib/checkclass.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/importproject.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/sourcelocation.h lib/standards.h lib/suppressions.h lib/symboldatabase.h lib/templatesimplifier.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/vfvalue.h test/fixture.h @@ -757,7 +757,7 @@ test/testgarbage.o: test/testgarbage.cpp externals/simplecpp/simplecpp.h lib/che test/testimportproject.o: test/testimportproject.cpp lib/check.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/importproject.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/utils.h test/fixture.h $(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ test/testimportproject.cpp -test/testincompletestatement.o: test/testincompletestatement.cpp externals/simplecpp/simplecpp.h lib/check.h lib/checkother.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/importproject.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/templatesimplifier.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/vfvalue.h test/fixture.h +test/testincompletestatement.o: test/testincompletestatement.cpp externals/simplecpp/simplecpp.h lib/check.h lib/checkother.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/importproject.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/templatesimplifier.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/vfvalue.h test/fixture.h test/helpers.h $(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ test/testincompletestatement.cpp test/testinternal.o: test/testinternal.cpp lib/check.h lib/checkinternal.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/importproject.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/templatesimplifier.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/vfvalue.h test/fixture.h @@ -766,7 +766,7 @@ test/testinternal.o: test/testinternal.cpp lib/check.h lib/checkinternal.h lib/c test/testio.o: test/testio.cpp lib/check.h lib/checkio.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/importproject.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/templatesimplifier.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/vfvalue.h test/fixture.h $(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ test/testio.cpp -test/testleakautovar.o: test/testleakautovar.cpp externals/simplecpp/simplecpp.h lib/check.h lib/checkleakautovar.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/importproject.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/templatesimplifier.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/vfvalue.h test/fixture.h +test/testleakautovar.o: test/testleakautovar.cpp externals/simplecpp/simplecpp.h lib/check.h lib/checkleakautovar.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/importproject.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/templatesimplifier.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/vfvalue.h test/fixture.h test/helpers.h $(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ test/testleakautovar.cpp test/testlibrary.o: test/testlibrary.cpp externals/tinyxml2/tinyxml2.h lib/check.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/importproject.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/templatesimplifier.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/vfvalue.h test/fixture.h test/helpers.h @@ -778,13 +778,13 @@ test/testmathlib.o: test/testmathlib.cpp lib/check.h lib/color.h lib/config.h li test/testmemleak.o: test/testmemleak.cpp lib/check.h lib/checkmemoryleak.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/importproject.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/sourcelocation.h lib/standards.h lib/suppressions.h lib/symboldatabase.h lib/templatesimplifier.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/vfvalue.h test/fixture.h $(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ test/testmemleak.cpp -test/testnullpointer.o: test/testnullpointer.cpp externals/simplecpp/simplecpp.h lib/check.h lib/checknullpointer.h lib/color.h lib/config.h lib/ctu.h lib/errorlogger.h lib/errortypes.h lib/importproject.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/templatesimplifier.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/vfvalue.h test/fixture.h +test/testnullpointer.o: test/testnullpointer.cpp externals/simplecpp/simplecpp.h lib/check.h lib/checknullpointer.h lib/color.h lib/config.h lib/ctu.h lib/errorlogger.h lib/errortypes.h lib/importproject.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/templatesimplifier.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/vfvalue.h test/fixture.h test/helpers.h $(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ test/testnullpointer.cpp test/testoptions.o: test/testoptions.cpp lib/check.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/importproject.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/utils.h test/fixture.h test/options.h $(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ test/testoptions.cpp -test/testother.o: test/testother.cpp externals/simplecpp/simplecpp.h lib/check.h lib/checkother.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/importproject.h lib/library.h lib/mathlib.h lib/platform.h lib/preprocessor.h lib/settings.h lib/standards.h lib/suppressions.h lib/templatesimplifier.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/vfvalue.h test/fixture.h +test/testother.o: test/testother.cpp externals/simplecpp/simplecpp.h lib/check.h lib/checkother.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/importproject.h lib/library.h lib/mathlib.h lib/platform.h lib/preprocessor.h lib/settings.h lib/standards.h lib/suppressions.h lib/templatesimplifier.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/vfvalue.h test/fixture.h test/helpers.h $(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ test/testother.cpp test/testpath.o: test/testpath.cpp lib/check.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/importproject.h lib/library.h lib/mathlib.h lib/path.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/templatesimplifier.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/vfvalue.h test/fixture.h test/helpers.h @@ -802,7 +802,7 @@ test/testpostfixoperator.o: test/testpostfixoperator.cpp lib/check.h lib/checkpo test/testpreprocessor.o: test/testpreprocessor.cpp externals/simplecpp/simplecpp.h lib/check.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/importproject.h lib/library.h lib/mathlib.h lib/path.h lib/platform.h lib/preprocessor.h lib/settings.h lib/standards.h lib/suppressions.h lib/templatesimplifier.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/vfvalue.h test/fixture.h test/helpers.h $(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ test/testpreprocessor.cpp -test/testprocessexecutor.o: test/testprocessexecutor.cpp cli/executor.h cli/processexecutor.h lib/check.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/importproject.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/templatesimplifier.h lib/timer.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/vfvalue.h test/fixture.h test/helpers.h test/redirect.h +test/testprocessexecutor.o: test/testprocessexecutor.cpp cli/executor.h cli/processexecutor.h lib/analyzerinfo.h lib/check.h lib/color.h lib/config.h lib/cppcheck.h lib/errorlogger.h lib/errortypes.h lib/importproject.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/templatesimplifier.h lib/timer.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/vfvalue.h test/fixture.h test/helpers.h test/redirect.h $(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ test/testprocessexecutor.cpp test/testsettings.o: test/testsettings.cpp lib/check.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/importproject.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/utils.h test/fixture.h @@ -814,22 +814,22 @@ test/testsimplifytemplate.o: test/testsimplifytemplate.cpp lib/check.h lib/color test/testsimplifytokens.o: test/testsimplifytokens.cpp lib/check.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/importproject.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/templatesimplifier.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/vfvalue.h test/fixture.h $(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ test/testsimplifytokens.cpp -test/testsimplifytypedef.o: test/testsimplifytypedef.cpp externals/simplecpp/simplecpp.h lib/check.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/importproject.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/templatesimplifier.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/vfvalue.h test/fixture.h +test/testsimplifytypedef.o: test/testsimplifytypedef.cpp externals/simplecpp/simplecpp.h lib/check.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/importproject.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/templatesimplifier.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/vfvalue.h test/fixture.h test/helpers.h $(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ test/testsimplifytypedef.cpp -test/testsimplifyusing.o: test/testsimplifyusing.cpp externals/simplecpp/simplecpp.h lib/check.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/importproject.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/templatesimplifier.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/vfvalue.h test/fixture.h +test/testsimplifyusing.o: test/testsimplifyusing.cpp externals/simplecpp/simplecpp.h lib/check.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/importproject.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/templatesimplifier.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/vfvalue.h test/fixture.h test/helpers.h $(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ test/testsimplifyusing.cpp test/testsingleexecutor.o: test/testsingleexecutor.cpp cli/executor.h cli/singleexecutor.h lib/analyzerinfo.h lib/check.h lib/color.h lib/config.h lib/cppcheck.h lib/errorlogger.h lib/errortypes.h lib/importproject.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/templatesimplifier.h lib/timer.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/vfvalue.h test/fixture.h test/helpers.h test/redirect.h $(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ test/testsingleexecutor.cpp -test/testsizeof.o: test/testsizeof.cpp externals/simplecpp/simplecpp.h lib/check.h lib/checksizeof.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/importproject.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/templatesimplifier.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/vfvalue.h test/fixture.h +test/testsizeof.o: test/testsizeof.cpp externals/simplecpp/simplecpp.h lib/check.h lib/checksizeof.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/importproject.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/templatesimplifier.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/vfvalue.h test/fixture.h test/helpers.h $(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ test/testsizeof.cpp test/teststl.o: test/teststl.cpp lib/check.h lib/checkstl.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/importproject.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/templatesimplifier.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/vfvalue.h test/fixture.h $(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ test/teststl.cpp -test/teststring.o: test/teststring.cpp externals/simplecpp/simplecpp.h lib/check.h lib/checkstring.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/importproject.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/templatesimplifier.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/vfvalue.h test/fixture.h +test/teststring.o: test/teststring.cpp externals/simplecpp/simplecpp.h lib/check.h lib/checkstring.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/importproject.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/templatesimplifier.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/vfvalue.h test/fixture.h test/helpers.h $(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ test/teststring.cpp test/testsummaries.o: test/testsummaries.cpp lib/check.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/importproject.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/summaries.h lib/suppressions.h lib/templatesimplifier.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/vfvalue.h test/fixture.h @@ -841,7 +841,7 @@ test/testsuppressions.o: test/testsuppressions.cpp cli/cppcheckexecutor.h cli/ex test/testsymboldatabase.o: test/testsymboldatabase.cpp lib/check.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/importproject.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/sourcelocation.h lib/standards.h lib/suppressions.h lib/symboldatabase.h lib/templatesimplifier.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/vfvalue.h test/fixture.h test/helpers.h $(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ test/testsymboldatabase.cpp -test/testthreadexecutor.o: test/testthreadexecutor.cpp cli/executor.h cli/threadexecutor.h lib/check.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/importproject.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/templatesimplifier.h lib/timer.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/vfvalue.h test/fixture.h test/helpers.h test/redirect.h +test/testthreadexecutor.o: test/testthreadexecutor.cpp cli/executor.h cli/threadexecutor.h lib/analyzerinfo.h lib/check.h lib/color.h lib/config.h lib/cppcheck.h lib/errorlogger.h lib/errortypes.h lib/importproject.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/templatesimplifier.h lib/timer.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/vfvalue.h test/fixture.h test/helpers.h test/redirect.h $(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ test/testthreadexecutor.cpp test/testtimer.o: test/testtimer.cpp lib/check.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/importproject.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/timer.h lib/utils.h test/fixture.h @@ -868,10 +868,10 @@ test/testuninitvar.o: test/testuninitvar.cpp lib/check.h lib/checkuninitvar.h li test/testunusedfunctions.o: test/testunusedfunctions.cpp externals/simplecpp/simplecpp.h lib/check.h lib/checkunusedfunctions.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/importproject.h lib/library.h lib/mathlib.h lib/platform.h lib/preprocessor.h lib/settings.h lib/standards.h lib/suppressions.h lib/templatesimplifier.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/vfvalue.h test/fixture.h test/helpers.h $(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ test/testunusedfunctions.cpp -test/testunusedprivfunc.o: test/testunusedprivfunc.cpp externals/simplecpp/simplecpp.h lib/check.h lib/checkclass.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/importproject.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/sourcelocation.h lib/standards.h lib/suppressions.h lib/symboldatabase.h lib/templatesimplifier.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/vfvalue.h test/fixture.h +test/testunusedprivfunc.o: test/testunusedprivfunc.cpp externals/simplecpp/simplecpp.h lib/check.h lib/checkclass.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/importproject.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/sourcelocation.h lib/standards.h lib/suppressions.h lib/symboldatabase.h lib/templatesimplifier.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/vfvalue.h test/fixture.h test/helpers.h $(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ test/testunusedprivfunc.cpp -test/testunusedvar.o: test/testunusedvar.cpp externals/simplecpp/simplecpp.h lib/check.h lib/checkunusedvar.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/importproject.h lib/library.h lib/mathlib.h lib/platform.h lib/preprocessor.h lib/settings.h lib/standards.h lib/suppressions.h lib/templatesimplifier.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/vfvalue.h test/fixture.h +test/testunusedvar.o: test/testunusedvar.cpp externals/simplecpp/simplecpp.h lib/check.h lib/checkunusedvar.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/importproject.h lib/library.h lib/mathlib.h lib/platform.h lib/preprocessor.h lib/settings.h lib/standards.h lib/suppressions.h lib/templatesimplifier.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/vfvalue.h test/fixture.h test/helpers.h $(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ test/testunusedvar.cpp test/testutils.o: test/testutils.cpp lib/check.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/importproject.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/utils.h test/fixture.h @@ -880,7 +880,7 @@ test/testutils.o: test/testutils.cpp lib/check.h lib/color.h lib/config.h lib/er test/testvaarg.o: test/testvaarg.cpp lib/check.h lib/checkvaarg.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/importproject.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/templatesimplifier.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/vfvalue.h test/fixture.h $(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ test/testvaarg.cpp -test/testvalueflow.o: test/testvalueflow.cpp externals/simplecpp/simplecpp.h lib/check.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/importproject.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/templatesimplifier.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/vfvalue.h test/fixture.h +test/testvalueflow.o: test/testvalueflow.cpp externals/simplecpp/simplecpp.h lib/check.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/importproject.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/templatesimplifier.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/vfvalue.h test/fixture.h test/helpers.h $(CXX) ${INCLUDE_FOR_TEST} $(CPPFLAGS) $(CXXFLAGS) -c -o $@ test/testvalueflow.cpp test/testvarid.o: test/testvarid.cpp lib/check.h lib/color.h lib/config.h lib/errorlogger.h lib/errortypes.h lib/importproject.h lib/library.h lib/mathlib.h lib/platform.h lib/settings.h lib/standards.h lib/suppressions.h lib/templatesimplifier.h lib/token.h lib/tokenize.h lib/tokenlist.h lib/utils.h lib/vfvalue.h test/fixture.h diff --git a/addons/test/misra/misra-test.c b/addons/test/misra/misra-test.c index 2d1a523ffc4..ef602a1353f 100644 --- a/addons/test/misra/misra-test.c +++ b/addons/test/misra/misra-test.c @@ -696,6 +696,7 @@ static void misra_10_3(uint32_t u32a, uint32_t u32b) { res = 2U + 3U; // no warning, utlr=unsigned char res = 0.1f; // 10.3 const char c = '0'; // no-warning + uint32_t u = UINT32_C(10); // no-warning } static void misra_10_4(u32 x, s32 y) { diff --git a/cfg/std.cfg b/cfg/std.cfg index 496397ea7a4..83ab7f8e772 100644 --- a/cfg/std.cfg +++ b/cfg/std.cfg @@ -1,8 +1,5 @@ - - - @@ -40,17 +37,6 @@ - - - - - - - - - - - diff --git a/cfg/windows.cfg b/cfg/windows.cfg index 53dc335e463..2c44370679c 100644 --- a/cfg/windows.cfg +++ b/cfg/windows.cfg @@ -4791,7 +4791,7 @@ HFONT CreateFont( - true + false @@ -4825,7 +4825,7 @@ HFONT CreateFont( - + diff --git a/cli/cmdlineparser.cpp b/cli/cmdlineparser.cpp index fffe0b02d37..4754bf4b4c2 100644 --- a/cli/cmdlineparser.cpp +++ b/cli/cmdlineparser.cpp @@ -654,12 +654,17 @@ bool CmdLineParser::parseFromArgs(int argc, const char* const argv[]) // --project else if (std::strncmp(argv[i], "--project=", 10) == 0) { + if (mSettings.project.projectType != ImportProject::Type::NONE) + { + mLogger.printError("multiple --project options are not supported."); + return false; + } + mSettings.checkAllConfigurations = false; // Can be overridden with --max-configs or --force std::string projectFile = argv[i]+10; ImportProject::Type projType = mSettings.project.import(projectFile, &mSettings); mSettings.project.projectType = projType; if (projType == ImportProject::Type::CPPCHECK_GUI) { - mPathNames = mSettings.project.guiProject.pathNames; for (const std::string &lib : mSettings.project.guiProject.libraries) mSettings.libraries.emplace_back(lib); @@ -1026,12 +1031,20 @@ bool CmdLineParser::parseFromArgs(int argc, const char* const argv[]) return true; } + if (!mPathNames.empty() && mSettings.project.projectType != ImportProject::Type::NONE) { + mLogger.printError("--project cannot be used in conjunction with source files."); + return false; + } + // Print error only if we have "real" command and expect files - if (!mExitAfterPrint && mPathNames.empty() && mSettings.project.fileSettings.empty()) { + if (!mExitAfterPrint && mPathNames.empty() && mSettings.project.guiProject.pathNames.empty() && mSettings.project.fileSettings.empty()) { mLogger.printError("no C or C++ source files found."); return false; } + if (!mSettings.project.guiProject.pathNames.empty()) + mPathNames = mSettings.project.guiProject.pathNames; + // Use paths _pathnames if no base paths for relative path output are given if (mSettings.basePaths.empty() && mSettings.relativePaths) mSettings.basePaths = mPathNames; diff --git a/cli/cppcheckexecutor.cpp b/cli/cppcheckexecutor.cpp index 162bbb45323..3b0418a7f45 100644 --- a/cli/cppcheckexecutor.cpp +++ b/cli/cppcheckexecutor.cpp @@ -325,9 +325,9 @@ int CppCheckExecutor::check_internal(CppCheck& cppcheck) returnValue = executor.check(); } else { #if defined(THREADING_MODEL_THREAD) - ThreadExecutor executor(mFiles, settings, settings.nomsg, *this); + ThreadExecutor executor(mFiles, settings, settings.nomsg, *this, CppCheckExecutor::executeCommand); #elif defined(THREADING_MODEL_FORK) - ProcessExecutor executor(mFiles, settings, settings.nomsg, *this); + ProcessExecutor executor(mFiles, settings, settings.nomsg, *this, CppCheckExecutor::executeCommand); #endif returnValue = executor.check(); } diff --git a/cli/filelister.cpp b/cli/filelister.cpp index df0c7a34324..e25e9a6b478 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 0e1c7b0413c..2e940928636 100644 --- a/cli/processexecutor.cpp +++ b/cli/processexecutor.cpp @@ -62,8 +62,9 @@ enum class Color; using std::memset; -ProcessExecutor::ProcessExecutor(const std::map &files, const Settings &settings, Suppressions &suppressions, ErrorLogger &errorLogger) +ProcessExecutor::ProcessExecutor(const std::map &files, const Settings &settings, Suppressions &suppressions, ErrorLogger &errorLogger, CppCheck::ExecuteCmdFn executeCommand) : Executor(files, settings, suppressions, errorLogger) + , mExecuteCommand(std::move(executeCommand)) { assert(mSettings.jobs > 1); } @@ -272,7 +273,7 @@ unsigned int ProcessExecutor::check() close(pipes[0]); PipeWriter pipewriter(pipes[1]); - CppCheck fileChecker(pipewriter, false, CppCheckExecutor::executeCommand); + CppCheck fileChecker(pipewriter, false, mExecuteCommand); fileChecker.settings() = mSettings; unsigned int resultOfCheck = 0; @@ -306,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/cli/processexecutor.h b/cli/processexecutor.h index 580c344cfae..b7ee94dbe84 100644 --- a/cli/processexecutor.h +++ b/cli/processexecutor.h @@ -19,6 +19,7 @@ #ifndef PROCESSEXECUTOR_H #define PROCESSEXECUTOR_H +#include "cppcheck.h" #include "executor.h" #include @@ -38,7 +39,7 @@ class Suppressions; */ class ProcessExecutor : public Executor { public: - ProcessExecutor(const std::map &files, const Settings &settings, Suppressions &suppressions, ErrorLogger &errorLogger); + ProcessExecutor(const std::map &files, const Settings &settings, Suppressions &suppressions, ErrorLogger &errorLogger, CppCheck::ExecuteCmdFn executeCommand); ProcessExecutor(const ProcessExecutor &) = delete; void operator=(const ProcessExecutor &) = delete; @@ -63,6 +64,8 @@ class ProcessExecutor : public Executor { * @param msg The error message */ void reportInternalChildErr(const std::string &childname, const std::string &msg); + + CppCheck::ExecuteCmdFn mExecuteCommand; }; /// @} diff --git a/cli/threadexecutor.cpp b/cli/threadexecutor.cpp index aeffe9362df..a52b535c72c 100644 --- a/cli/threadexecutor.cpp +++ b/cli/threadexecutor.cpp @@ -41,8 +41,9 @@ enum class Color; -ThreadExecutor::ThreadExecutor(const std::map &files, const Settings &settings, Suppressions &suppressions, ErrorLogger &errorLogger) +ThreadExecutor::ThreadExecutor(const std::map &files, const Settings &settings, Suppressions &suppressions, ErrorLogger &errorLogger, CppCheck::ExecuteCmdFn executeCommand) : Executor(files, settings, suppressions, errorLogger) + , mExecuteCommand(std::move(executeCommand)) { assert(mSettings.jobs > 1); } @@ -82,8 +83,8 @@ class SyncLogForwarder : public ErrorLogger class ThreadData { public: - ThreadData(ThreadExecutor &threadExecutor, ErrorLogger &errorLogger, const Settings &settings, const std::map &files, const std::list &fileSettings) - : mFiles(files), mFileSettings(fileSettings), mSettings(settings), logForwarder(threadExecutor, errorLogger) + ThreadData(ThreadExecutor &threadExecutor, ErrorLogger &errorLogger, const Settings &settings, const std::map &files, const std::list &fileSettings, CppCheck::ExecuteCmdFn executeCommand) + : mFiles(files), mFileSettings(fileSettings), mSettings(settings), mExecuteCommand(std::move(executeCommand)), logForwarder(threadExecutor, errorLogger) { mItNextFile = mFiles.begin(); mItNextFileSettings = mFileSettings.begin(); @@ -115,7 +116,7 @@ class ThreadData } unsigned int check(ErrorLogger &errorLogger, const std::string *file, const ImportProject::FileSettings *fs) const { - CppCheck fileChecker(errorLogger, false, CppCheckExecutor::executeCommand); + CppCheck fileChecker(errorLogger, false, mExecuteCommand); fileChecker.settings() = mSettings; // this is a copy unsigned int result; @@ -153,6 +154,7 @@ class ThreadData std::mutex mFileSync; const Settings &mSettings; + CppCheck::ExecuteCmdFn mExecuteCommand; public: SyncLogForwarder logForwarder; @@ -180,7 +182,7 @@ unsigned int ThreadExecutor::check() std::vector> threadFutures; threadFutures.reserve(mSettings.jobs); - ThreadData data(*this, mErrorLogger, mSettings, mFiles, mSettings.project.fileSettings); + ThreadData data(*this, mErrorLogger, mSettings, mFiles, mSettings.project.fileSettings, mExecuteCommand); for (unsigned int i = 0; i < mSettings.jobs; ++i) { try { diff --git a/cli/threadexecutor.h b/cli/threadexecutor.h index 8ebae323b5b..52de732d9d4 100644 --- a/cli/threadexecutor.h +++ b/cli/threadexecutor.h @@ -19,6 +19,7 @@ #ifndef THREADEXECUTOR_H #define THREADEXECUTOR_H +#include "cppcheck.h" #include "executor.h" #include @@ -37,14 +38,16 @@ class Suppressions; * all files using threads. */ class ThreadExecutor : public Executor { + friend class SyncLogForwarder; + public: - ThreadExecutor(const std::map &files, const Settings &settings, Suppressions &suppressions, ErrorLogger &errorLogger); + ThreadExecutor(const std::map &files, const Settings &settings, Suppressions &suppressions, ErrorLogger &errorLogger, CppCheck::ExecuteCmdFn executeCommand); ThreadExecutor(const ThreadExecutor &) = delete; void operator=(const ThreadExecutor &) = delete; unsigned int check() override; - friend class SyncLogForwarder; + CppCheck::ExecuteCmdFn mExecuteCommand; }; /// @} diff --git a/gui/cppchecklibrarydata.cpp b/gui/cppchecklibrarydata.cpp index 23291e5da1a..5911d6fc43d 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 07fc2a81107..2ccf9d93ba3 100644 --- a/gui/cppchecklibrarydata.h +++ b/gui/cppchecklibrarydata.h @@ -58,10 +58,10 @@ class CppcheckLibraryData { 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 @@ class CppcheckLibraryData { 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 @@ class CppcheckLibraryData { QString name; }; - QList alloc; - QList dealloc; + QList alloc; + QList dealloc; QStringList use; }; @@ -176,7 +176,7 @@ class CppcheckLibraryData { QString name; }; - QList calls; + QList calls; }; struct Markup { @@ -244,18 +244,18 @@ class CppcheckLibraryData { 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/gui/mainwindow.cpp b/gui/mainwindow.cpp index 5f0d740b199..2cacb1810f1 100644 --- a/gui/mainwindow.cpp +++ b/gui/mainwindow.cpp @@ -1747,6 +1747,9 @@ void MainWindow::analyzeProject(const ProjectFile *projectFile, const bool check case ImportProject::Type::FAILURE: errorMessage = tr("Failed to import project file"); break; + case ImportProject::Type::NONE: + // can never happen + break; } if (!errorMessage.isEmpty()) { diff --git a/gui/projectfile.cpp b/gui/projectfile.cpp index 49f7157f8fb..a0bd1881006 100644 --- a/gui/projectfile.cpp +++ b/gui/projectfile.cpp @@ -248,7 +248,7 @@ bool ProjectFile::read(const QString &filename) return projectTagFound; } -void ProjectFile::readRootPath(QXmlStreamReader &reader) +void ProjectFile::readRootPath(const QXmlStreamReader &reader) { QXmlStreamAttributes attribs = reader.attributes(); QString name = attribs.value(QString(), CppcheckXml::RootPathNameAttrib).toString(); diff --git a/gui/projectfile.h b/gui/projectfile.h index 50d87ea5663..f9b3663060a 100644 --- a/gui/projectfile.h +++ b/gui/projectfile.h @@ -426,7 +426,7 @@ class ProjectFile : public QObject { * @brief Read optional root path from XML. * @param reader XML stream reader. */ - void readRootPath(QXmlStreamReader &reader); + void readRootPath(const QXmlStreamReader &reader); void readBuildDir(QXmlStreamReader &reader); diff --git a/gui/resultstree.cpp b/gui/resultstree.cpp index 3870fd64cf0..f0cfdab78d9 100644 --- a/gui/resultstree.cpp +++ b/gui/resultstree.cpp @@ -721,7 +721,7 @@ void ResultsTree::contextMenuEvent(QContextMenuEvent * e) } } -void ResultsTree::startApplication(QStandardItem *target, int application) +void ResultsTree::startApplication(const QStandardItem *target, int application) { //If there are no applications specified, tell the user about it if (mApplications->getApplicationCount() == 0) { @@ -1132,7 +1132,7 @@ void ResultsTree::quickStartApplication(const QModelIndex &index) startApplication(mModel.itemFromIndex(index)); } -QString ResultsTree::getFilePath(QStandardItem *target, bool fullPath) +QString ResultsTree::getFilePath(const QStandardItem *target, bool fullPath) { if (target) { // Make sure we are working with the first column diff --git a/gui/resultstree.h b/gui/resultstree.h index 8a8a79642b4..23f7053b33a 100644 --- a/gui/resultstree.h +++ b/gui/resultstree.h @@ -344,7 +344,7 @@ protected slots: * @param application Index of the application to open with. Giving -1 * (default value) will open the default application. */ - void startApplication(QStandardItem *target, int application = -1); + void startApplication(const QStandardItem *target, int application = -1); /** * @brief Helper function returning the filename/full path of the error tree item \a target. @@ -352,7 +352,7 @@ protected slots: * @param target The error tree item containing the filename/full path * @param fullPath Whether or not to retrieve the full path or only the filename. */ - static QString getFilePath(QStandardItem *target, bool fullPath); + static QString getFilePath(const QStandardItem *target, bool fullPath); /** * @brief Context menu event (user right clicked on the tree) diff --git a/gui/test/projectfile/testprojectfile.cpp b/gui/test/projectfile/testprojectfile.cpp index 65531aa0fa3..572219710d0 100644 --- a/gui/test/projectfile/testprojectfile.cpp +++ b/gui/test/projectfile/testprojectfile.cpp @@ -41,7 +41,6 @@ const char Settings::SafeChecks::XmlInternalFunctions[] = "internal-functions"; const char Settings::SafeChecks::XmlExternalVariables[] = "external-variables"; Settings::Settings() : maxCtuDepth(10) {} cppcheck::Platform::Platform() = default; -ImportProject::ImportProject() = default; bool ImportProject::sourceFileExists(const std::string & /*file*/) { return true; } diff --git a/gui/threadhandler.cpp b/gui/threadhandler.cpp index 6e99afe0488..b6fd53d251f 100644 --- a/gui/threadhandler.cpp +++ b/gui/threadhandler.cpp @@ -194,7 +194,7 @@ void ThreadHandler::stop() } } -void ThreadHandler::initialize(ResultsView *view) +void ThreadHandler::initialize(const ResultsView *view) { connect(&mResults, &ThreadResult::progress, view, &ResultsView::progress); diff --git a/gui/threadhandler.h b/gui/threadhandler.h index cdf2a6f0261..903999da582 100644 --- a/gui/threadhandler.h +++ b/gui/threadhandler.h @@ -64,7 +64,7 @@ class ThreadHandler : public QObject { * * @param view View to show error results */ - void initialize(ResultsView *view); + void initialize(const ResultsView *view); /** * @brief Load settings diff --git a/gui/xmlreportv2.cpp b/gui/xmlreportv2.cpp index e6b199398f2..152f3127e1e 100644 --- a/gui/xmlreportv2.cpp +++ b/gui/xmlreportv2.cpp @@ -196,7 +196,7 @@ QList XmlReportV2::read() return errors; } -ErrorItem XmlReportV2::readError(QXmlStreamReader *reader) +ErrorItem XmlReportV2::readError(const QXmlStreamReader *reader) { /* Error example from the core program in xml diff --git a/gui/xmlreportv2.h b/gui/xmlreportv2.h index e09e64692c9..d8ac04f7773 100644 --- a/gui/xmlreportv2.h +++ b/gui/xmlreportv2.h @@ -79,7 +79,7 @@ class XmlReportV2 : public XmlReport { * @brief Read and parse error item from XML stream. * @param reader XML stream reader to use. */ - ErrorItem readError(QXmlStreamReader *reader); + ErrorItem readError(const QXmlStreamReader *reader); private: /** diff --git a/lib/check64bit.cpp b/lib/check64bit.cpp index dc9ba26ec99..c87bb204837 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 c6eae27c483..a96191288c2 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 49613c06914..d3a84229ac6 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 a8d7eef9ade..9fa5f797b45 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 a77eddc16d0..2c404e8312e 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 4110426f130..2c6aae00c2a 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 778b4c1c299..416885a5e14 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 91250e8b707..eb8d57a39e2 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 c49527d1fdd..059ca614f76 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 dd611356df8..48989986898 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 0010d54a795..6c0110b6640 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 c0ddd639c75..d321cb69cad 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 945c0cbc0e1..b1684a1d72d 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 530ebbc846f..f1f8abae0f6 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 a8ab5b0f565..8b33b49b590 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 247f8b926a3..446c8731e86 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 70d90763d58..e5e35385e0d 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 f3598412f62..f2431fce3d7 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 0e83c22518b..bc87ff2a597 100644 --- a/lib/fwdanalysis.h +++ b/lib/fwdanalysis.h @@ -79,8 +79,8 @@ class FwdAnalysis { 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 571676520ca..e212f9dbfce 100644 --- a/lib/importproject.cpp +++ b/lib/importproject.cpp @@ -42,11 +42,6 @@ #include "json.h" -ImportProject::ImportProject() -{ - projectType = Type::UNKNOWN; -} - void ImportProject::ignorePaths(const std::vector &ipaths) { for (std::list::iterator it = fileSettings.begin(); it != fileSettings.end();) { @@ -402,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/importproject.h b/lib/importproject.h index 8ccf95c8ac9..46abbda9dda 100644 --- a/lib/importproject.h +++ b/lib/importproject.h @@ -51,6 +51,7 @@ class Settings; class CPPCHECKLIB ImportProject { public: enum class Type { + NONE, UNKNOWN, MISSING, FAILURE, @@ -82,9 +83,9 @@ class CPPCHECKLIB ImportProject { void setIncludePaths(const std::string &basepath, const std::list &in, std::map &variables); }; std::list fileSettings; - Type projectType; + Type projectType{Type::NONE}; - ImportProject(); + ImportProject() = default; virtual ~ImportProject() = default; ImportProject(const ImportProject&) = default; ImportProject& operator=(const ImportProject&) = default; diff --git a/lib/library.cpp b/lib/library.cpp index 201bd1e3854..d8786660382 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 c9107993946..11be46e8c83 100644 --- a/lib/library.h +++ b/lib/library.h @@ -54,8 +54,8 @@ class CPPCHECKLIB Library { // TODO: get rid of this friend class TestSymbolDatabase; // For testing only friend class TestSingleExecutorBase; // For testing only - friend class TestThreadExecutor; // For testing only - friend class TestProcessExecutor; // For testing only + friend class TestThreadExecutorBase; // For testing only + friend class TestProcessExecutorBase; // For testing only public: Library() = default; @@ -439,8 +439,8 @@ class CPPCHECKLIB Library { 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 @@ class CPPCHECKLIB Library { 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 @@ class CPPCHECKLIB Library { 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/programmemory.cpp b/lib/programmemory.cpp index 9ea08ca0a26..79524745d73 100644 --- a/lib/programmemory.cpp +++ b/lib/programmemory.cpp @@ -386,7 +386,7 @@ static void fillProgramMemoryFromAssignments(ProgramMemory& pm, const Token* tok if (Token::simpleMatch(tok2->previous(), "else {")) tok2 = tok2->linkAt(-2)->previous(); } - if (tok2->str() == "}") { + if (tok2->str() == "}" && !Token::Match(tok2->link()->previous(), "%var% {")) { const Token *cond = getCondTokFromEnd(tok2); const bool inElse = Token::simpleMatch(tok2->link()->previous(), "else {"); if (cond) { diff --git a/lib/symboldatabase.h b/lib/symboldatabase.h index cb929a6534d..d9aba94eba7 100644 --- a/lib/symboldatabase.h +++ b/lib/symboldatabase.h @@ -1251,18 +1251,18 @@ class CPPCHECKLIB ValueType { 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 69a56d168af..78a176e9e5f 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 bc409d18ceb..a42f72b57a9 100644 --- a/lib/timer.h +++ b/lib/timer.h @@ -63,7 +63,7 @@ class CPPCHECKLIB TimerResults : public TimerResultsIntf { void reset(); private: - std::map mResults; + std::map mResults; mutable std::mutex mResultsSync; }; diff --git a/lib/token.cpp b/lib/token.cpp index 02f2852343c..a395b4b55e6 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 6c291e7da75..7e319e4de15 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/lib/valueflow.cpp b/lib/valueflow.cpp index 9b60a5003ee..c71e93ee660 100644 --- a/lib/valueflow.cpp +++ b/lib/valueflow.cpp @@ -1857,7 +1857,7 @@ static void valueFlowImpossibleValues(TokenList& tokenList, const Settings* sett std::vector values; for (const Token* tok2 : tokens) { if (tok2->hasKnownIntValue()) { - values.emplace_back(); + values.emplace_back(tok2->values().front()); } else { ValueFlow::Value symValue{}; symValue.valueType = ValueFlow::Value::ValueType::SYMBOLIC; diff --git a/releasenotes.txt b/releasenotes.txt index 80455123a04..bda7ad1364b 100644 --- a/releasenotes.txt +++ b/releasenotes.txt @@ -20,3 +20,5 @@ Other: - The undocumented and deprecated command-line options `--template