Merge branch 'master' of http://github.com/danmar/cppcheck
This commit is contained in:
commit
79d4cabd9a
146
Makefile
146
Makefile
|
@ -12,6 +12,18 @@ ifndef PREFIX
|
|||
PREFIX=/usr
|
||||
endif
|
||||
|
||||
ifndef INCLUDE_FOR_LIB
|
||||
INCLUDE_FOR_LIB=-Ilib
|
||||
endif
|
||||
|
||||
ifndef INCLUDE_FOR_CLI
|
||||
INCLUDE_FOR_CLI=-Ilib -Iexternals -Iexternals/tinyxml
|
||||
endif
|
||||
|
||||
ifndef INCLUDE_FOR_TEST
|
||||
INCLUDE_FOR_TEST=-Ilib -Icli -Iexternals -Iexternals/tinyxml
|
||||
endif
|
||||
|
||||
BIN=$(DESTDIR)$(PREFIX)/bin
|
||||
|
||||
# For 'make man': sudo apt-get install xsltproc docbook-xsl docbook-xml on Linux
|
||||
|
@ -141,203 +153,203 @@ install: cppcheck
|
|||
###### Build
|
||||
|
||||
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
|
||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -Ilib -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/executionpath.h
|
||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -Ilib -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
|
||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -Ilib -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
|
||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -Ilib -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
|
||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -Ilib -c -o lib/checkmemoryleak.o lib/checkmemoryleak.cpp
|
||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_LIB} -c -o lib/checkmemoryleak.o lib/checkmemoryleak.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
|
||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -Ilib -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
|
||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -Ilib -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
|
||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -Ilib -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
|
||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -Ilib -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
|
||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -Ilib -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
|
||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -Ilib -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
|
||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -Ilib -c -o lib/checkunusedfunctions.o lib/checkunusedfunctions.cpp
|
||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_LIB} -c -o lib/checkunusedfunctions.o lib/checkunusedfunctions.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
|
||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -Ilib -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/path.h lib/cppcheck.h lib/settings.h lib/checkunusedfunctions.h lib/check.h lib/token.h lib/tokenize.h
|
||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -Ilib -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
|
||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -Ilib -c -o lib/executionpath.o lib/executionpath.cpp
|
||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_LIB} -c -o lib/executionpath.o lib/executionpath.cpp
|
||||
|
||||
lib/mathlib.o: lib/mathlib.cpp lib/mathlib.h lib/tokenize.h
|
||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -Ilib -c -o lib/mathlib.o lib/mathlib.cpp
|
||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_LIB} -c -o lib/mathlib.o lib/mathlib.cpp
|
||||
|
||||
lib/path.o: lib/path.cpp lib/path.h
|
||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -Ilib -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
|
||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -Ilib -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
|
||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -Ilib -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/tokenize.h lib/settings.h lib/errorlogger.h lib/check.h
|
||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -Ilib -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
|
||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -Ilib -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/check.h lib/tokenize.h lib/settings.h
|
||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -Ilib -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
|
||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -Ilib -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
|
||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -Ilib -Iexternals -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 cli/cmdlineparser.h cli/filelister.h lib/path.h cli/pathmatch.h
|
||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -Ilib -Iexternals -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 cli/filelister_win32.h cli/filelister_unix.h
|
||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -Ilib -Iexternals -c -o cli/filelister.o cli/filelister.cpp
|
||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_CLI} -c -o cli/filelister.o cli/filelister.cpp
|
||||
|
||||
cli/filelister_unix.o: cli/filelister_unix.cpp lib/path.h cli/filelister.h cli/filelister_unix.h
|
||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -Ilib -Iexternals -c -o cli/filelister_unix.o cli/filelister_unix.cpp
|
||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_CLI} -c -o cli/filelister_unix.o cli/filelister_unix.cpp
|
||||
|
||||
cli/filelister_win32.o: cli/filelister_win32.cpp cli/filelister.h cli/filelister_win32.h lib/path.h
|
||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -Ilib -Iexternals -c -o cli/filelister_win32.o cli/filelister_win32.cpp
|
||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_CLI} -c -o cli/filelister_win32.o cli/filelister_win32.cpp
|
||||
|
||||
cli/main.o: cli/main.cpp cli/cppcheckexecutor.h lib/errorlogger.h lib/settings.h
|
||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -Ilib -Iexternals -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
|
||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -Ilib -Iexternals -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/threadexecutor.h lib/settings.h lib/errorlogger.h lib/cppcheck.h lib/checkunusedfunctions.h lib/check.h lib/token.h lib/tokenize.h
|
||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -Ilib -Iexternals -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
|
||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -Ilib -Icli -Iexternals -c -o test/options.o test/options.cpp
|
||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_TEST} -c -o test/options.o test/options.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
|
||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -Ilib -Icli -Iexternals -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
|
||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -Ilib -Icli -Iexternals -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
|
||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -Ilib -Icli -Iexternals -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 test/testsuite.h test/redirect.h
|
||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -Ilib -Icli -Iexternals -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 test/redirect.h lib/settings.h
|
||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -Ilib -Icli -Iexternals -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 test/testsuite.h test/redirect.h
|
||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -Ilib -Icli -Iexternals -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
|
||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -Ilib -Icli -Iexternals -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
|
||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -Ilib -Icli -Iexternals -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
|
||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -Ilib -Icli -Iexternals -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
|
||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -Ilib -Icli -Iexternals -c -o test/testexceptionsafety.o test/testexceptionsafety.cpp
|
||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_TEST} -c -o test/testexceptionsafety.o test/testexceptionsafety.cpp
|
||||
|
||||
test/testfilelister_unix.o: test/testfilelister_unix.cpp test/testsuite.h lib/errorlogger.h test/redirect.h
|
||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -Ilib -Icli -Iexternals -c -o test/testfilelister_unix.o test/testfilelister_unix.cpp
|
||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_TEST} -c -o test/testfilelister_unix.o test/testfilelister_unix.cpp
|
||||
|
||||
test/testincompletestatement.o: test/testincompletestatement.cpp test/testsuite.h lib/errorlogger.h test/redirect.h lib/tokenize.h lib/checkother.h lib/check.h lib/token.h lib/settings.h
|
||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -Ilib -Icli -Iexternals -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 test/redirect.h
|
||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -Ilib -Icli -Iexternals -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 test/testsuite.h test/redirect.h
|
||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -Ilib -Icli -Iexternals -c -o test/testmemleak.o test/testmemleak.cpp
|
||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_TEST} -c -o test/testmemleak.o test/testmemleak.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
|
||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -Ilib -Icli -Iexternals -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
|
||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -Ilib -Icli -Iexternals -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 test/redirect.h
|
||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -Ilib -Icli -Iexternals -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/tokenize.h lib/checkother.h lib/check.h lib/token.h lib/settings.h lib/errorlogger.h test/testsuite.h test/redirect.h
|
||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -Ilib -Icli -Iexternals -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 test/redirect.h lib/path.h
|
||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -Ilib -Icli -Iexternals -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 test/redirect.h
|
||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -Ilib -Icli -Iexternals -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
|
||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -Ilib -Icli -Iexternals -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 test/redirect.h lib/preprocessor.h lib/tokenize.h lib/token.h lib/settings.h
|
||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -Ilib -Icli -Iexternals -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 test/redirect.h test/options.h
|
||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -Ilib -Icli -Iexternals -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
|
||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -Ilib -Icli -Iexternals -c -o test/testsettings.o test/testsettings.cpp
|
||||
$(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 test/redirect.h lib/tokenize.h lib/token.h lib/settings.h
|
||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -Ilib -Icli -Iexternals -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
|
||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -Ilib -Icli -Iexternals -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 test/redirect.h test/options.h
|
||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -Ilib -Icli -Iexternals -c -o test/testsuite.o test/testsuite.cpp
|
||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_TEST} -c -o test/testsuite.o test/testsuite.cpp
|
||||
|
||||
test/testsymboldatabase.o: test/testsymboldatabase.cpp test/testsuite.h lib/errorlogger.h test/redirect.h test/testutils.h lib/settings.h lib/tokenize.h lib/token.h lib/symboldatabase.h
|
||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -Ilib -Icli -Iexternals -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
|
||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -Ilib -Icli -Iexternals -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 test/redirect.h test/testutils.h lib/settings.h lib/tokenize.h lib/token.h
|
||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -Ilib -Icli -Iexternals -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 test/redirect.h lib/tokenize.h lib/token.h lib/settings.h
|
||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -Ilib -Icli -Iexternals -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
|
||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -Ilib -Icli -Iexternals -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 test/redirect.h lib/checkunusedfunctions.h lib/check.h lib/token.h lib/settings.h
|
||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -Ilib -Icli -Iexternals -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 test/testsuite.h test/redirect.h
|
||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -Ilib -Icli -Iexternals -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 test/redirect.h lib/tokenize.h lib/checkother.h lib/check.h lib/token.h lib/settings.h
|
||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -Ilib -Icli -Iexternals -c -o test/testunusedvar.o test/testunusedvar.cpp
|
||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) ${INCLUDE_FOR_TEST} -c -o test/testunusedvar.o test/testunusedvar.cpp
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
#include "filelister.h"
|
||||
|
||||
// xml is used in rules
|
||||
#include "tinyxml/tinyxml.h"
|
||||
#include <tinyxml.h>
|
||||
|
||||
static void AddFilesToList(const std::string& FileList, std::vector<std::string>& PathNames)
|
||||
{
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
ProjectType="Visual C++"
|
||||
Version="9,00"
|
||||
Name="cppcheck"
|
||||
ProjectGUID="{56B0F403-02CE-3F89-9A1B-E03F21240A63}"
|
||||
ProjectGUID="{A610CB5D-FA83-3FC9-96AB-5689E3B50CEC}"
|
||||
Keyword="Qt4VSv1.0">
|
||||
<Platforms>
|
||||
<Platform
|
||||
|
@ -19,7 +19,7 @@
|
|||
UseOfMfc="0">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories="".","..\lib","..\externals",c:\Qt\VS4.7.0\mkspecs\win32-msvc2008"
|
||||
AdditionalIncludeDirectories="".","..\lib","..\externals","..\externals\tinyxml",c:\Qt\VS4.7.0\mkspecs\win32-msvc2008"
|
||||
AdditionalOptions="-Zm200 -w34100 -w34189"
|
||||
AssemblerListingLocation="temp\"
|
||||
BufferSecurityCheck="false"
|
||||
|
@ -72,7 +72,7 @@
|
|||
UseOfMfc="0">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories="".","..\lib","..\externals",c:\Qt\VS4.7.0\mkspecs\win32-msvc2008"
|
||||
AdditionalIncludeDirectories="".","..\lib","..\externals","..\externals\tinyxml",c:\Qt\VS4.7.0\mkspecs\win32-msvc2008"
|
||||
AdditionalOptions="-Zm200 -w34100 -w34189"
|
||||
AssemblerListingLocation="temp\"
|
||||
BufferSecurityCheck="false"
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{A6DACC3F-847F-3498-9415-164FBC746D6B}</ProjectGuid>
|
||||
<ProjectGuid>{E3A516D8-D69D-32D7-A444-A3674D4B1FE8}</ProjectGuid>
|
||||
<RootNamespace>cppcheck</RootNamespace>
|
||||
<Keyword>Qt4VSv1.0</Keyword>
|
||||
</PropertyGroup>
|
||||
|
@ -50,7 +50,7 @@
|
|||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>".";"..\lib";"..\externals";c:\Qt\VS4.7.0\mkspecs\win32-msvc2010;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>".";"..\lib";"..\externals";"..\externals\tinyxml";c:\Qt\VS4.7.0\mkspecs\win32-msvc2010;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalOptions>-Zm200 -w34100 -w34189 %(AdditionalOptions)</AdditionalOptions>
|
||||
<AssemblerListingLocation>temp\</AssemblerListingLocation>
|
||||
<BrowseInformation>false</BrowseInformation>
|
||||
|
@ -84,7 +84,7 @@
|
|||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>".";"..\lib";"..\externals";c:\Qt\VS4.7.0\mkspecs\win32-msvc2010;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>".";"..\lib";"..\externals";"..\externals\tinyxml";c:\Qt\VS4.7.0\mkspecs\win32-msvc2010;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalOptions>-Zm200 -w34100 -w34189 %(AdditionalOptions)</AdditionalOptions>
|
||||
<AssemblerListingLocation>temp\</AssemblerListingLocation>
|
||||
<BrowseInformation>false</BrowseInformation>
|
||||
|
|
|
@ -758,6 +758,64 @@ void CheckBufferOverrun::checkFunctionCall(const Token *tok, const ArrayInfo &ar
|
|||
}
|
||||
|
||||
|
||||
void CheckBufferOverrun::checkScopeForBody(const Token *tok, const ArrayInfo &arrayInfo, bool &bailout)
|
||||
{
|
||||
bailout = false;
|
||||
const Token *tok2 = tok->tokAt(2);
|
||||
const MathLib::bigint size = arrayInfo.num[0];
|
||||
|
||||
// Check if there is a break in the body..
|
||||
{
|
||||
const Token *bodyStart = tok->next()->link()->next();
|
||||
const Token *bodyEnd = bodyStart->link();
|
||||
if (Token::findmatch(bodyStart, "break ;", bodyEnd))
|
||||
return;
|
||||
}
|
||||
|
||||
unsigned int counter_varid = 0;
|
||||
std::string min_counter_value;
|
||||
std::string max_counter_value;
|
||||
|
||||
tok2 = for_init(tok2, counter_varid, min_counter_value);
|
||||
if (tok2 == 0 || counter_varid == 0)
|
||||
return;
|
||||
|
||||
bool maxMinFlipped = false;
|
||||
std::string strindex;
|
||||
if (!for_condition(tok2, counter_varid, min_counter_value, max_counter_value, strindex, maxMinFlipped))
|
||||
return;
|
||||
|
||||
// Get index variable and stopsize.
|
||||
bool condition_out_of_bounds = true;
|
||||
if (MathLib::toLongNumber(max_counter_value) < size)
|
||||
condition_out_of_bounds = false;
|
||||
|
||||
if (!for3(tok2->tokAt(4), counter_varid, min_counter_value, max_counter_value, maxMinFlipped))
|
||||
return;
|
||||
|
||||
if (Token::Match(tok2->tokAt(4), "%var% =|+=|-=") && MathLib::toLongNumber(max_counter_value) <= size)
|
||||
condition_out_of_bounds = false;
|
||||
|
||||
// Goto the end parenthesis of the for-statement: "for (x; y; z)" ..
|
||||
tok2 = tok->next()->link();
|
||||
if (!tok2 || !tok2->tokAt(5))
|
||||
{
|
||||
bailout = true;
|
||||
return;
|
||||
}
|
||||
|
||||
// Check is the counter variable increased elsewhere inside the loop or used
|
||||
// for anything else except reading
|
||||
if (for_bailout(tok2->next(), counter_varid))
|
||||
{
|
||||
bailout = true;
|
||||
return;
|
||||
}
|
||||
|
||||
parse_for_body(tok2->next(), arrayInfo, strindex, condition_out_of_bounds, counter_varid, min_counter_value, max_counter_value);
|
||||
}
|
||||
|
||||
|
||||
void CheckBufferOverrun::checkScope(const Token *tok, const std::vector<std::string> &varname, const MathLib::bigint size, const MathLib::bigint total_size, unsigned int varid)
|
||||
{
|
||||
std::string varnames;
|
||||
|
@ -871,53 +929,11 @@ void CheckBufferOverrun::checkScope(const Token *tok, const std::vector<std::str
|
|||
// Loop..
|
||||
if (Token::simpleMatch(tok, "for ("))
|
||||
{
|
||||
const Token *tok2 = tok->tokAt(2);
|
||||
|
||||
// Check if there is a break in the body..
|
||||
{
|
||||
const Token *bodyStart = tok->next()->link()->next();
|
||||
const Token *bodyEnd = bodyStart->link();
|
||||
if (Token::findmatch(bodyStart, "break ;", bodyEnd))
|
||||
continue;
|
||||
}
|
||||
|
||||
unsigned int counter_varid = 0;
|
||||
std::string min_counter_value;
|
||||
std::string max_counter_value;
|
||||
|
||||
tok2 = for_init(tok2, counter_varid, min_counter_value);
|
||||
if (tok2 == 0 || counter_varid == 0)
|
||||
continue;
|
||||
|
||||
bool maxMinFlipped = false;
|
||||
std::string strindex;
|
||||
if (!for_condition(tok2, counter_varid, min_counter_value, max_counter_value, strindex, maxMinFlipped))
|
||||
continue;
|
||||
|
||||
// Get index variable and stopsize.
|
||||
bool condition_out_of_bounds = true;
|
||||
if (MathLib::toLongNumber(max_counter_value) < size)
|
||||
condition_out_of_bounds = false;
|
||||
|
||||
if (!for3(tok2->tokAt(4), counter_varid, min_counter_value, max_counter_value, maxMinFlipped))
|
||||
continue;
|
||||
|
||||
if (Token::Match(tok2->tokAt(4), "%var% =|+=|-=") && MathLib::toLongNumber(max_counter_value) <= size)
|
||||
condition_out_of_bounds = false;
|
||||
|
||||
// Goto the end parenthesis of the for-statement: "for (x; y; z)" ..
|
||||
tok2 = tok->next()->link();
|
||||
if (!tok2 || !tok2->tokAt(5))
|
||||
const ArrayInfo arrayInfo(varid, varnames, (unsigned int)size, (unsigned int)total_size);
|
||||
bool bailout = false;
|
||||
checkScopeForBody(tok, arrayInfo, bailout);
|
||||
if (bailout)
|
||||
break;
|
||||
|
||||
// Check is the counter variable increased elsewhere inside the loop or used
|
||||
// for anything else except reading
|
||||
if (for_bailout(tok2->next(), counter_varid))
|
||||
break;
|
||||
|
||||
ArrayInfo arrayInfo(varid, varnames, (unsigned int)size, (unsigned int)total_size);
|
||||
parse_for_body(tok2->next(), arrayInfo, strindex, condition_out_of_bounds, counter_varid, min_counter_value, max_counter_value);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -1069,52 +1085,10 @@ void CheckBufferOverrun::checkScope(const Token *tok, const ArrayInfo &arrayInfo
|
|||
// Loop..
|
||||
else if (Token::simpleMatch(tok, "for ("))
|
||||
{
|
||||
const Token *tok2 = tok->tokAt(2);
|
||||
|
||||
// Check if there is a break in the body..
|
||||
{
|
||||
const Token *bodyStart = tok->next()->link()->next();
|
||||
const Token *bodyEnd = bodyStart->link();
|
||||
if (Token::findmatch(bodyStart, "break ;", bodyEnd))
|
||||
continue;
|
||||
}
|
||||
|
||||
unsigned int counter_varid = 0;
|
||||
std::string min_counter_value;
|
||||
std::string max_counter_value;
|
||||
|
||||
tok2 = for_init(tok2, counter_varid, min_counter_value);
|
||||
if (tok2 == 0 || counter_varid == 0)
|
||||
continue;
|
||||
|
||||
bool maxMinFlipped = false;
|
||||
std::string strindex;
|
||||
if (!for_condition(tok2, counter_varid, min_counter_value, max_counter_value, strindex, maxMinFlipped))
|
||||
continue;
|
||||
|
||||
// Get index variable and stopsize.
|
||||
bool condition_out_of_bounds = true;
|
||||
if (MathLib::toLongNumber(max_counter_value) < (int)arrayInfo.num[0])
|
||||
condition_out_of_bounds = false;
|
||||
|
||||
if (!for3(tok2->tokAt(4), counter_varid, min_counter_value, max_counter_value, maxMinFlipped))
|
||||
continue;
|
||||
|
||||
if (Token::Match(tok2->tokAt(4), "%var% =|+=|-=") && MathLib::toLongNumber(max_counter_value) <= (int)arrayInfo.num[0])
|
||||
condition_out_of_bounds = false;
|
||||
|
||||
// Goto the end parenthesis of the for-statement: "for (x; y; z)" ..
|
||||
tok2 = tok->next()->link();
|
||||
if (!tok2 || !tok2->tokAt(5))
|
||||
bool bailout = false;
|
||||
checkScopeForBody(tok, arrayInfo, bailout);
|
||||
if (bailout)
|
||||
break;
|
||||
|
||||
// Check is the counter variable increased elsewhere inside the loop or used
|
||||
// for anything else except reading
|
||||
if (for_bailout(tok2->next(), counter_varid))
|
||||
break;
|
||||
|
||||
parse_for_body(tok2->next(), arrayInfo, strindex, condition_out_of_bounds, counter_varid, min_counter_value, max_counter_value);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
@ -164,6 +164,8 @@ public:
|
|||
/** Check for buffer overruns (based on ArrayInfo) */
|
||||
void checkScope(const Token *tok, const ArrayInfo &arrayInfo);
|
||||
|
||||
/** Check scope helper function - parse for body */
|
||||
void checkScopeForBody(const Token *tok, const ArrayInfo &arrayInfo, bool &bailout);
|
||||
|
||||
/** Helper function used when parsing for-loops */
|
||||
void parse_for_body(const Token *tok2, const ArrayInfo &arrayInfo, const std::string &strindex, bool condition_out_of_bounds, unsigned int counter_varid, const std::string &min_counter_value, const std::string &max_counter_value);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# no manual edits - this file is autogenerated by dmake
|
||||
|
||||
LIBS += -L../externals -lpcre
|
||||
INCLUDEPATH += ../externals
|
||||
INCLUDEPATH += ../externals ../externals/tinyxml
|
||||
HEADERS += $${BASEPATH}check.h \
|
||||
$${BASEPATH}checkautovariables.h \
|
||||
$${BASEPATH}checkbufferoverrun.h \
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
ProjectType="Visual C++"
|
||||
Version="9,00"
|
||||
Name="test"
|
||||
ProjectGUID="{5B7869EA-A1CB-3E73-8569-5B385608779E}"
|
||||
ProjectGUID="{E690724D-4286-3049-8439-595D1CB80EAB}"
|
||||
Keyword="Qt4VSv1.0">
|
||||
<Platforms>
|
||||
<Platform
|
||||
|
@ -19,7 +19,7 @@
|
|||
UseOfMfc="0">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories="".","..\cli","..\lib","..\externals",c:\Qt\VS4.7.0\mkspecs\win32-msvc2008"
|
||||
AdditionalIncludeDirectories="".","..\cli","..\lib","..\externals","..\externals\tinyxml",c:\Qt\VS4.7.0\mkspecs\win32-msvc2008"
|
||||
AdditionalOptions="-Zm200 -w34100 -w34189"
|
||||
AssemblerListingLocation="temp\"
|
||||
BufferSecurityCheck="false"
|
||||
|
@ -72,7 +72,7 @@
|
|||
UseOfMfc="0">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories="".","..\cli","..\lib","..\externals",..\..\..\..\Qt\qt-everywhere-opensource-src-4.7.1-vs2008-x86\mkspecs\win32-msvc2008"
|
||||
AdditionalIncludeDirectories="".","..\cli","..\lib","..\externals","..\externals\tinyxml",c:\Qt\VS4.7.0\mkspecs\win32-msvc2008"
|
||||
AdditionalOptions="-Zm200 -w34100 -w34189"
|
||||
AssemblerListingLocation="temp\"
|
||||
BufferSecurityCheck="false"
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{D0001948-3B19-3314-8BEE-3B92350BC5B5}</ProjectGuid>
|
||||
<ProjectGuid>{597BA843-2D03-3F45-AB51-2E1DF1EA5136}</ProjectGuid>
|
||||
<RootNamespace>test</RootNamespace>
|
||||
<Keyword>Qt4VSv1.0</Keyword>
|
||||
</PropertyGroup>
|
||||
|
@ -50,7 +50,7 @@
|
|||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>".";"..\cli";"..\lib";"..\externals";c:\Qt\VS4.7.0\mkspecs\win32-msvc2010;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>".";"..\cli";"..\lib";"..\externals";"..\externals\tinyxml";c:\Qt\VS4.7.0\mkspecs\win32-msvc2010;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalOptions>-Zm200 -w34100 -w34189 %(AdditionalOptions)</AdditionalOptions>
|
||||
<AssemblerListingLocation>temp\</AssemblerListingLocation>
|
||||
<BrowseInformation>false</BrowseInformation>
|
||||
|
@ -84,7 +84,7 @@
|
|||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>".";"..\cli";"..\lib";"..\externals";c:\Qt\VS4.7.0\mkspecs\win32-msvc2010;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>".";"..\cli";"..\lib";"..\externals";"..\externals\tinyxml";c:\Qt\VS4.7.0\mkspecs\win32-msvc2010;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalOptions>-Zm200 -w34100 -w34189 %(AdditionalOptions)</AdditionalOptions>
|
||||
<AssemblerListingLocation>temp\</AssemblerListingLocation>
|
||||
<BrowseInformation>false</BrowseInformation>
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
#include <stdexcept>
|
||||
|
||||
// use tinyxml with STL
|
||||
#include "tinyxml/tinyxml.h"
|
||||
#include <tinyxml.h>
|
||||
|
||||
extern std::ostringstream errout;
|
||||
extern std::ostringstream output;
|
||||
|
|
|
@ -186,7 +186,7 @@ int main(int argc, char **argv)
|
|||
{
|
||||
fout1 << "# no manual edits - this file is autogenerated by dmake\n\n";
|
||||
fout1 << "LIBS += -L../externals -lpcre\n";
|
||||
fout1 << "INCLUDEPATH += ../externals\n";
|
||||
fout1 << "INCLUDEPATH += ../externals ../externals/tinyxml\n";
|
||||
fout1 << "HEADERS += $${BASEPATH}check.h \\\n";
|
||||
for (unsigned int i = 0; i < libfiles.size(); ++i)
|
||||
{
|
||||
|
@ -248,6 +248,10 @@ int main(int argc, char **argv)
|
|||
}
|
||||
makeConditionalVariable(fout, "CXX", "g++");
|
||||
makeConditionalVariable(fout, "PREFIX", "/usr");
|
||||
makeConditionalVariable(fout, "INCLUDE_FOR_LIB", "-Ilib");
|
||||
makeConditionalVariable(fout, "INCLUDE_FOR_CLI", "-Ilib -Iexternals -Iexternals/tinyxml");
|
||||
makeConditionalVariable(fout, "INCLUDE_FOR_TEST", "-Ilib -Icli -Iexternals -Iexternals/tinyxml");
|
||||
|
||||
fout << "BIN=$(DESTDIR)$(PREFIX)/bin\n\n";
|
||||
fout << "# For 'make man': sudo apt-get install xsltproc docbook-xsl docbook-xml on Linux\n";
|
||||
fout << "DB2MAN=/usr/share/sgml/docbook/stylesheet/xsl/nwalsh/manpages/docbook.xsl\n";
|
||||
|
@ -299,9 +303,9 @@ int main(int argc, char **argv)
|
|||
|
||||
fout << "\n###### Build\n\n";
|
||||
|
||||
compilefiles(fout, libfiles, "-Ilib");
|
||||
compilefiles(fout, clifiles, "-Ilib -Iexternals");
|
||||
compilefiles(fout, testfiles, "-Ilib -Icli -Iexternals");
|
||||
compilefiles(fout, libfiles, "${INCLUDE_FOR_LIB}");
|
||||
compilefiles(fout, clifiles, "${INCLUDE_FOR_CLI}");
|
||||
compilefiles(fout, testfiles, "${INCLUDE_FOR_TEST}");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue