Move Suppressions class to own source files.
I want to use Suppressions class also in GUI. And that is easier to do when it is not internal class of Settings class. And in general is it more natural that Settings class only contains list of suppressions and implementation is separate.
This commit is contained in:
parent
8c1efe9bb6
commit
716679ec7d
138
Makefile
138
Makefile
|
@ -71,6 +71,7 @@ LIBOBJ = lib/check64bit.o \
|
||||||
lib/path.o \
|
lib/path.o \
|
||||||
lib/preprocessor.o \
|
lib/preprocessor.o \
|
||||||
lib/settings.o \
|
lib/settings.o \
|
||||||
|
lib/suppressions.o \
|
||||||
lib/symboldatabase.o \
|
lib/symboldatabase.o \
|
||||||
lib/timer.o \
|
lib/timer.o \
|
||||||
lib/token.o \
|
lib/token.o \
|
||||||
|
@ -110,7 +111,6 @@ TESTOBJ = test/options.o \
|
||||||
test/testpostfixoperator.o \
|
test/testpostfixoperator.o \
|
||||||
test/testpreprocessor.o \
|
test/testpreprocessor.o \
|
||||||
test/testrunner.o \
|
test/testrunner.o \
|
||||||
test/testsettings.o \
|
|
||||||
test/testsimplifytokens.o \
|
test/testsimplifytokens.o \
|
||||||
test/teststl.o \
|
test/teststl.o \
|
||||||
test/testsuite.o \
|
test/testsuite.o \
|
||||||
|
@ -172,58 +172,58 @@ install: cppcheck
|
||||||
|
|
||||||
###### Build
|
###### Build
|
||||||
|
|
||||||
lib/check64bit.o: lib/check64bit.cpp lib/check64bit.h lib/check.h lib/token.h lib/tokenize.h lib/settings.h lib/errorlogger.h lib/symboldatabase.h lib/mathlib.h
|
lib/check64bit.o: lib/check64bit.cpp lib/check64bit.h lib/check.h lib/token.h lib/tokenize.h lib/settings.h lib/suppressions.h lib/errorlogger.h lib/symboldatabase.h lib/mathlib.h
|
||||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_LIB} -c -o lib/check64bit.o lib/check64bit.cpp
|
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_LIB} -c -o lib/check64bit.o lib/check64bit.cpp
|
||||||
|
|
||||||
lib/checkassignif.o: lib/checkassignif.cpp lib/checkassignif.h lib/check.h lib/token.h lib/tokenize.h lib/settings.h lib/errorlogger.h lib/symboldatabase.h lib/mathlib.h
|
lib/checkassignif.o: lib/checkassignif.cpp lib/checkassignif.h lib/check.h lib/token.h lib/tokenize.h lib/settings.h lib/suppressions.h lib/errorlogger.h lib/symboldatabase.h lib/mathlib.h
|
||||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_LIB} -c -o lib/checkassignif.o lib/checkassignif.cpp
|
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_LIB} -c -o lib/checkassignif.o lib/checkassignif.cpp
|
||||||
|
|
||||||
lib/checkautovariables.o: lib/checkautovariables.cpp lib/checkautovariables.h lib/check.h lib/token.h lib/tokenize.h lib/settings.h lib/errorlogger.h lib/symboldatabase.h lib/mathlib.h
|
lib/checkautovariables.o: lib/checkautovariables.cpp lib/checkautovariables.h lib/check.h lib/token.h lib/tokenize.h lib/settings.h lib/suppressions.h lib/errorlogger.h lib/symboldatabase.h lib/mathlib.h
|
||||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_LIB} -c -o lib/checkautovariables.o lib/checkautovariables.cpp
|
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_LIB} -c -o lib/checkautovariables.o lib/checkautovariables.cpp
|
||||||
|
|
||||||
lib/checkbufferoverrun.o: lib/checkbufferoverrun.cpp lib/checkbufferoverrun.h lib/check.h lib/token.h lib/tokenize.h lib/settings.h lib/errorlogger.h lib/mathlib.h lib/symboldatabase.h lib/executionpath.h
|
lib/checkbufferoverrun.o: lib/checkbufferoverrun.cpp lib/checkbufferoverrun.h lib/check.h lib/token.h lib/tokenize.h lib/settings.h lib/suppressions.h lib/errorlogger.h lib/mathlib.h lib/symboldatabase.h lib/executionpath.h
|
||||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_LIB} -c -o lib/checkbufferoverrun.o lib/checkbufferoverrun.cpp
|
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_LIB} -c -o lib/checkbufferoverrun.o lib/checkbufferoverrun.cpp
|
||||||
|
|
||||||
lib/checkclass.o: lib/checkclass.cpp lib/checkclass.h lib/check.h lib/token.h lib/tokenize.h lib/settings.h lib/errorlogger.h lib/symboldatabase.h lib/mathlib.h
|
lib/checkclass.o: lib/checkclass.cpp lib/checkclass.h lib/check.h lib/token.h lib/tokenize.h lib/settings.h lib/suppressions.h lib/errorlogger.h lib/symboldatabase.h lib/mathlib.h
|
||||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_LIB} -c -o lib/checkclass.o lib/checkclass.cpp
|
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_LIB} -c -o lib/checkclass.o lib/checkclass.cpp
|
||||||
|
|
||||||
lib/checkexceptionsafety.o: lib/checkexceptionsafety.cpp lib/checkexceptionsafety.h lib/check.h lib/token.h lib/tokenize.h lib/settings.h lib/errorlogger.h
|
lib/checkexceptionsafety.o: lib/checkexceptionsafety.cpp lib/checkexceptionsafety.h lib/check.h lib/token.h lib/tokenize.h lib/settings.h lib/suppressions.h lib/errorlogger.h
|
||||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_LIB} -c -o lib/checkexceptionsafety.o lib/checkexceptionsafety.cpp
|
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_LIB} -c -o lib/checkexceptionsafety.o lib/checkexceptionsafety.cpp
|
||||||
|
|
||||||
lib/checkmemoryleak.o: lib/checkmemoryleak.cpp lib/checkmemoryleak.h lib/check.h lib/token.h lib/tokenize.h lib/settings.h lib/errorlogger.h lib/symboldatabase.h lib/mathlib.h lib/executionpath.h lib/checkuninitvar.h
|
lib/checkmemoryleak.o: lib/checkmemoryleak.cpp lib/checkmemoryleak.h lib/check.h lib/token.h lib/tokenize.h lib/settings.h lib/suppressions.h lib/errorlogger.h lib/symboldatabase.h lib/mathlib.h lib/executionpath.h lib/checkuninitvar.h
|
||||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_LIB} -c -o lib/checkmemoryleak.o lib/checkmemoryleak.cpp
|
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_LIB} -c -o lib/checkmemoryleak.o lib/checkmemoryleak.cpp
|
||||||
|
|
||||||
lib/checknonreentrantfunctions.o: lib/checknonreentrantfunctions.cpp lib/checknonreentrantfunctions.h lib/check.h lib/token.h lib/tokenize.h lib/settings.h lib/errorlogger.h
|
lib/checknonreentrantfunctions.o: lib/checknonreentrantfunctions.cpp lib/checknonreentrantfunctions.h lib/check.h lib/token.h lib/tokenize.h lib/settings.h lib/suppressions.h lib/errorlogger.h
|
||||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_LIB} -c -o lib/checknonreentrantfunctions.o lib/checknonreentrantfunctions.cpp
|
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_LIB} -c -o lib/checknonreentrantfunctions.o lib/checknonreentrantfunctions.cpp
|
||||||
|
|
||||||
lib/checknullpointer.o: lib/checknullpointer.cpp lib/checknullpointer.h lib/check.h lib/token.h lib/tokenize.h lib/settings.h lib/errorlogger.h lib/executionpath.h lib/mathlib.h lib/symboldatabase.h
|
lib/checknullpointer.o: lib/checknullpointer.cpp lib/checknullpointer.h lib/check.h lib/token.h lib/tokenize.h lib/settings.h lib/suppressions.h lib/errorlogger.h lib/executionpath.h lib/mathlib.h lib/symboldatabase.h
|
||||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_LIB} -c -o lib/checknullpointer.o lib/checknullpointer.cpp
|
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_LIB} -c -o lib/checknullpointer.o lib/checknullpointer.cpp
|
||||||
|
|
||||||
lib/checkobsoletefunctions.o: lib/checkobsoletefunctions.cpp lib/checkobsoletefunctions.h lib/check.h lib/token.h lib/tokenize.h lib/settings.h lib/errorlogger.h
|
lib/checkobsoletefunctions.o: lib/checkobsoletefunctions.cpp lib/checkobsoletefunctions.h lib/check.h lib/token.h lib/tokenize.h lib/settings.h lib/suppressions.h lib/errorlogger.h
|
||||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_LIB} -c -o lib/checkobsoletefunctions.o lib/checkobsoletefunctions.cpp
|
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_LIB} -c -o lib/checkobsoletefunctions.o lib/checkobsoletefunctions.cpp
|
||||||
|
|
||||||
lib/checkother.o: lib/checkother.cpp lib/checkother.h lib/check.h lib/token.h lib/tokenize.h lib/settings.h lib/errorlogger.h lib/mathlib.h lib/symboldatabase.h
|
lib/checkother.o: lib/checkother.cpp lib/checkother.h lib/check.h lib/token.h lib/tokenize.h lib/settings.h lib/suppressions.h lib/errorlogger.h lib/mathlib.h lib/symboldatabase.h
|
||||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_LIB} -c -o lib/checkother.o lib/checkother.cpp
|
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_LIB} -c -o lib/checkother.o lib/checkother.cpp
|
||||||
|
|
||||||
lib/checkpostfixoperator.o: lib/checkpostfixoperator.cpp lib/checkpostfixoperator.h lib/check.h lib/token.h lib/tokenize.h lib/settings.h lib/errorlogger.h lib/symboldatabase.h lib/mathlib.h
|
lib/checkpostfixoperator.o: lib/checkpostfixoperator.cpp lib/checkpostfixoperator.h lib/check.h lib/token.h lib/tokenize.h lib/settings.h lib/suppressions.h lib/errorlogger.h lib/symboldatabase.h lib/mathlib.h
|
||||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_LIB} -c -o lib/checkpostfixoperator.o lib/checkpostfixoperator.cpp
|
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_LIB} -c -o lib/checkpostfixoperator.o lib/checkpostfixoperator.cpp
|
||||||
|
|
||||||
lib/checkstl.o: lib/checkstl.cpp lib/checkstl.h lib/check.h lib/token.h lib/tokenize.h lib/settings.h lib/errorlogger.h lib/executionpath.h lib/symboldatabase.h lib/mathlib.h
|
lib/checkstl.o: lib/checkstl.cpp lib/checkstl.h lib/check.h lib/token.h lib/tokenize.h lib/settings.h lib/suppressions.h lib/errorlogger.h lib/executionpath.h lib/symboldatabase.h lib/mathlib.h
|
||||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_LIB} -c -o lib/checkstl.o lib/checkstl.cpp
|
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_LIB} -c -o lib/checkstl.o lib/checkstl.cpp
|
||||||
|
|
||||||
lib/checkuninitvar.o: lib/checkuninitvar.cpp lib/checkuninitvar.h lib/check.h lib/token.h lib/tokenize.h lib/settings.h lib/errorlogger.h lib/mathlib.h lib/executionpath.h lib/checknullpointer.h
|
lib/checkuninitvar.o: lib/checkuninitvar.cpp lib/checkuninitvar.h lib/check.h lib/token.h lib/tokenize.h lib/settings.h lib/suppressions.h lib/errorlogger.h lib/mathlib.h lib/executionpath.h lib/checknullpointer.h
|
||||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_LIB} -c -o lib/checkuninitvar.o lib/checkuninitvar.cpp
|
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_LIB} -c -o lib/checkuninitvar.o lib/checkuninitvar.cpp
|
||||||
|
|
||||||
lib/checkunusedfunctions.o: lib/checkunusedfunctions.cpp lib/checkunusedfunctions.h lib/check.h lib/token.h lib/tokenize.h lib/settings.h lib/errorlogger.h
|
lib/checkunusedfunctions.o: lib/checkunusedfunctions.cpp lib/checkunusedfunctions.h lib/check.h lib/token.h lib/tokenize.h lib/settings.h lib/suppressions.h lib/errorlogger.h
|
||||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_LIB} -c -o lib/checkunusedfunctions.o lib/checkunusedfunctions.cpp
|
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_LIB} -c -o lib/checkunusedfunctions.o lib/checkunusedfunctions.cpp
|
||||||
|
|
||||||
lib/checkunusedvar.o: lib/checkunusedvar.cpp lib/checkunusedvar.h lib/check.h lib/token.h lib/tokenize.h lib/settings.h lib/errorlogger.h lib/mathlib.h lib/symboldatabase.h
|
lib/checkunusedvar.o: lib/checkunusedvar.cpp lib/checkunusedvar.h lib/check.h lib/token.h lib/tokenize.h lib/settings.h lib/suppressions.h lib/errorlogger.h lib/symboldatabase.h lib/mathlib.h
|
||||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_LIB} -c -o lib/checkunusedvar.o lib/checkunusedvar.cpp
|
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_LIB} -c -o lib/checkunusedvar.o lib/checkunusedvar.cpp
|
||||||
|
|
||||||
lib/cppcheck.o: lib/cppcheck.cpp lib/cppcheck.h lib/settings.h lib/errorlogger.h lib/checkunusedfunctions.h lib/check.h lib/token.h lib/tokenize.h lib/preprocessor.h lib/path.h lib/timer.h
|
lib/cppcheck.o: lib/cppcheck.cpp lib/cppcheck.h lib/settings.h lib/suppressions.h lib/errorlogger.h lib/checkunusedfunctions.h lib/check.h lib/token.h lib/tokenize.h lib/preprocessor.h lib/path.h lib/timer.h
|
||||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_LIB} -c -o lib/cppcheck.o lib/cppcheck.cpp
|
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_LIB} -c -o lib/cppcheck.o lib/cppcheck.cpp
|
||||||
|
|
||||||
lib/errorlogger.o: lib/errorlogger.cpp lib/errorlogger.h lib/settings.h lib/path.h lib/cppcheck.h lib/checkunusedfunctions.h lib/check.h lib/token.h lib/tokenize.h
|
lib/errorlogger.o: lib/errorlogger.cpp lib/errorlogger.h lib/settings.h lib/suppressions.h lib/path.h lib/cppcheck.h lib/checkunusedfunctions.h lib/check.h lib/token.h lib/tokenize.h
|
||||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_LIB} -c -o lib/errorlogger.o lib/errorlogger.cpp
|
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_LIB} -c -o lib/errorlogger.o lib/errorlogger.cpp
|
||||||
|
|
||||||
lib/executionpath.o: lib/executionpath.cpp lib/executionpath.h lib/token.h
|
lib/executionpath.o: lib/executionpath.cpp lib/executionpath.h lib/token.h
|
||||||
|
@ -235,159 +235,159 @@ lib/mathlib.o: lib/mathlib.cpp lib/mathlib.h lib/tokenize.h
|
||||||
lib/path.o: lib/path.cpp lib/path.h
|
lib/path.o: lib/path.cpp lib/path.h
|
||||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_LIB} -c -o lib/path.o lib/path.cpp
|
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_LIB} -c -o lib/path.o lib/path.cpp
|
||||||
|
|
||||||
lib/preprocessor.o: lib/preprocessor.cpp lib/preprocessor.h lib/tokenize.h lib/token.h lib/path.h lib/errorlogger.h lib/settings.h
|
lib/preprocessor.o: lib/preprocessor.cpp lib/preprocessor.h lib/tokenize.h lib/token.h lib/path.h lib/errorlogger.h lib/settings.h lib/suppressions.h
|
||||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_LIB} -c -o lib/preprocessor.o lib/preprocessor.cpp
|
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_LIB} -c -o lib/preprocessor.o lib/preprocessor.cpp
|
||||||
|
|
||||||
lib/settings.o: lib/settings.cpp lib/settings.h lib/path.h
|
lib/settings.o: lib/settings.cpp lib/settings.h lib/suppressions.h lib/path.h
|
||||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_LIB} -c -o lib/settings.o lib/settings.cpp
|
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_LIB} -c -o lib/settings.o lib/settings.cpp
|
||||||
|
|
||||||
lib/symboldatabase.o: lib/symboldatabase.cpp lib/symboldatabase.h lib/token.h lib/mathlib.h lib/tokenize.h lib/settings.h lib/errorlogger.h lib/check.h
|
lib/suppressions.o: lib/suppressions.cpp lib/suppressions.h lib/settings.h lib/path.h
|
||||||
|
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_LIB} -c -o lib/suppressions.o lib/suppressions.cpp
|
||||||
|
|
||||||
|
lib/symboldatabase.o: lib/symboldatabase.cpp lib/symboldatabase.h lib/token.h lib/mathlib.h lib/tokenize.h lib/settings.h lib/suppressions.h lib/errorlogger.h lib/check.h
|
||||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_LIB} -c -o lib/symboldatabase.o lib/symboldatabase.cpp
|
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_LIB} -c -o lib/symboldatabase.o lib/symboldatabase.cpp
|
||||||
|
|
||||||
lib/timer.o: lib/timer.cpp lib/timer.h
|
lib/timer.o: lib/timer.cpp lib/timer.h
|
||||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_LIB} -c -o lib/timer.o lib/timer.cpp
|
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_LIB} -c -o lib/timer.o lib/timer.cpp
|
||||||
|
|
||||||
lib/token.o: lib/token.cpp lib/token.h lib/errorlogger.h lib/settings.h lib/check.h lib/tokenize.h
|
lib/token.o: lib/token.cpp lib/token.h lib/errorlogger.h lib/settings.h lib/suppressions.h lib/check.h lib/tokenize.h
|
||||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_LIB} -c -o lib/token.o lib/token.cpp
|
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_LIB} -c -o lib/token.o lib/token.cpp
|
||||||
|
|
||||||
lib/tokenize.o: lib/tokenize.cpp lib/tokenize.h lib/token.h lib/mathlib.h lib/settings.h lib/errorlogger.h lib/check.h lib/path.h lib/symboldatabase.h
|
lib/tokenize.o: lib/tokenize.cpp lib/tokenize.h lib/token.h lib/mathlib.h lib/settings.h lib/suppressions.h lib/errorlogger.h lib/check.h lib/path.h lib/symboldatabase.h
|
||||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_LIB} -c -o lib/tokenize.o lib/tokenize.cpp
|
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_LIB} -c -o lib/tokenize.o lib/tokenize.cpp
|
||||||
|
|
||||||
cli/cmdlineparser.o: cli/cmdlineparser.cpp lib/cppcheck.h lib/settings.h lib/errorlogger.h lib/checkunusedfunctions.h lib/check.h lib/token.h lib/tokenize.h lib/timer.h cli/cmdlineparser.h lib/path.h cli/filelister.h
|
cli/cmdlineparser.o: cli/cmdlineparser.cpp lib/cppcheck.h lib/settings.h lib/suppressions.h lib/errorlogger.h lib/checkunusedfunctions.h lib/check.h lib/token.h lib/tokenize.h lib/timer.h cli/cmdlineparser.h lib/path.h cli/filelister.h
|
||||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_CLI} -c -o cli/cmdlineparser.o cli/cmdlineparser.cpp
|
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_CLI} -c -o cli/cmdlineparser.o cli/cmdlineparser.cpp
|
||||||
|
|
||||||
cli/cppcheckexecutor.o: cli/cppcheckexecutor.cpp cli/cppcheckexecutor.h lib/errorlogger.h lib/settings.h lib/cppcheck.h lib/checkunusedfunctions.h lib/check.h lib/token.h lib/tokenize.h cli/threadexecutor.h lib/preprocessor.h cli/cmdlineparser.h cli/filelister.h lib/path.h cli/pathmatch.h
|
cli/cppcheckexecutor.o: cli/cppcheckexecutor.cpp cli/cppcheckexecutor.h lib/errorlogger.h lib/settings.h lib/suppressions.h lib/cppcheck.h lib/checkunusedfunctions.h lib/check.h lib/token.h lib/tokenize.h cli/threadexecutor.h lib/preprocessor.h cli/cmdlineparser.h cli/filelister.h lib/path.h cli/pathmatch.h
|
||||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_CLI} -c -o cli/cppcheckexecutor.o cli/cppcheckexecutor.cpp
|
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_CLI} -c -o cli/cppcheckexecutor.o cli/cppcheckexecutor.cpp
|
||||||
|
|
||||||
cli/filelister.o: cli/filelister.cpp cli/filelister.h lib/path.h
|
cli/filelister.o: cli/filelister.cpp cli/filelister.h lib/path.h
|
||||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_CLI} -c -o cli/filelister.o cli/filelister.cpp
|
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_CLI} -c -o cli/filelister.o cli/filelister.cpp
|
||||||
|
|
||||||
cli/main.o: cli/main.cpp cli/cppcheckexecutor.h lib/errorlogger.h lib/settings.h
|
cli/main.o: cli/main.cpp cli/cppcheckexecutor.h lib/errorlogger.h lib/settings.h lib/suppressions.h
|
||||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_CLI} -c -o cli/main.o cli/main.cpp
|
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_CLI} -c -o cli/main.o cli/main.cpp
|
||||||
|
|
||||||
cli/pathmatch.o: cli/pathmatch.cpp cli/pathmatch.h
|
cli/pathmatch.o: cli/pathmatch.cpp cli/pathmatch.h
|
||||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_CLI} -c -o cli/pathmatch.o cli/pathmatch.cpp
|
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_CLI} -c -o cli/pathmatch.o cli/pathmatch.cpp
|
||||||
|
|
||||||
cli/threadexecutor.o: cli/threadexecutor.cpp cli/cppcheckexecutor.h lib/errorlogger.h lib/settings.h cli/threadexecutor.h lib/cppcheck.h lib/checkunusedfunctions.h lib/check.h lib/token.h lib/tokenize.h
|
cli/threadexecutor.o: cli/threadexecutor.cpp cli/cppcheckexecutor.h lib/errorlogger.h lib/settings.h lib/suppressions.h cli/threadexecutor.h lib/cppcheck.h lib/checkunusedfunctions.h lib/check.h lib/token.h lib/tokenize.h
|
||||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_CLI} -c -o cli/threadexecutor.o cli/threadexecutor.cpp
|
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_CLI} -c -o cli/threadexecutor.o cli/threadexecutor.cpp
|
||||||
|
|
||||||
test/options.o: test/options.cpp test/options.h
|
test/options.o: test/options.cpp test/options.h
|
||||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_TEST} -c -o test/options.o test/options.cpp
|
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_TEST} -c -o test/options.o test/options.cpp
|
||||||
|
|
||||||
test/test64bit.o: test/test64bit.cpp lib/tokenize.h lib/check64bit.h lib/check.h lib/token.h lib/settings.h lib/errorlogger.h test/testsuite.h test/redirect.h
|
test/test64bit.o: test/test64bit.cpp lib/tokenize.h lib/check64bit.h lib/check.h lib/token.h lib/settings.h lib/suppressions.h lib/errorlogger.h test/testsuite.h test/redirect.h
|
||||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_TEST} -c -o test/test64bit.o test/test64bit.cpp
|
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_TEST} -c -o test/test64bit.o test/test64bit.cpp
|
||||||
|
|
||||||
test/testassignif.o: test/testassignif.cpp lib/tokenize.h lib/checkassignif.h lib/check.h lib/token.h lib/settings.h lib/errorlogger.h test/testsuite.h test/redirect.h
|
test/testassignif.o: test/testassignif.cpp lib/tokenize.h lib/checkassignif.h lib/check.h lib/token.h lib/settings.h lib/suppressions.h lib/errorlogger.h test/testsuite.h test/redirect.h
|
||||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_TEST} -c -o test/testassignif.o test/testassignif.cpp
|
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_TEST} -c -o test/testassignif.o test/testassignif.cpp
|
||||||
|
|
||||||
test/testautovariables.o: test/testautovariables.cpp lib/tokenize.h lib/checkautovariables.h lib/check.h lib/token.h lib/settings.h lib/errorlogger.h test/testsuite.h test/redirect.h
|
test/testautovariables.o: test/testautovariables.cpp lib/tokenize.h lib/checkautovariables.h lib/check.h lib/token.h lib/settings.h lib/suppressions.h lib/errorlogger.h test/testsuite.h test/redirect.h
|
||||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_TEST} -c -o test/testautovariables.o test/testautovariables.cpp
|
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_TEST} -c -o test/testautovariables.o test/testautovariables.cpp
|
||||||
|
|
||||||
test/testbufferoverrun.o: test/testbufferoverrun.cpp lib/tokenize.h lib/checkbufferoverrun.h lib/check.h lib/token.h lib/settings.h lib/errorlogger.h lib/mathlib.h test/testsuite.h test/redirect.h
|
test/testbufferoverrun.o: test/testbufferoverrun.cpp lib/tokenize.h lib/checkbufferoverrun.h lib/check.h lib/token.h lib/settings.h lib/suppressions.h lib/errorlogger.h lib/mathlib.h test/testsuite.h test/redirect.h
|
||||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_TEST} -c -o test/testbufferoverrun.o test/testbufferoverrun.cpp
|
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_TEST} -c -o test/testbufferoverrun.o test/testbufferoverrun.cpp
|
||||||
|
|
||||||
test/testcharvar.o: test/testcharvar.cpp lib/tokenize.h lib/checkother.h lib/check.h lib/token.h lib/settings.h lib/errorlogger.h test/testsuite.h test/redirect.h
|
test/testcharvar.o: test/testcharvar.cpp lib/tokenize.h lib/checkother.h lib/check.h lib/token.h lib/settings.h lib/suppressions.h lib/errorlogger.h test/testsuite.h test/redirect.h
|
||||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_TEST} -c -o test/testcharvar.o test/testcharvar.cpp
|
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_TEST} -c -o test/testcharvar.o test/testcharvar.cpp
|
||||||
|
|
||||||
test/testclass.o: test/testclass.cpp lib/tokenize.h lib/checkclass.h lib/check.h lib/token.h lib/settings.h lib/errorlogger.h lib/symboldatabase.h lib/mathlib.h test/testsuite.h test/redirect.h
|
test/testclass.o: test/testclass.cpp lib/tokenize.h lib/checkclass.h lib/check.h lib/token.h lib/settings.h lib/suppressions.h lib/errorlogger.h lib/symboldatabase.h lib/mathlib.h test/testsuite.h test/redirect.h
|
||||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_TEST} -c -o test/testclass.o test/testclass.cpp
|
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_TEST} -c -o test/testclass.o test/testclass.cpp
|
||||||
|
|
||||||
test/testcmdlineparser.o: test/testcmdlineparser.cpp test/testsuite.h lib/errorlogger.h lib/settings.h test/redirect.h
|
test/testcmdlineparser.o: test/testcmdlineparser.cpp test/testsuite.h lib/errorlogger.h lib/settings.h lib/suppressions.h test/redirect.h
|
||||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_TEST} -c -o test/testcmdlineparser.o test/testcmdlineparser.cpp
|
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_TEST} -c -o test/testcmdlineparser.o test/testcmdlineparser.cpp
|
||||||
|
|
||||||
test/testconstructors.o: test/testconstructors.cpp lib/tokenize.h lib/checkclass.h lib/check.h lib/token.h lib/settings.h lib/errorlogger.h lib/symboldatabase.h lib/mathlib.h test/testsuite.h test/redirect.h
|
test/testconstructors.o: test/testconstructors.cpp lib/tokenize.h lib/checkclass.h lib/check.h lib/token.h lib/settings.h lib/suppressions.h lib/errorlogger.h lib/symboldatabase.h lib/mathlib.h test/testsuite.h test/redirect.h
|
||||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_TEST} -c -o test/testconstructors.o test/testconstructors.cpp
|
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_TEST} -c -o test/testconstructors.o test/testconstructors.cpp
|
||||||
|
|
||||||
test/testcppcheck.o: test/testcppcheck.cpp lib/cppcheck.h lib/settings.h lib/errorlogger.h lib/checkunusedfunctions.h lib/check.h lib/token.h lib/tokenize.h test/testsuite.h test/redirect.h lib/path.h
|
test/testcppcheck.o: test/testcppcheck.cpp lib/cppcheck.h lib/settings.h lib/suppressions.h lib/errorlogger.h lib/checkunusedfunctions.h lib/check.h lib/token.h lib/tokenize.h test/testsuite.h test/redirect.h lib/path.h
|
||||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_TEST} -c -o test/testcppcheck.o test/testcppcheck.cpp
|
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_TEST} -c -o test/testcppcheck.o test/testcppcheck.cpp
|
||||||
|
|
||||||
test/testdivision.o: test/testdivision.cpp lib/tokenize.h lib/checkother.h lib/check.h lib/token.h lib/settings.h lib/errorlogger.h test/testsuite.h test/redirect.h
|
test/testdivision.o: test/testdivision.cpp lib/tokenize.h lib/checkother.h lib/check.h lib/token.h lib/settings.h lib/suppressions.h lib/errorlogger.h test/testsuite.h test/redirect.h
|
||||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_TEST} -c -o test/testdivision.o test/testdivision.cpp
|
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_TEST} -c -o test/testdivision.o test/testdivision.cpp
|
||||||
|
|
||||||
test/testerrorlogger.o: test/testerrorlogger.cpp lib/cppcheck.h lib/settings.h lib/errorlogger.h lib/checkunusedfunctions.h lib/check.h lib/token.h lib/tokenize.h test/testsuite.h test/redirect.h
|
test/testerrorlogger.o: test/testerrorlogger.cpp lib/cppcheck.h lib/settings.h lib/suppressions.h lib/errorlogger.h lib/checkunusedfunctions.h lib/check.h lib/token.h lib/tokenize.h test/testsuite.h test/redirect.h
|
||||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_TEST} -c -o test/testerrorlogger.o test/testerrorlogger.cpp
|
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_TEST} -c -o test/testerrorlogger.o test/testerrorlogger.cpp
|
||||||
|
|
||||||
test/testexceptionsafety.o: test/testexceptionsafety.cpp lib/tokenize.h lib/checkexceptionsafety.h lib/check.h lib/token.h lib/settings.h lib/errorlogger.h test/testsuite.h test/redirect.h
|
test/testexceptionsafety.o: test/testexceptionsafety.cpp lib/tokenize.h lib/checkexceptionsafety.h lib/check.h lib/token.h lib/settings.h lib/suppressions.h lib/errorlogger.h test/testsuite.h test/redirect.h
|
||||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_TEST} -c -o test/testexceptionsafety.o test/testexceptionsafety.cpp
|
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_TEST} -c -o test/testexceptionsafety.o test/testexceptionsafety.cpp
|
||||||
|
|
||||||
test/testfilelister.o: test/testfilelister.cpp test/testsuite.h lib/errorlogger.h lib/settings.h test/redirect.h
|
test/testfilelister.o: test/testfilelister.cpp test/testsuite.h lib/errorlogger.h lib/settings.h lib/suppressions.h test/redirect.h
|
||||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_TEST} -c -o test/testfilelister.o test/testfilelister.cpp
|
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_TEST} -c -o test/testfilelister.o test/testfilelister.cpp
|
||||||
|
|
||||||
test/testincompletestatement.o: test/testincompletestatement.cpp test/testsuite.h lib/errorlogger.h lib/settings.h test/redirect.h lib/tokenize.h lib/checkother.h lib/check.h lib/token.h
|
test/testincompletestatement.o: test/testincompletestatement.cpp test/testsuite.h lib/errorlogger.h lib/settings.h lib/suppressions.h test/redirect.h lib/tokenize.h lib/checkother.h lib/check.h lib/token.h
|
||||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_TEST} -c -o test/testincompletestatement.o test/testincompletestatement.cpp
|
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_TEST} -c -o test/testincompletestatement.o test/testincompletestatement.cpp
|
||||||
|
|
||||||
test/testmathlib.o: test/testmathlib.cpp lib/mathlib.h test/testsuite.h lib/errorlogger.h lib/settings.h test/redirect.h
|
test/testmathlib.o: test/testmathlib.cpp lib/mathlib.h test/testsuite.h lib/errorlogger.h lib/settings.h lib/suppressions.h test/redirect.h
|
||||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_TEST} -c -o test/testmathlib.o test/testmathlib.cpp
|
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_TEST} -c -o test/testmathlib.o test/testmathlib.cpp
|
||||||
|
|
||||||
test/testmemleak.o: test/testmemleak.cpp lib/tokenize.h lib/checkmemoryleak.h lib/check.h lib/token.h lib/settings.h lib/errorlogger.h lib/symboldatabase.h lib/mathlib.h test/testsuite.h test/redirect.h
|
test/testmemleak.o: test/testmemleak.cpp lib/tokenize.h lib/checkmemoryleak.h lib/check.h lib/token.h lib/settings.h lib/suppressions.h lib/errorlogger.h lib/symboldatabase.h lib/mathlib.h test/testsuite.h test/redirect.h
|
||||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_TEST} -c -o test/testmemleak.o test/testmemleak.cpp
|
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_TEST} -c -o test/testmemleak.o test/testmemleak.cpp
|
||||||
|
|
||||||
test/testnonreentrantfunctions.o: test/testnonreentrantfunctions.cpp lib/tokenize.h lib/checknonreentrantfunctions.h lib/check.h lib/token.h lib/settings.h lib/errorlogger.h test/testsuite.h test/redirect.h
|
test/testnonreentrantfunctions.o: test/testnonreentrantfunctions.cpp lib/tokenize.h lib/checknonreentrantfunctions.h lib/check.h lib/token.h lib/settings.h lib/suppressions.h lib/errorlogger.h test/testsuite.h test/redirect.h
|
||||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_TEST} -c -o test/testnonreentrantfunctions.o test/testnonreentrantfunctions.cpp
|
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_TEST} -c -o test/testnonreentrantfunctions.o test/testnonreentrantfunctions.cpp
|
||||||
|
|
||||||
test/testnullpointer.o: test/testnullpointer.cpp lib/tokenize.h lib/checknullpointer.h lib/check.h lib/token.h lib/settings.h lib/errorlogger.h test/testsuite.h test/redirect.h
|
test/testnullpointer.o: test/testnullpointer.cpp lib/tokenize.h lib/checknullpointer.h lib/check.h lib/token.h lib/settings.h lib/suppressions.h lib/errorlogger.h test/testsuite.h test/redirect.h
|
||||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_TEST} -c -o test/testnullpointer.o test/testnullpointer.cpp
|
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_TEST} -c -o test/testnullpointer.o test/testnullpointer.cpp
|
||||||
|
|
||||||
test/testobsoletefunctions.o: test/testobsoletefunctions.cpp lib/tokenize.h lib/checkobsoletefunctions.h lib/check.h lib/token.h lib/settings.h lib/errorlogger.h test/testsuite.h test/redirect.h
|
test/testobsoletefunctions.o: test/testobsoletefunctions.cpp lib/tokenize.h lib/checkobsoletefunctions.h lib/check.h lib/token.h lib/settings.h lib/suppressions.h lib/errorlogger.h test/testsuite.h test/redirect.h
|
||||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_TEST} -c -o test/testobsoletefunctions.o test/testobsoletefunctions.cpp
|
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_TEST} -c -o test/testobsoletefunctions.o test/testobsoletefunctions.cpp
|
||||||
|
|
||||||
test/testoptions.o: test/testoptions.cpp test/options.h test/testsuite.h lib/errorlogger.h lib/settings.h test/redirect.h
|
test/testoptions.o: test/testoptions.cpp test/options.h test/testsuite.h lib/errorlogger.h lib/settings.h lib/suppressions.h test/redirect.h
|
||||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_TEST} -c -o test/testoptions.o test/testoptions.cpp
|
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_TEST} -c -o test/testoptions.o test/testoptions.cpp
|
||||||
|
|
||||||
test/testother.o: test/testother.cpp lib/preprocessor.h lib/tokenize.h lib/checkother.h lib/check.h lib/token.h lib/settings.h lib/errorlogger.h test/testsuite.h test/redirect.h
|
test/testother.o: test/testother.cpp lib/preprocessor.h lib/tokenize.h lib/checkother.h lib/check.h lib/token.h lib/settings.h lib/suppressions.h lib/errorlogger.h test/testsuite.h test/redirect.h
|
||||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_TEST} -c -o test/testother.o test/testother.cpp
|
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_TEST} -c -o test/testother.o test/testother.cpp
|
||||||
|
|
||||||
test/testpath.o: test/testpath.cpp test/testsuite.h lib/errorlogger.h lib/settings.h test/redirect.h lib/path.h
|
test/testpath.o: test/testpath.cpp test/testsuite.h lib/errorlogger.h lib/settings.h lib/suppressions.h test/redirect.h lib/path.h
|
||||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_TEST} -c -o test/testpath.o test/testpath.cpp
|
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_TEST} -c -o test/testpath.o test/testpath.cpp
|
||||||
|
|
||||||
test/testpathmatch.o: test/testpathmatch.cpp test/testsuite.h lib/errorlogger.h lib/settings.h test/redirect.h
|
test/testpathmatch.o: test/testpathmatch.cpp test/testsuite.h lib/errorlogger.h lib/settings.h lib/suppressions.h test/redirect.h
|
||||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_TEST} -c -o test/testpathmatch.o test/testpathmatch.cpp
|
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_TEST} -c -o test/testpathmatch.o test/testpathmatch.cpp
|
||||||
|
|
||||||
test/testpostfixoperator.o: test/testpostfixoperator.cpp lib/tokenize.h lib/checkpostfixoperator.h lib/check.h lib/token.h lib/settings.h lib/errorlogger.h test/testsuite.h test/redirect.h
|
test/testpostfixoperator.o: test/testpostfixoperator.cpp lib/tokenize.h lib/checkpostfixoperator.h lib/check.h lib/token.h lib/settings.h lib/suppressions.h lib/errorlogger.h test/testsuite.h test/redirect.h
|
||||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_TEST} -c -o test/testpostfixoperator.o test/testpostfixoperator.cpp
|
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_TEST} -c -o test/testpostfixoperator.o test/testpostfixoperator.cpp
|
||||||
|
|
||||||
test/testpreprocessor.o: test/testpreprocessor.cpp test/testsuite.h lib/errorlogger.h lib/settings.h test/redirect.h lib/preprocessor.h lib/tokenize.h lib/token.h
|
test/testpreprocessor.o: test/testpreprocessor.cpp test/testsuite.h lib/errorlogger.h lib/settings.h lib/suppressions.h test/redirect.h lib/preprocessor.h lib/tokenize.h lib/token.h
|
||||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_TEST} -c -o test/testpreprocessor.o test/testpreprocessor.cpp
|
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_TEST} -c -o test/testpreprocessor.o test/testpreprocessor.cpp
|
||||||
|
|
||||||
test/testrunner.o: test/testrunner.cpp test/testsuite.h lib/errorlogger.h lib/settings.h test/redirect.h test/options.h
|
test/testrunner.o: test/testrunner.cpp test/testsuite.h lib/errorlogger.h lib/settings.h lib/suppressions.h test/redirect.h test/options.h
|
||||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_TEST} -c -o test/testrunner.o test/testrunner.cpp
|
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_TEST} -c -o test/testrunner.o test/testrunner.cpp
|
||||||
|
|
||||||
test/testsettings.o: test/testsettings.cpp lib/settings.h test/testsuite.h lib/errorlogger.h test/redirect.h
|
test/testsimplifytokens.o: test/testsimplifytokens.cpp test/testsuite.h lib/errorlogger.h lib/settings.h lib/suppressions.h test/redirect.h lib/tokenize.h lib/token.h
|
||||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_TEST} -c -o test/testsettings.o test/testsettings.cpp
|
|
||||||
|
|
||||||
test/testsimplifytokens.o: test/testsimplifytokens.cpp test/testsuite.h lib/errorlogger.h lib/settings.h test/redirect.h lib/tokenize.h lib/token.h
|
|
||||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_TEST} -c -o test/testsimplifytokens.o test/testsimplifytokens.cpp
|
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_TEST} -c -o test/testsimplifytokens.o test/testsimplifytokens.cpp
|
||||||
|
|
||||||
test/teststl.o: test/teststl.cpp lib/tokenize.h lib/checkstl.h lib/check.h lib/token.h lib/settings.h lib/errorlogger.h test/testsuite.h test/redirect.h
|
test/teststl.o: test/teststl.cpp lib/tokenize.h lib/checkstl.h lib/check.h lib/token.h lib/settings.h lib/suppressions.h lib/errorlogger.h test/testsuite.h test/redirect.h
|
||||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_TEST} -c -o test/teststl.o test/teststl.cpp
|
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_TEST} -c -o test/teststl.o test/teststl.cpp
|
||||||
|
|
||||||
test/testsuite.o: test/testsuite.cpp test/testsuite.h lib/errorlogger.h lib/settings.h test/redirect.h test/options.h
|
test/testsuite.o: test/testsuite.cpp test/testsuite.h lib/errorlogger.h lib/settings.h lib/suppressions.h test/redirect.h test/options.h
|
||||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_TEST} -c -o test/testsuite.o test/testsuite.cpp
|
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_TEST} -c -o test/testsuite.o test/testsuite.cpp
|
||||||
|
|
||||||
test/testsuppressions.o: test/testsuppressions.cpp lib/cppcheck.h lib/settings.h lib/errorlogger.h lib/checkunusedfunctions.h lib/check.h lib/token.h lib/tokenize.h test/testsuite.h test/redirect.h
|
test/testsuppressions.o: test/testsuppressions.cpp lib/cppcheck.h lib/settings.h lib/suppressions.h lib/errorlogger.h lib/checkunusedfunctions.h lib/check.h lib/token.h lib/tokenize.h test/testsuite.h test/redirect.h
|
||||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_TEST} -c -o test/testsuppressions.o test/testsuppressions.cpp
|
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_TEST} -c -o test/testsuppressions.o test/testsuppressions.cpp
|
||||||
|
|
||||||
test/testsymboldatabase.o: test/testsymboldatabase.cpp test/testsuite.h lib/errorlogger.h lib/settings.h test/redirect.h test/testutils.h lib/tokenize.h lib/token.h lib/symboldatabase.h lib/mathlib.h
|
test/testsymboldatabase.o: test/testsymboldatabase.cpp test/testsuite.h lib/errorlogger.h lib/settings.h lib/suppressions.h test/redirect.h test/testutils.h lib/tokenize.h lib/token.h lib/symboldatabase.h lib/mathlib.h
|
||||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_TEST} -c -o test/testsymboldatabase.o test/testsymboldatabase.cpp
|
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_TEST} -c -o test/testsymboldatabase.o test/testsymboldatabase.cpp
|
||||||
|
|
||||||
test/testthreadexecutor.o: test/testthreadexecutor.cpp lib/cppcheck.h lib/settings.h lib/errorlogger.h lib/checkunusedfunctions.h lib/check.h lib/token.h lib/tokenize.h test/testsuite.h test/redirect.h
|
test/testthreadexecutor.o: test/testthreadexecutor.cpp lib/cppcheck.h lib/settings.h lib/suppressions.h lib/errorlogger.h lib/checkunusedfunctions.h lib/check.h lib/token.h lib/tokenize.h test/testsuite.h test/redirect.h
|
||||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_TEST} -c -o test/testthreadexecutor.o test/testthreadexecutor.cpp
|
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_TEST} -c -o test/testthreadexecutor.o test/testthreadexecutor.cpp
|
||||||
|
|
||||||
test/testtoken.o: test/testtoken.cpp test/testsuite.h lib/errorlogger.h lib/settings.h test/redirect.h test/testutils.h lib/tokenize.h lib/token.h
|
test/testtoken.o: test/testtoken.cpp test/testsuite.h lib/errorlogger.h lib/settings.h lib/suppressions.h test/redirect.h test/testutils.h lib/tokenize.h lib/token.h
|
||||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_TEST} -c -o test/testtoken.o test/testtoken.cpp
|
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_TEST} -c -o test/testtoken.o test/testtoken.cpp
|
||||||
|
|
||||||
test/testtokenize.o: test/testtokenize.cpp test/testsuite.h lib/errorlogger.h lib/settings.h test/redirect.h lib/tokenize.h lib/token.h
|
test/testtokenize.o: test/testtokenize.cpp test/testsuite.h lib/errorlogger.h lib/settings.h lib/suppressions.h test/redirect.h lib/tokenize.h lib/token.h
|
||||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_TEST} -c -o test/testtokenize.o test/testtokenize.cpp
|
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_TEST} -c -o test/testtokenize.o test/testtokenize.cpp
|
||||||
|
|
||||||
test/testuninitvar.o: test/testuninitvar.cpp lib/tokenize.h lib/checkuninitvar.h lib/check.h lib/token.h lib/settings.h lib/errorlogger.h test/testsuite.h test/redirect.h
|
test/testuninitvar.o: test/testuninitvar.cpp lib/tokenize.h lib/checkuninitvar.h lib/check.h lib/token.h lib/settings.h lib/suppressions.h lib/errorlogger.h test/testsuite.h test/redirect.h
|
||||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_TEST} -c -o test/testuninitvar.o test/testuninitvar.cpp
|
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_TEST} -c -o test/testuninitvar.o test/testuninitvar.cpp
|
||||||
|
|
||||||
test/testunusedfunctions.o: test/testunusedfunctions.cpp lib/tokenize.h test/testsuite.h lib/errorlogger.h lib/settings.h test/redirect.h lib/checkunusedfunctions.h lib/check.h lib/token.h
|
test/testunusedfunctions.o: test/testunusedfunctions.cpp lib/tokenize.h test/testsuite.h lib/errorlogger.h lib/settings.h lib/suppressions.h test/redirect.h lib/checkunusedfunctions.h lib/check.h lib/token.h
|
||||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_TEST} -c -o test/testunusedfunctions.o test/testunusedfunctions.cpp
|
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_TEST} -c -o test/testunusedfunctions.o test/testunusedfunctions.cpp
|
||||||
|
|
||||||
test/testunusedprivfunc.o: test/testunusedprivfunc.cpp lib/tokenize.h lib/checkclass.h lib/check.h lib/token.h lib/settings.h lib/errorlogger.h lib/symboldatabase.h lib/mathlib.h test/testsuite.h test/redirect.h
|
test/testunusedprivfunc.o: test/testunusedprivfunc.cpp lib/tokenize.h lib/checkclass.h lib/check.h lib/token.h lib/settings.h lib/suppressions.h lib/errorlogger.h lib/symboldatabase.h lib/mathlib.h test/testsuite.h test/redirect.h
|
||||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_TEST} -c -o test/testunusedprivfunc.o test/testunusedprivfunc.cpp
|
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_TEST} -c -o test/testunusedprivfunc.o test/testunusedprivfunc.cpp
|
||||||
|
|
||||||
test/testunusedvar.o: test/testunusedvar.cpp test/testsuite.h lib/errorlogger.h lib/settings.h test/redirect.h lib/tokenize.h lib/checkother.h lib/check.h lib/token.h
|
test/testunusedvar.o: test/testunusedvar.cpp test/testsuite.h lib/errorlogger.h lib/settings.h lib/suppressions.h test/redirect.h lib/tokenize.h lib/checkunusedvar.h lib/check.h lib/token.h
|
||||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_TEST} -c -o test/testunusedvar.o test/testunusedvar.cpp
|
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_TEST} -c -o test/testunusedvar.o test/testunusedvar.cpp
|
||||||
|
|
||||||
|
|
|
@ -313,9 +313,9 @@ std::string ErrorLogger::ErrorMessage::toString(bool verbose, const std::string
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ErrorLogger::reportUnmatchedSuppressions(const std::list<Settings::Suppressions::SuppressionEntry> &unmatched)
|
void ErrorLogger::reportUnmatchedSuppressions(const std::list<Suppressions::SuppressionEntry> &unmatched)
|
||||||
{
|
{
|
||||||
for (std::list<Settings::Suppressions::SuppressionEntry>::const_iterator i = unmatched.begin(); i != unmatched.end(); ++i)
|
for (std::list<Suppressions::SuppressionEntry>::const_iterator i = unmatched.begin(); i != unmatched.end(); ++i)
|
||||||
{
|
{
|
||||||
std::list<ErrorLogger::ErrorMessage::FileLocation> callStack;
|
std::list<ErrorLogger::ErrorMessage::FileLocation> callStack;
|
||||||
callStack.push_back(ErrorLogger::ErrorMessage::FileLocation(i->file, i->line));
|
callStack.push_back(ErrorLogger::ErrorMessage::FileLocation(i->file, i->line));
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
|
#include "suppressions.h"
|
||||||
|
|
||||||
class Token;
|
class Token;
|
||||||
class Tokenizer;
|
class Tokenizer;
|
||||||
|
@ -289,7 +290,7 @@ public:
|
||||||
* Report list of unmatched suppressions
|
* Report list of unmatched suppressions
|
||||||
* @param unmatched list of unmatched suppressions (from Settings::Suppressions::getUnmatched(Local|Global)Suppressions)
|
* @param unmatched list of unmatched suppressions (from Settings::Suppressions::getUnmatched(Local|Global)Suppressions)
|
||||||
*/
|
*/
|
||||||
void reportUnmatchedSuppressions(const std::list<Settings::Suppressions::SuppressionEntry> &unmatched);
|
void reportUnmatchedSuppressions(const std::list<Suppressions::SuppressionEntry> &unmatched);
|
||||||
|
|
||||||
static std::string callStackToString(const std::list<ErrorLogger::ErrorMessage::FileLocation> &callStack);
|
static std::string callStackToString(const std::list<ErrorLogger::ErrorMessage::FileLocation> &callStack);
|
||||||
};
|
};
|
||||||
|
|
|
@ -26,6 +26,7 @@ HEADERS += $${BASEPATH}check.h \
|
||||||
$${BASEPATH}path.h \
|
$${BASEPATH}path.h \
|
||||||
$${BASEPATH}preprocessor.h \
|
$${BASEPATH}preprocessor.h \
|
||||||
$${BASEPATH}settings.h \
|
$${BASEPATH}settings.h \
|
||||||
|
$${BASEPATH}suppressions.h \
|
||||||
$${BASEPATH}symboldatabase.h \
|
$${BASEPATH}symboldatabase.h \
|
||||||
$${BASEPATH}timer.h \
|
$${BASEPATH}timer.h \
|
||||||
$${BASEPATH}token.h \
|
$${BASEPATH}token.h \
|
||||||
|
@ -54,6 +55,7 @@ SOURCES += $${BASEPATH}check64bit.cpp \
|
||||||
$${BASEPATH}path.cpp \
|
$${BASEPATH}path.cpp \
|
||||||
$${BASEPATH}preprocessor.cpp \
|
$${BASEPATH}preprocessor.cpp \
|
||||||
$${BASEPATH}settings.cpp \
|
$${BASEPATH}settings.cpp \
|
||||||
|
$${BASEPATH}suppressions.cpp \
|
||||||
$${BASEPATH}symboldatabase.cpp \
|
$${BASEPATH}symboldatabase.cpp \
|
||||||
$${BASEPATH}timer.cpp \
|
$${BASEPATH}timer.cpp \
|
||||||
$${BASEPATH}token.cpp \
|
$${BASEPATH}token.cpp \
|
||||||
|
|
314
lib/settings.cpp
314
lib/settings.cpp
|
@ -52,320 +52,6 @@ Settings::Settings()
|
||||||
posix = false;
|
posix = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string Settings::Suppressions::parseFile(std::istream &istr)
|
|
||||||
{
|
|
||||||
// Change '\r' to '\n' in the istr
|
|
||||||
std::string filedata;
|
|
||||||
std::string line;
|
|
||||||
while (std::getline(istr, line))
|
|
||||||
filedata += line + "\n";
|
|
||||||
while (filedata.find("\r") != std::string::npos)
|
|
||||||
filedata[filedata.find("\r")] = '\n';
|
|
||||||
|
|
||||||
// Parse filedata..
|
|
||||||
std::istringstream istr2(filedata);
|
|
||||||
while (std::getline(istr2, line))
|
|
||||||
{
|
|
||||||
// Skip empty lines
|
|
||||||
if (line.empty())
|
|
||||||
continue;
|
|
||||||
|
|
||||||
// Skip comments
|
|
||||||
if (line.length() >= 2 && line[0] == '/' && line[1] == '/')
|
|
||||||
continue;
|
|
||||||
|
|
||||||
const std::string errmsg(addSuppressionLine(line));
|
|
||||||
if (!errmsg.empty())
|
|
||||||
return errmsg;
|
|
||||||
}
|
|
||||||
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string Settings::Suppressions::addSuppressionLine(const std::string &line)
|
|
||||||
{
|
|
||||||
std::istringstream lineStream(line);
|
|
||||||
std::string id;
|
|
||||||
std::string file;
|
|
||||||
unsigned int lineNumber = 0;
|
|
||||||
if (std::getline(lineStream, id, ':'))
|
|
||||||
{
|
|
||||||
if (std::getline(lineStream, file))
|
|
||||||
{
|
|
||||||
// If there is not a dot after the last colon in "file" then
|
|
||||||
// the colon is a separator and the contents after the colon
|
|
||||||
// is a line number..
|
|
||||||
|
|
||||||
// Get position of last colon
|
|
||||||
const std::string::size_type pos = file.rfind(":");
|
|
||||||
|
|
||||||
// if a colon is found and there is no dot after it..
|
|
||||||
if (pos != std::string::npos &&
|
|
||||||
file.find(".", pos) == std::string::npos)
|
|
||||||
{
|
|
||||||
// Try to parse out the line number
|
|
||||||
try
|
|
||||||
{
|
|
||||||
std::istringstream istr1(file.substr(pos+1));
|
|
||||||
istr1 >> lineNumber;
|
|
||||||
}
|
|
||||||
catch (...)
|
|
||||||
{
|
|
||||||
lineNumber = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (lineNumber > 0)
|
|
||||||
{
|
|
||||||
file.erase(pos);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// We could perhaps check if the id is valid and return error if it is not
|
|
||||||
const std::string errmsg(addSuppression(id, file, lineNumber));
|
|
||||||
if (!errmsg.empty())
|
|
||||||
return errmsg;
|
|
||||||
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Settings::Suppressions::FileMatcher::match(const std::string &pattern, const std::string &name)
|
|
||||||
{
|
|
||||||
const char *p = pattern.c_str();
|
|
||||||
const char *n = name.c_str();
|
|
||||||
std::stack<std::pair<const char *, const char *> > backtrack;
|
|
||||||
|
|
||||||
for (;;)
|
|
||||||
{
|
|
||||||
bool matching = true;
|
|
||||||
while (*p != '\0' && matching)
|
|
||||||
{
|
|
||||||
switch (*p)
|
|
||||||
{
|
|
||||||
case '*':
|
|
||||||
// Step forward until we match the next character after *
|
|
||||||
while (*n != '\0' && *n != p[1])
|
|
||||||
{
|
|
||||||
n++;
|
|
||||||
}
|
|
||||||
if (*n != '\0')
|
|
||||||
{
|
|
||||||
// If this isn't the last possibility, save it for later
|
|
||||||
backtrack.push(std::make_pair(p, n));
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case '?':
|
|
||||||
// Any character matches unless we're at the end of the name
|
|
||||||
if (*n != '\0')
|
|
||||||
{
|
|
||||||
n++;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
matching = false;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
// Non-wildcard characters match literally
|
|
||||||
if (*n == *p)
|
|
||||||
{
|
|
||||||
n++;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
matching = false;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
p++;
|
|
||||||
}
|
|
||||||
|
|
||||||
// If we haven't failed matching and we've reached the end of the name, then success
|
|
||||||
if (matching && *n == '\0')
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// If there are no other paths to tray, then fail
|
|
||||||
if (backtrack.empty())
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Restore pointers from backtrack stack
|
|
||||||
p = backtrack.top().first;
|
|
||||||
n = backtrack.top().second;
|
|
||||||
backtrack.pop();
|
|
||||||
|
|
||||||
// Advance name pointer by one because the current position didn't work
|
|
||||||
n++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string Settings::Suppressions::FileMatcher::addFile(const std::string &name, unsigned int line)
|
|
||||||
{
|
|
||||||
if (name.find_first_of("*?") != std::string::npos)
|
|
||||||
{
|
|
||||||
for (std::string::const_iterator i = name.begin(); i != name.end(); ++i)
|
|
||||||
{
|
|
||||||
if (*i == '*')
|
|
||||||
{
|
|
||||||
std::string::const_iterator j = i + 1;
|
|
||||||
if (j != name.end() && (*j == '*' || *j == '?'))
|
|
||||||
{
|
|
||||||
return "Failed to add suppression. Syntax error in glob.";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_globs[name][line] = false;
|
|
||||||
}
|
|
||||||
else if (name.empty())
|
|
||||||
{
|
|
||||||
_globs["*"][0U] = false;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_files[Path::simplifyPath(name.c_str())][line] = false;
|
|
||||||
}
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Settings::Suppressions::FileMatcher::isSuppressed(const std::string &file, unsigned int line)
|
|
||||||
{
|
|
||||||
if (isSuppressedLocal(file, line))
|
|
||||||
return true;
|
|
||||||
|
|
||||||
for (std::map<std::string, std::map<unsigned int, bool> >::iterator g = _globs.begin(); g != _globs.end(); ++g)
|
|
||||||
{
|
|
||||||
if (match(g->first, file))
|
|
||||||
{
|
|
||||||
if (g->second.find(0U) != g->second.end())
|
|
||||||
{
|
|
||||||
g->second[0U] = true;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
std::map<unsigned int, bool>::iterator l = g->second.find(line);
|
|
||||||
if (l != g->second.end())
|
|
||||||
{
|
|
||||||
l->second = true;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Settings::Suppressions::FileMatcher::isSuppressedLocal(const std::string &file, unsigned int line)
|
|
||||||
{
|
|
||||||
std::map<std::string, std::map<unsigned int, bool> >::iterator f = _files.find(file);
|
|
||||||
if (f != _files.end())
|
|
||||||
{
|
|
||||||
if (f->second.find(0U) != f->second.end())
|
|
||||||
{
|
|
||||||
f->second[0U] = true;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
std::map<unsigned int, bool>::iterator l = f->second.find(line);
|
|
||||||
if (l != f->second.end())
|
|
||||||
{
|
|
||||||
l->second = true;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string Settings::Suppressions::addSuppression(const std::string &errorId, const std::string &file, unsigned int line)
|
|
||||||
{
|
|
||||||
// Check that errorId is valid..
|
|
||||||
if (errorId.empty())
|
|
||||||
{
|
|
||||||
return "Failed to add suppression. No id.";
|
|
||||||
}
|
|
||||||
if (errorId != "*")
|
|
||||||
{
|
|
||||||
for (std::string::size_type pos = 0; pos < errorId.length(); ++pos)
|
|
||||||
{
|
|
||||||
if (errorId[pos] < 0 || !std::isalnum(errorId[pos]))
|
|
||||||
{
|
|
||||||
return "Failed to add suppression. Invalid id \"" + errorId + "\"";
|
|
||||||
}
|
|
||||||
if (pos == 0 && std::isdigit(errorId[pos]))
|
|
||||||
{
|
|
||||||
return "Failed to add suppression. Invalid id \"" + errorId + "\"";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return _suppressions[errorId].addFile(file, line);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Settings::Suppressions::isSuppressed(const std::string &errorId, const std::string &file, unsigned int line)
|
|
||||||
{
|
|
||||||
if (errorId != "unmatchedSuppression" && _suppressions.find("*") != _suppressions.end())
|
|
||||||
if (_suppressions["*"].isSuppressed(file, line))
|
|
||||||
return true;
|
|
||||||
|
|
||||||
if (_suppressions.find(errorId) == _suppressions.end())
|
|
||||||
return false;
|
|
||||||
|
|
||||||
return _suppressions[errorId].isSuppressed(file, line);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Settings::Suppressions::isSuppressedLocal(const std::string &errorId, const std::string &file, unsigned int line)
|
|
||||||
{
|
|
||||||
if (errorId != "unmatchedSuppression" && _suppressions.find("*") != _suppressions.end())
|
|
||||||
if (_suppressions["*"].isSuppressedLocal(file, line))
|
|
||||||
return true;
|
|
||||||
|
|
||||||
if (_suppressions.find(errorId) == _suppressions.end())
|
|
||||||
return false;
|
|
||||||
|
|
||||||
return _suppressions[errorId].isSuppressedLocal(file, line);
|
|
||||||
}
|
|
||||||
|
|
||||||
std::list<Settings::Suppressions::SuppressionEntry> Settings::Suppressions::getUnmatchedLocalSuppressions(const std::string &file) const
|
|
||||||
{
|
|
||||||
std::list<SuppressionEntry> r;
|
|
||||||
for (std::map<std::string, FileMatcher>::const_iterator i = _suppressions.begin(); i != _suppressions.end(); ++i)
|
|
||||||
{
|
|
||||||
std::map<std::string, std::map<unsigned int, bool> >::const_iterator f = i->second._files.find(file);
|
|
||||||
if (f != i->second._files.end())
|
|
||||||
{
|
|
||||||
for (std::map<unsigned int, bool>::const_iterator l = f->second.begin(); l != f->second.end(); ++l)
|
|
||||||
{
|
|
||||||
if (!l->second)
|
|
||||||
{
|
|
||||||
r.push_back(SuppressionEntry(i->first, f->first, l->first));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::list<Settings::Suppressions::SuppressionEntry> Settings::Suppressions::getUnmatchedGlobalSuppressions() const
|
|
||||||
{
|
|
||||||
std::list<SuppressionEntry> r;
|
|
||||||
for (std::map<std::string, FileMatcher>::const_iterator i = _suppressions.begin(); i != _suppressions.end(); ++i)
|
|
||||||
{
|
|
||||||
for (std::map<std::string, std::map<unsigned int, bool> >::const_iterator g = i->second._globs.begin(); g != i->second._globs.end(); ++g)
|
|
||||||
{
|
|
||||||
for (std::map<unsigned int, bool>::const_iterator l = g->second.begin(); l != g->second.end(); ++l)
|
|
||||||
{
|
|
||||||
if (!l->second)
|
|
||||||
{
|
|
||||||
r.push_back(SuppressionEntry(i->first, g->first, l->first));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string Settings::addEnabled(const std::string &str)
|
std::string Settings::addEnabled(const std::string &str)
|
||||||
{
|
{
|
||||||
// Enable parameters may be comma separated...
|
// Enable parameters may be comma separated...
|
||||||
|
|
118
lib/settings.h
118
lib/settings.h
|
@ -22,8 +22,8 @@
|
||||||
#include <list>
|
#include <list>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <istream>
|
#include <istream>
|
||||||
#include <map>
|
|
||||||
#include <set>
|
#include <set>
|
||||||
|
#include "suppressions.h"
|
||||||
|
|
||||||
/// @addtogroup Core
|
/// @addtogroup Core
|
||||||
/// @{
|
/// @{
|
||||||
|
@ -140,122 +140,6 @@ public:
|
||||||
*/
|
*/
|
||||||
std::string addEnabled(const std::string &str);
|
std::string addEnabled(const std::string &str);
|
||||||
|
|
||||||
/** @brief class for handling suppressions */
|
|
||||||
class Suppressions
|
|
||||||
{
|
|
||||||
private:
|
|
||||||
class FileMatcher
|
|
||||||
{
|
|
||||||
friend class Suppressions;
|
|
||||||
private:
|
|
||||||
/** @brief List of filenames suppressed, bool flag indicates whether suppression matched. */
|
|
||||||
std::map<std::string, std::map<unsigned int, bool> > _files;
|
|
||||||
/** @brief List of globs suppressed, bool flag indicates whether suppression matched. */
|
|
||||||
std::map<std::string, std::map<unsigned int, bool> > _globs;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Match a name against a glob pattern.
|
|
||||||
* @param pattern The glob pattern to match.
|
|
||||||
* @param name The filename to match against the glob pattern.
|
|
||||||
* @return match success
|
|
||||||
*/
|
|
||||||
static bool match(const std::string &pattern, const std::string &name);
|
|
||||||
|
|
||||||
public:
|
|
||||||
/**
|
|
||||||
* @brief Add a file or glob (and line number).
|
|
||||||
* @param name File name or glob pattern
|
|
||||||
* @param line Line number
|
|
||||||
* @return error message. empty upon success
|
|
||||||
*/
|
|
||||||
std::string addFile(const std::string &name, unsigned int line);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Returns true if the file name matches a previously added file or glob pattern.
|
|
||||||
* @param file File name to check
|
|
||||||
* @param line Line number
|
|
||||||
* @return true if this filename/line matches
|
|
||||||
*/
|
|
||||||
bool isSuppressed(const std::string &file, unsigned int line);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Returns true if the file name matches a previously added file (only, not glob pattern).
|
|
||||||
* @param file File name to check
|
|
||||||
* @param line Line number
|
|
||||||
* @return true if this filename/line matches
|
|
||||||
*/
|
|
||||||
bool isSuppressedLocal(const std::string &file, unsigned int line);
|
|
||||||
};
|
|
||||||
|
|
||||||
/** @brief List of error which the user doesn't want to see. */
|
|
||||||
std::map<std::string, FileMatcher> _suppressions;
|
|
||||||
public:
|
|
||||||
/**
|
|
||||||
* @brief Don't show errors listed in the file.
|
|
||||||
* @param istr Open file stream where errors can be read.
|
|
||||||
* @return error message. empty upon success
|
|
||||||
*/
|
|
||||||
std::string parseFile(std::istream &istr);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Don't show the given error.
|
|
||||||
* @param line Description of error to suppress (in id:file:line format).
|
|
||||||
* @return error message. empty upon success
|
|
||||||
*/
|
|
||||||
std::string addSuppressionLine(const std::string &line);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Don't show this error. If file and/or line are optional. In which case
|
|
||||||
* the errorId alone is used for filtering.
|
|
||||||
* @param errorId the id for the error, e.g. "arrayIndexOutOfBounds"
|
|
||||||
* @param file File name with the path, e.g. "src/main.cpp"
|
|
||||||
* @param line number, e.g. "123"
|
|
||||||
* @return error message. empty upon success
|
|
||||||
*/
|
|
||||||
std::string addSuppression(const std::string &errorId, const std::string &file = "", unsigned int line = 0);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Returns true if this message should not be shown to the user.
|
|
||||||
* @param errorId the id for the error, e.g. "arrayIndexOutOfBounds"
|
|
||||||
* @param file File name with the path, e.g. "src/main.cpp"
|
|
||||||
* @param line number, e.g. "123"
|
|
||||||
* @return true if this error is suppressed.
|
|
||||||
*/
|
|
||||||
bool isSuppressed(const std::string &errorId, const std::string &file, unsigned int line);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Returns true if this message should not be shown to the user (explicit files only, not glob patterns).
|
|
||||||
* @param errorId the id for the error, e.g. "arrayIndexOutOfBounds"
|
|
||||||
* @param file File name with the path, e.g. "src/main.cpp"
|
|
||||||
* @param line number, e.g. "123"
|
|
||||||
* @return true if this error is suppressed.
|
|
||||||
*/
|
|
||||||
bool isSuppressedLocal(const std::string &errorId, const std::string &file, unsigned int line);
|
|
||||||
|
|
||||||
struct SuppressionEntry
|
|
||||||
{
|
|
||||||
SuppressionEntry(const std::string &aid, const std::string &afile, const unsigned int &aline)
|
|
||||||
: id(aid), file(afile), line(aline)
|
|
||||||
{ }
|
|
||||||
|
|
||||||
std::string id;
|
|
||||||
std::string file;
|
|
||||||
unsigned int line;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Returns list of unmatched local (per-file) suppressions.
|
|
||||||
* @return list of unmatched suppressions
|
|
||||||
*/
|
|
||||||
std::list<SuppressionEntry> getUnmatchedLocalSuppressions(const std::string &file) const;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Returns list of unmatched global (glob pattern) suppressions.
|
|
||||||
* @return list of unmatched suppressions
|
|
||||||
*/
|
|
||||||
std::list<SuppressionEntry> getUnmatchedGlobalSuppressions() const;
|
|
||||||
};
|
|
||||||
|
|
||||||
/** @brief suppress message (--suppressions) */
|
/** @brief suppress message (--suppressions) */
|
||||||
Suppressions nomsg;
|
Suppressions nomsg;
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,340 @@
|
||||||
|
/*
|
||||||
|
* Cppcheck - A tool for static C/C++ code analysis
|
||||||
|
* Copyright (C) 2007-2011 Daniel Marjamäki and Cppcheck team.
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "suppressions.h"
|
||||||
|
#include "settings.h"
|
||||||
|
#include "path.h"
|
||||||
|
|
||||||
|
#include <sstream>
|
||||||
|
#include <iostream>
|
||||||
|
#include <stack>
|
||||||
|
|
||||||
|
std::string Suppressions::parseFile(std::istream &istr)
|
||||||
|
{
|
||||||
|
// Change '\r' to '\n' in the istr
|
||||||
|
std::string filedata;
|
||||||
|
std::string line;
|
||||||
|
while (std::getline(istr, line))
|
||||||
|
filedata += line + "\n";
|
||||||
|
while (filedata.find("\r") != std::string::npos)
|
||||||
|
filedata[filedata.find("\r")] = '\n';
|
||||||
|
|
||||||
|
// Parse filedata..
|
||||||
|
std::istringstream istr2(filedata);
|
||||||
|
while (std::getline(istr2, line))
|
||||||
|
{
|
||||||
|
// Skip empty lines
|
||||||
|
if (line.empty())
|
||||||
|
continue;
|
||||||
|
|
||||||
|
// Skip comments
|
||||||
|
if (line.length() >= 2 && line[0] == '/' && line[1] == '/')
|
||||||
|
continue;
|
||||||
|
|
||||||
|
const std::string errmsg(addSuppressionLine(line));
|
||||||
|
if (!errmsg.empty())
|
||||||
|
return errmsg;
|
||||||
|
}
|
||||||
|
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string Suppressions::addSuppressionLine(const std::string &line)
|
||||||
|
{
|
||||||
|
std::istringstream lineStream(line);
|
||||||
|
std::string id;
|
||||||
|
std::string file;
|
||||||
|
unsigned int lineNumber = 0;
|
||||||
|
if (std::getline(lineStream, id, ':'))
|
||||||
|
{
|
||||||
|
if (std::getline(lineStream, file))
|
||||||
|
{
|
||||||
|
// If there is not a dot after the last colon in "file" then
|
||||||
|
// the colon is a separator and the contents after the colon
|
||||||
|
// is a line number..
|
||||||
|
|
||||||
|
// Get position of last colon
|
||||||
|
const std::string::size_type pos = file.rfind(":");
|
||||||
|
|
||||||
|
// if a colon is found and there is no dot after it..
|
||||||
|
if (pos != std::string::npos &&
|
||||||
|
file.find(".", pos) == std::string::npos)
|
||||||
|
{
|
||||||
|
// Try to parse out the line number
|
||||||
|
try
|
||||||
|
{
|
||||||
|
std::istringstream istr1(file.substr(pos+1));
|
||||||
|
istr1 >> lineNumber;
|
||||||
|
}
|
||||||
|
catch (...)
|
||||||
|
{
|
||||||
|
lineNumber = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (lineNumber > 0)
|
||||||
|
{
|
||||||
|
file.erase(pos);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// We could perhaps check if the id is valid and return error if it is not
|
||||||
|
const std::string errmsg(addSuppression(id, file, lineNumber));
|
||||||
|
if (!errmsg.empty())
|
||||||
|
return errmsg;
|
||||||
|
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Suppressions::FileMatcher::match(const std::string &pattern, const std::string &name)
|
||||||
|
{
|
||||||
|
const char *p = pattern.c_str();
|
||||||
|
const char *n = name.c_str();
|
||||||
|
std::stack<std::pair<const char *, const char *> > backtrack;
|
||||||
|
|
||||||
|
for (;;)
|
||||||
|
{
|
||||||
|
bool matching = true;
|
||||||
|
while (*p != '\0' && matching)
|
||||||
|
{
|
||||||
|
switch (*p)
|
||||||
|
{
|
||||||
|
case '*':
|
||||||
|
// Step forward until we match the next character after *
|
||||||
|
while (*n != '\0' && *n != p[1])
|
||||||
|
{
|
||||||
|
n++;
|
||||||
|
}
|
||||||
|
if (*n != '\0')
|
||||||
|
{
|
||||||
|
// If this isn't the last possibility, save it for later
|
||||||
|
backtrack.push(std::make_pair(p, n));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case '?':
|
||||||
|
// Any character matches unless we're at the end of the name
|
||||||
|
if (*n != '\0')
|
||||||
|
{
|
||||||
|
n++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
matching = false;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
// Non-wildcard characters match literally
|
||||||
|
if (*n == *p)
|
||||||
|
{
|
||||||
|
n++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
matching = false;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
p++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If we haven't failed matching and we've reached the end of the name, then success
|
||||||
|
if (matching && *n == '\0')
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If there are no other paths to tray, then fail
|
||||||
|
if (backtrack.empty())
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Restore pointers from backtrack stack
|
||||||
|
p = backtrack.top().first;
|
||||||
|
n = backtrack.top().second;
|
||||||
|
backtrack.pop();
|
||||||
|
|
||||||
|
// Advance name pointer by one because the current position didn't work
|
||||||
|
n++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string Suppressions::FileMatcher::addFile(const std::string &name, unsigned int line)
|
||||||
|
{
|
||||||
|
if (name.find_first_of("*?") != std::string::npos)
|
||||||
|
{
|
||||||
|
for (std::string::const_iterator i = name.begin(); i != name.end(); ++i)
|
||||||
|
{
|
||||||
|
if (*i == '*')
|
||||||
|
{
|
||||||
|
std::string::const_iterator j = i + 1;
|
||||||
|
if (j != name.end() && (*j == '*' || *j == '?'))
|
||||||
|
{
|
||||||
|
return "Failed to add suppression. Syntax error in glob.";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_globs[name][line] = false;
|
||||||
|
}
|
||||||
|
else if (name.empty())
|
||||||
|
{
|
||||||
|
_globs["*"][0U] = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_files[Path::simplifyPath(name.c_str())][line] = false;
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Suppressions::FileMatcher::isSuppressed(const std::string &file, unsigned int line)
|
||||||
|
{
|
||||||
|
if (isSuppressedLocal(file, line))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
for (std::map<std::string, std::map<unsigned int, bool> >::iterator g = _globs.begin(); g != _globs.end(); ++g)
|
||||||
|
{
|
||||||
|
if (match(g->first, file))
|
||||||
|
{
|
||||||
|
if (g->second.find(0U) != g->second.end())
|
||||||
|
{
|
||||||
|
g->second[0U] = true;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
std::map<unsigned int, bool>::iterator l = g->second.find(line);
|
||||||
|
if (l != g->second.end())
|
||||||
|
{
|
||||||
|
l->second = true;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Suppressions::FileMatcher::isSuppressedLocal(const std::string &file, unsigned int line)
|
||||||
|
{
|
||||||
|
std::map<std::string, std::map<unsigned int, bool> >::iterator f = _files.find(file);
|
||||||
|
if (f != _files.end())
|
||||||
|
{
|
||||||
|
if (f->second.find(0U) != f->second.end())
|
||||||
|
{
|
||||||
|
f->second[0U] = true;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
std::map<unsigned int, bool>::iterator l = f->second.find(line);
|
||||||
|
if (l != f->second.end())
|
||||||
|
{
|
||||||
|
l->second = true;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string Suppressions::addSuppression(const std::string &errorId, const std::string &file, unsigned int line)
|
||||||
|
{
|
||||||
|
// Check that errorId is valid..
|
||||||
|
if (errorId.empty())
|
||||||
|
{
|
||||||
|
return "Failed to add suppression. No id.";
|
||||||
|
}
|
||||||
|
if (errorId != "*")
|
||||||
|
{
|
||||||
|
for (std::string::size_type pos = 0; pos < errorId.length(); ++pos)
|
||||||
|
{
|
||||||
|
if (errorId[pos] < 0 || !std::isalnum(errorId[pos]))
|
||||||
|
{
|
||||||
|
return "Failed to add suppression. Invalid id \"" + errorId + "\"";
|
||||||
|
}
|
||||||
|
if (pos == 0 && std::isdigit(errorId[pos]))
|
||||||
|
{
|
||||||
|
return "Failed to add suppression. Invalid id \"" + errorId + "\"";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return _suppressions[errorId].addFile(file, line);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Suppressions::isSuppressed(const std::string &errorId, const std::string &file, unsigned int line)
|
||||||
|
{
|
||||||
|
if (errorId != "unmatchedSuppression" && _suppressions.find("*") != _suppressions.end())
|
||||||
|
if (_suppressions["*"].isSuppressed(file, line))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
if (_suppressions.find(errorId) == _suppressions.end())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return _suppressions[errorId].isSuppressed(file, line);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Suppressions::isSuppressedLocal(const std::string &errorId, const std::string &file, unsigned int line)
|
||||||
|
{
|
||||||
|
if (errorId != "unmatchedSuppression" && _suppressions.find("*") != _suppressions.end())
|
||||||
|
if (_suppressions["*"].isSuppressedLocal(file, line))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
if (_suppressions.find(errorId) == _suppressions.end())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return _suppressions[errorId].isSuppressedLocal(file, line);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::list<Suppressions::SuppressionEntry> Suppressions::getUnmatchedLocalSuppressions(const std::string &file) const
|
||||||
|
{
|
||||||
|
std::list<SuppressionEntry> r;
|
||||||
|
for (std::map<std::string, FileMatcher>::const_iterator i = _suppressions.begin(); i != _suppressions.end(); ++i)
|
||||||
|
{
|
||||||
|
std::map<std::string, std::map<unsigned int, bool> >::const_iterator f = i->second._files.find(file);
|
||||||
|
if (f != i->second._files.end())
|
||||||
|
{
|
||||||
|
for (std::map<unsigned int, bool>::const_iterator l = f->second.begin(); l != f->second.end(); ++l)
|
||||||
|
{
|
||||||
|
if (!l->second)
|
||||||
|
{
|
||||||
|
r.push_back(SuppressionEntry(i->first, f->first, l->first));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::list<Suppressions::SuppressionEntry> Suppressions::getUnmatchedGlobalSuppressions() const
|
||||||
|
{
|
||||||
|
std::list<SuppressionEntry> r;
|
||||||
|
for (std::map<std::string, FileMatcher>::const_iterator i = _suppressions.begin(); i != _suppressions.end(); ++i)
|
||||||
|
{
|
||||||
|
for (std::map<std::string, std::map<unsigned int, bool> >::const_iterator g = i->second._globs.begin(); g != i->second._globs.end(); ++g)
|
||||||
|
{
|
||||||
|
for (std::map<unsigned int, bool>::const_iterator l = g->second.begin(); l != g->second.end(); ++l)
|
||||||
|
{
|
||||||
|
if (!l->second)
|
||||||
|
{
|
||||||
|
r.push_back(SuppressionEntry(i->first, g->first, l->first));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,145 @@
|
||||||
|
/*
|
||||||
|
* Cppcheck - A tool for static C/C++ code analysis
|
||||||
|
* Copyright (C) 2007-2011 Daniel Marjamäki and Cppcheck team.
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef SUPPRESSIONS_H
|
||||||
|
#define SUPPRESSIONS_H
|
||||||
|
|
||||||
|
#include <list>
|
||||||
|
#include <string>
|
||||||
|
#include <istream>
|
||||||
|
#include <map>
|
||||||
|
|
||||||
|
|
||||||
|
/** @brief class for handling suppressions */
|
||||||
|
class Suppressions
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
class FileMatcher
|
||||||
|
{
|
||||||
|
friend class Suppressions;
|
||||||
|
private:
|
||||||
|
/** @brief List of filenames suppressed, bool flag indicates whether suppression matched. */
|
||||||
|
std::map<std::string, std::map<unsigned int, bool> > _files;
|
||||||
|
/** @brief List of globs suppressed, bool flag indicates whether suppression matched. */
|
||||||
|
std::map<std::string, std::map<unsigned int, bool> > _globs;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Match a name against a glob pattern.
|
||||||
|
* @param pattern The glob pattern to match.
|
||||||
|
* @param name The filename to match against the glob pattern.
|
||||||
|
* @return match success
|
||||||
|
*/
|
||||||
|
static bool match(const std::string &pattern, const std::string &name);
|
||||||
|
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* @brief Add a file or glob (and line number).
|
||||||
|
* @param name File name or glob pattern
|
||||||
|
* @param line Line number
|
||||||
|
* @return error message. empty upon success
|
||||||
|
*/
|
||||||
|
std::string addFile(const std::string &name, unsigned int line);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Returns true if the file name matches a previously added file or glob pattern.
|
||||||
|
* @param file File name to check
|
||||||
|
* @param line Line number
|
||||||
|
* @return true if this filename/line matches
|
||||||
|
*/
|
||||||
|
bool isSuppressed(const std::string &file, unsigned int line);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Returns true if the file name matches a previously added file (only, not glob pattern).
|
||||||
|
* @param file File name to check
|
||||||
|
* @param line Line number
|
||||||
|
* @return true if this filename/line matches
|
||||||
|
*/
|
||||||
|
bool isSuppressedLocal(const std::string &file, unsigned int line);
|
||||||
|
};
|
||||||
|
|
||||||
|
/** @brief List of error which the user doesn't want to see. */
|
||||||
|
std::map<std::string, FileMatcher> _suppressions;
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* @brief Don't show errors listed in the file.
|
||||||
|
* @param istr Open file stream where errors can be read.
|
||||||
|
* @return error message. empty upon success
|
||||||
|
*/
|
||||||
|
std::string parseFile(std::istream &istr);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Don't show the given error.
|
||||||
|
* @param line Description of error to suppress (in id:file:line format).
|
||||||
|
* @return error message. empty upon success
|
||||||
|
*/
|
||||||
|
std::string addSuppressionLine(const std::string &line);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Don't show this error. If file and/or line are optional. In which case
|
||||||
|
* the errorId alone is used for filtering.
|
||||||
|
* @param errorId the id for the error, e.g. "arrayIndexOutOfBounds"
|
||||||
|
* @param file File name with the path, e.g. "src/main.cpp"
|
||||||
|
* @param line number, e.g. "123"
|
||||||
|
* @return error message. empty upon success
|
||||||
|
*/
|
||||||
|
std::string addSuppression(const std::string &errorId, const std::string &file = "", unsigned int line = 0);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Returns true if this message should not be shown to the user.
|
||||||
|
* @param errorId the id for the error, e.g. "arrayIndexOutOfBounds"
|
||||||
|
* @param file File name with the path, e.g. "src/main.cpp"
|
||||||
|
* @param line number, e.g. "123"
|
||||||
|
* @return true if this error is suppressed.
|
||||||
|
*/
|
||||||
|
bool isSuppressed(const std::string &errorId, const std::string &file, unsigned int line);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Returns true if this message should not be shown to the user (explicit files only, not glob patterns).
|
||||||
|
* @param errorId the id for the error, e.g. "arrayIndexOutOfBounds"
|
||||||
|
* @param file File name with the path, e.g. "src/main.cpp"
|
||||||
|
* @param line number, e.g. "123"
|
||||||
|
* @return true if this error is suppressed.
|
||||||
|
*/
|
||||||
|
bool isSuppressedLocal(const std::string &errorId, const std::string &file, unsigned int line);
|
||||||
|
|
||||||
|
struct SuppressionEntry
|
||||||
|
{
|
||||||
|
SuppressionEntry(const std::string &aid, const std::string &afile, const unsigned int &aline)
|
||||||
|
: id(aid), file(afile), line(aline)
|
||||||
|
{ }
|
||||||
|
|
||||||
|
std::string id;
|
||||||
|
std::string file;
|
||||||
|
unsigned int line;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Returns list of unmatched local (per-file) suppressions.
|
||||||
|
* @return list of unmatched suppressions
|
||||||
|
*/
|
||||||
|
std::list<SuppressionEntry> getUnmatchedLocalSuppressions(const std::string &file) const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Returns list of unmatched global (glob pattern) suppressions.
|
||||||
|
* @return list of unmatched suppressions
|
||||||
|
*/
|
||||||
|
std::list<SuppressionEntry> getUnmatchedGlobalSuppressions() const;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif // SUPPRESSIONS_H
|
|
@ -58,7 +58,6 @@ SOURCES += options.cpp \
|
||||||
testpostfixoperator.cpp \
|
testpostfixoperator.cpp \
|
||||||
testpreprocessor.cpp \
|
testpreprocessor.cpp \
|
||||||
testrunner.cpp \
|
testrunner.cpp \
|
||||||
testsettings.cpp \
|
|
||||||
testsimplifytokens.cpp \
|
testsimplifytokens.cpp \
|
||||||
teststl.cpp \
|
teststl.cpp \
|
||||||
testsuite.cpp \
|
testsuite.cpp \
|
||||||
|
|
|
@ -1,113 +0,0 @@
|
||||||
/*
|
|
||||||
* Cppcheck - A tool for static C/C++ code analysis
|
|
||||||
* Copyright (C) 2007-2011 Daniel Marjamäki and Cppcheck team.
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "settings.h"
|
|
||||||
#include "testsuite.h"
|
|
||||||
|
|
||||||
#include <sstream>
|
|
||||||
|
|
||||||
extern std::ostringstream errout;
|
|
||||||
|
|
||||||
class TestSettings : public TestFixture
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
TestSettings() : TestFixture("TestSettings")
|
|
||||||
{ }
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
void run()
|
|
||||||
{
|
|
||||||
TEST_CASE(suppressionsBadId1);
|
|
||||||
TEST_CASE(suppressionsDosFormat); // Ticket #1836
|
|
||||||
TEST_CASE(suppressionsFileNameWithColon); // Ticket #1919 - filename includes colon
|
|
||||||
TEST_CASE(suppressionsGlob);
|
|
||||||
TEST_CASE(suppressionsFileNameWithExtraPath);
|
|
||||||
}
|
|
||||||
|
|
||||||
void suppressionsBadId1()
|
|
||||||
{
|
|
||||||
Settings::Suppressions suppressions;
|
|
||||||
std::istringstream s("123");
|
|
||||||
ASSERT_EQUALS("Failed to add suppression. Invalid id \"123\"", suppressions.parseFile(s));
|
|
||||||
}
|
|
||||||
|
|
||||||
void suppressionsDosFormat()
|
|
||||||
{
|
|
||||||
Settings::Suppressions suppressions;
|
|
||||||
std::istringstream s("abc\r\ndef\r\n");
|
|
||||||
ASSERT_EQUALS("", suppressions.parseFile(s));
|
|
||||||
ASSERT_EQUALS(true, suppressions.isSuppressed("abc", "test.cpp", 1));
|
|
||||||
ASSERT_EQUALS(true, suppressions.isSuppressed("def", "test.cpp", 1));
|
|
||||||
}
|
|
||||||
|
|
||||||
void suppressionsFileNameWithColon()
|
|
||||||
{
|
|
||||||
Settings::Suppressions suppressions;
|
|
||||||
std::istringstream s("errorid:c:\\foo.cpp\nerrorid:c:\\bar.cpp:12");
|
|
||||||
ASSERT_EQUALS("", suppressions.parseFile(s));
|
|
||||||
ASSERT_EQUALS(true, suppressions.isSuppressed("errorid", "c:\\foo.cpp", 1111));
|
|
||||||
ASSERT_EQUALS(false, suppressions.isSuppressed("errorid", "c:\\bar.cpp", 10));
|
|
||||||
ASSERT_EQUALS(true, suppressions.isSuppressed("errorid", "c:\\bar.cpp", 12));
|
|
||||||
}
|
|
||||||
|
|
||||||
void suppressionsGlob()
|
|
||||||
{
|
|
||||||
// Check for syntax errors in glob
|
|
||||||
{
|
|
||||||
Settings::Suppressions suppressions;
|
|
||||||
std::istringstream s("errorid:**.cpp\n");
|
|
||||||
ASSERT_EQUALS("Failed to add suppression. Syntax error in glob.", suppressions.parseFile(s));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check that globbing works
|
|
||||||
{
|
|
||||||
Settings::Suppressions suppressions;
|
|
||||||
std::istringstream s("errorid:x*.cpp\nerrorid:y?.cpp\nerrorid:test.c*");
|
|
||||||
ASSERT_EQUALS("", suppressions.parseFile(s));
|
|
||||||
ASSERT_EQUALS(true, suppressions.isSuppressed("errorid", "xyz.cpp", 1));
|
|
||||||
ASSERT_EQUALS(true, suppressions.isSuppressed("errorid", "xyz.cpp.cpp", 1));
|
|
||||||
ASSERT_EQUALS(false, suppressions.isSuppressed("errorid", "abc.cpp", 1));
|
|
||||||
ASSERT_EQUALS(true, suppressions.isSuppressed("errorid", "ya.cpp", 1));
|
|
||||||
ASSERT_EQUALS(false, suppressions.isSuppressed("errorid", "y.cpp", 1));
|
|
||||||
ASSERT_EQUALS(true, suppressions.isSuppressed("errorid", "test.c", 1));
|
|
||||||
ASSERT_EQUALS(true, suppressions.isSuppressed("errorid", "test.cpp", 1));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check that both a filename match and a glob match apply
|
|
||||||
{
|
|
||||||
Settings::Suppressions suppressions;
|
|
||||||
std::istringstream s("errorid:x*.cpp\nerrorid:xyz.cpp:1\nerrorid:a*.cpp:1\nerrorid:abc.cpp:2");
|
|
||||||
ASSERT_EQUALS("", suppressions.parseFile(s));
|
|
||||||
ASSERT_EQUALS(true, suppressions.isSuppressed("errorid", "xyz.cpp", 1));
|
|
||||||
ASSERT_EQUALS(true, suppressions.isSuppressed("errorid", "xyz.cpp", 2));
|
|
||||||
ASSERT_EQUALS(true, suppressions.isSuppressed("errorid", "abc.cpp", 1));
|
|
||||||
ASSERT_EQUALS(true, suppressions.isSuppressed("errorid", "abc.cpp", 2));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void suppressionsFileNameWithExtraPath()
|
|
||||||
{
|
|
||||||
// Ticket #2797
|
|
||||||
Settings::Suppressions suppressions;
|
|
||||||
suppressions.addSuppression("errorid", "./a.c", 123);
|
|
||||||
ASSERT_EQUALS(true, suppressions.isSuppressed("errorid", "a.c", 123));
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
REGISTER_TEST(TestSettings)
|
|
|
@ -36,10 +36,84 @@ private:
|
||||||
|
|
||||||
void run()
|
void run()
|
||||||
{
|
{
|
||||||
|
TEST_CASE(suppressionsBadId1);
|
||||||
|
TEST_CASE(suppressionsDosFormat); // Ticket #1836
|
||||||
|
TEST_CASE(suppressionsFileNameWithColon); // Ticket #1919 - filename includes colon
|
||||||
|
TEST_CASE(suppressionsGlob);
|
||||||
|
TEST_CASE(suppressionsFileNameWithExtraPath);
|
||||||
TEST_CASE(suppressionsSettings);
|
TEST_CASE(suppressionsSettings);
|
||||||
TEST_CASE(suppressionsMultiFile);
|
TEST_CASE(suppressionsMultiFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void suppressionsBadId1()
|
||||||
|
{
|
||||||
|
Suppressions suppressions;
|
||||||
|
std::istringstream s("123");
|
||||||
|
ASSERT_EQUALS("Failed to add suppression. Invalid id \"123\"", suppressions.parseFile(s));
|
||||||
|
}
|
||||||
|
|
||||||
|
void suppressionsDosFormat()
|
||||||
|
{
|
||||||
|
Suppressions suppressions;
|
||||||
|
std::istringstream s("abc\r\ndef\r\n");
|
||||||
|
ASSERT_EQUALS("", suppressions.parseFile(s));
|
||||||
|
ASSERT_EQUALS(true, suppressions.isSuppressed("abc", "test.cpp", 1));
|
||||||
|
ASSERT_EQUALS(true, suppressions.isSuppressed("def", "test.cpp", 1));
|
||||||
|
}
|
||||||
|
|
||||||
|
void suppressionsFileNameWithColon()
|
||||||
|
{
|
||||||
|
Suppressions suppressions;
|
||||||
|
std::istringstream s("errorid:c:\\foo.cpp\nerrorid:c:\\bar.cpp:12");
|
||||||
|
ASSERT_EQUALS("", suppressions.parseFile(s));
|
||||||
|
ASSERT_EQUALS(true, suppressions.isSuppressed("errorid", "c:\\foo.cpp", 1111));
|
||||||
|
ASSERT_EQUALS(false, suppressions.isSuppressed("errorid", "c:\\bar.cpp", 10));
|
||||||
|
ASSERT_EQUALS(true, suppressions.isSuppressed("errorid", "c:\\bar.cpp", 12));
|
||||||
|
}
|
||||||
|
|
||||||
|
void suppressionsGlob()
|
||||||
|
{
|
||||||
|
// Check for syntax errors in glob
|
||||||
|
{
|
||||||
|
Suppressions suppressions;
|
||||||
|
std::istringstream s("errorid:**.cpp\n");
|
||||||
|
ASSERT_EQUALS("Failed to add suppression. Syntax error in glob.", suppressions.parseFile(s));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check that globbing works
|
||||||
|
{
|
||||||
|
Suppressions suppressions;
|
||||||
|
std::istringstream s("errorid:x*.cpp\nerrorid:y?.cpp\nerrorid:test.c*");
|
||||||
|
ASSERT_EQUALS("", suppressions.parseFile(s));
|
||||||
|
ASSERT_EQUALS(true, suppressions.isSuppressed("errorid", "xyz.cpp", 1));
|
||||||
|
ASSERT_EQUALS(true, suppressions.isSuppressed("errorid", "xyz.cpp.cpp", 1));
|
||||||
|
ASSERT_EQUALS(false, suppressions.isSuppressed("errorid", "abc.cpp", 1));
|
||||||
|
ASSERT_EQUALS(true, suppressions.isSuppressed("errorid", "ya.cpp", 1));
|
||||||
|
ASSERT_EQUALS(false, suppressions.isSuppressed("errorid", "y.cpp", 1));
|
||||||
|
ASSERT_EQUALS(true, suppressions.isSuppressed("errorid", "test.c", 1));
|
||||||
|
ASSERT_EQUALS(true, suppressions.isSuppressed("errorid", "test.cpp", 1));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check that both a filename match and a glob match apply
|
||||||
|
{
|
||||||
|
Suppressions suppressions;
|
||||||
|
std::istringstream s("errorid:x*.cpp\nerrorid:xyz.cpp:1\nerrorid:a*.cpp:1\nerrorid:abc.cpp:2");
|
||||||
|
ASSERT_EQUALS("", suppressions.parseFile(s));
|
||||||
|
ASSERT_EQUALS(true, suppressions.isSuppressed("errorid", "xyz.cpp", 1));
|
||||||
|
ASSERT_EQUALS(true, suppressions.isSuppressed("errorid", "xyz.cpp", 2));
|
||||||
|
ASSERT_EQUALS(true, suppressions.isSuppressed("errorid", "abc.cpp", 1));
|
||||||
|
ASSERT_EQUALS(true, suppressions.isSuppressed("errorid", "abc.cpp", 2));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void suppressionsFileNameWithExtraPath()
|
||||||
|
{
|
||||||
|
// Ticket #2797
|
||||||
|
Suppressions suppressions;
|
||||||
|
suppressions.addSuppression("errorid", "./a.c", 123);
|
||||||
|
ASSERT_EQUALS(true, suppressions.isSuppressed("errorid", "a.c", 123));
|
||||||
|
}
|
||||||
|
|
||||||
// Check the suppression
|
// Check the suppression
|
||||||
void checkSuppression(const char code[], const std::string &suppression = "")
|
void checkSuppression(const char code[], const std::string &suppression = "")
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue