Fixed #1487 (fix gcc compiler warnings)
This commit is contained in:
parent
271a74a16c
commit
adc47f1820
78
Makefile
78
Makefile
|
@ -1,4 +1,4 @@
|
||||||
CXXFLAGS=-Wall -Wextra -Wshadow -pedantic -Wno-long-long -Wfloat-equal -Wcast-qual -g -D_GLIBCXX_DEBUG
|
CXXFLAGS=-Wall -Wextra -Wshadow -pedantic -Wno-long-long -Wfloat-equal -Wcast-qual -Wsign-conversion -g -D_GLIBCXX_DEBUG
|
||||||
CXX=g++
|
CXX=g++
|
||||||
BIN=${DESTDIR}/usr/bin
|
BIN=${DESTDIR}/usr/bin
|
||||||
|
|
||||||
|
@ -98,34 +98,34 @@ install: cppcheck
|
||||||
|
|
||||||
###### Build
|
###### 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/checkautovariables.o: lib/checkautovariables.cpp lib/checkautovariables.h lib/check.h lib/token.h lib/tokenize.h lib/classinfo.h lib/settings.h lib/errorlogger.h
|
||||||
$(CXX) $(CXXFLAGS) -Ilib -c -o lib/checkautovariables.o lib/checkautovariables.cpp
|
$(CXX) $(CXXFLAGS) -Ilib -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
|
lib/checkbufferoverrun.o: lib/checkbufferoverrun.cpp lib/checkbufferoverrun.h lib/check.h lib/token.h lib/tokenize.h lib/classinfo.h lib/settings.h lib/errorlogger.h lib/mathlib.h lib/executionpath.h
|
||||||
$(CXX) $(CXXFLAGS) -Ilib -c -o lib/checkbufferoverrun.o lib/checkbufferoverrun.cpp
|
$(CXX) $(CXXFLAGS) -Ilib -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/checkclass.o: lib/checkclass.cpp lib/checkclass.h lib/check.h lib/token.h lib/tokenize.h lib/classinfo.h lib/settings.h lib/errorlogger.h
|
||||||
$(CXX) $(CXXFLAGS) -Ilib -c -o lib/checkclass.o lib/checkclass.cpp
|
$(CXX) $(CXXFLAGS) -Ilib -c -o lib/checkclass.o lib/checkclass.cpp
|
||||||
|
|
||||||
lib/checkdangerousfunctions.o: lib/checkdangerousfunctions.cpp lib/checkdangerousfunctions.h lib/check.h lib/token.h lib/tokenize.h lib/settings.h lib/errorlogger.h
|
lib/checkdangerousfunctions.o: lib/checkdangerousfunctions.cpp lib/checkdangerousfunctions.h lib/check.h lib/token.h lib/tokenize.h lib/classinfo.h lib/settings.h lib/errorlogger.h
|
||||||
$(CXX) $(CXXFLAGS) -Ilib -c -o lib/checkdangerousfunctions.o lib/checkdangerousfunctions.cpp
|
$(CXX) $(CXXFLAGS) -Ilib -c -o lib/checkdangerousfunctions.o lib/checkdangerousfunctions.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/classinfo.h lib/settings.h lib/errorlogger.h
|
||||||
$(CXX) $(CXXFLAGS) -Ilib -c -o lib/checkexceptionsafety.o lib/checkexceptionsafety.cpp
|
$(CXX) $(CXXFLAGS) -Ilib -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/mathlib.h lib/executionpath.h
|
lib/checkmemoryleak.o: lib/checkmemoryleak.cpp lib/checkmemoryleak.h lib/check.h lib/token.h lib/tokenize.h lib/classinfo.h lib/settings.h lib/errorlogger.h lib/mathlib.h lib/executionpath.h
|
||||||
$(CXX) $(CXXFLAGS) -Ilib -c -o lib/checkmemoryleak.o lib/checkmemoryleak.cpp
|
$(CXX) $(CXXFLAGS) -Ilib -c -o lib/checkmemoryleak.o lib/checkmemoryleak.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/executionpath.h
|
lib/checkother.o: lib/checkother.cpp lib/checkother.h lib/check.h lib/token.h lib/tokenize.h lib/classinfo.h lib/settings.h lib/errorlogger.h lib/mathlib.h lib/executionpath.h
|
||||||
$(CXX) $(CXXFLAGS) -Ilib -c -o lib/checkother.o lib/checkother.cpp
|
$(CXX) $(CXXFLAGS) -Ilib -c -o lib/checkother.o lib/checkother.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/checkstl.o: lib/checkstl.cpp lib/checkstl.h lib/check.h lib/token.h lib/tokenize.h lib/classinfo.h lib/settings.h lib/errorlogger.h
|
||||||
$(CXX) $(CXXFLAGS) -Ilib -c -o lib/checkstl.o lib/checkstl.cpp
|
$(CXX) $(CXXFLAGS) -Ilib -c -o lib/checkstl.o lib/checkstl.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/classinfo.h lib/settings.h lib/errorlogger.h
|
||||||
$(CXX) $(CXXFLAGS) -Ilib -c -o lib/checkunusedfunctions.o lib/checkunusedfunctions.cpp
|
$(CXX) $(CXXFLAGS) -Ilib -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/filelister.h lib/path.h
|
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/classinfo.h lib/preprocessor.h lib/filelister.h lib/path.h
|
||||||
$(CXX) $(CXXFLAGS) -Ilib -c -o lib/cppcheck.o lib/cppcheck.cpp
|
$(CXX) $(CXXFLAGS) -Ilib -c -o lib/cppcheck.o lib/cppcheck.cpp
|
||||||
|
|
||||||
lib/errorlogger.o: lib/errorlogger.cpp lib/errorlogger.h lib/path.h
|
lib/errorlogger.o: lib/errorlogger.cpp lib/errorlogger.h lib/path.h
|
||||||
|
@ -143,79 +143,79 @@ lib/filelister_unix.o: lib/filelister_unix.cpp lib/filelister.h lib/filelister_u
|
||||||
lib/filelister_win32.o: lib/filelister_win32.cpp lib/filelister.h lib/filelister_win32.h lib/path.h
|
lib/filelister_win32.o: lib/filelister_win32.cpp lib/filelister.h lib/filelister_win32.h lib/path.h
|
||||||
$(CXX) $(CXXFLAGS) -Ilib -c -o lib/filelister_win32.o lib/filelister_win32.cpp
|
$(CXX) $(CXXFLAGS) -Ilib -c -o lib/filelister_win32.o lib/filelister_win32.cpp
|
||||||
|
|
||||||
lib/mathlib.o: lib/mathlib.cpp lib/mathlib.h lib/tokenize.h
|
lib/mathlib.o: lib/mathlib.cpp lib/mathlib.h lib/tokenize.h lib/classinfo.h lib/token.h
|
||||||
$(CXX) $(CXXFLAGS) -Ilib -c -o lib/mathlib.o lib/mathlib.cpp
|
$(CXX) $(CXXFLAGS) -Ilib -c -o lib/mathlib.o lib/mathlib.cpp
|
||||||
|
|
||||||
lib/path.o: lib/path.cpp lib/path.h
|
lib/path.o: lib/path.cpp lib/path.h
|
||||||
$(CXX) $(CXXFLAGS) -Ilib -c -o lib/path.o lib/path.cpp
|
$(CXX) $(CXXFLAGS) -Ilib -c -o lib/path.o lib/path.cpp
|
||||||
|
|
||||||
lib/preprocessor.o: lib/preprocessor.cpp lib/preprocessor.h lib/tokenize.h lib/token.h lib/filelister.h lib/path.h lib/errorlogger.h lib/settings.h
|
lib/preprocessor.o: lib/preprocessor.cpp lib/preprocessor.h lib/tokenize.h lib/classinfo.h lib/token.h lib/filelister.h lib/path.h lib/errorlogger.h lib/settings.h
|
||||||
$(CXX) $(CXXFLAGS) -Ilib -c -o lib/preprocessor.o lib/preprocessor.cpp
|
$(CXX) $(CXXFLAGS) -Ilib -c -o lib/preprocessor.o lib/preprocessor.cpp
|
||||||
|
|
||||||
lib/settings.o: lib/settings.cpp lib/settings.h
|
lib/settings.o: lib/settings.cpp lib/settings.h
|
||||||
$(CXX) $(CXXFLAGS) -Ilib -c -o lib/settings.o lib/settings.cpp
|
$(CXX) $(CXXFLAGS) -Ilib -c -o lib/settings.o lib/settings.cpp
|
||||||
|
|
||||||
lib/token.o: lib/token.cpp lib/token.h lib/errorlogger.h lib/check.h lib/tokenize.h lib/settings.h
|
lib/token.o: lib/token.cpp lib/token.h lib/errorlogger.h lib/check.h lib/tokenize.h lib/classinfo.h lib/settings.h
|
||||||
$(CXX) $(CXXFLAGS) -Ilib -c -o lib/token.o lib/token.cpp
|
$(CXX) $(CXXFLAGS) -Ilib -c -o lib/token.o lib/token.cpp
|
||||||
|
|
||||||
lib/tokenize.o: lib/tokenize.cpp lib/tokenize.h lib/token.h lib/filelister.h lib/mathlib.h lib/settings.h lib/errorlogger.h lib/check.h lib/classinfo.h
|
lib/tokenize.o: lib/tokenize.cpp lib/tokenize.h lib/classinfo.h lib/token.h lib/filelister.h lib/mathlib.h lib/settings.h lib/errorlogger.h lib/check.h
|
||||||
$(CXX) $(CXXFLAGS) -Ilib -c -o lib/tokenize.o lib/tokenize.cpp
|
$(CXX) $(CXXFLAGS) -Ilib -c -o lib/tokenize.o lib/tokenize.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/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 lib/classinfo.h cli/threadexecutor.h
|
||||||
$(CXX) $(CXXFLAGS) -Ilib -c -o cli/cppcheckexecutor.o cli/cppcheckexecutor.cpp
|
$(CXX) $(CXXFLAGS) -Ilib -c -o cli/cppcheckexecutor.o cli/cppcheckexecutor.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
|
||||||
$(CXX) $(CXXFLAGS) -Ilib -c -o cli/main.o cli/main.cpp
|
$(CXX) $(CXXFLAGS) -Ilib -c -o cli/main.o cli/main.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
|
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 lib/classinfo.h
|
||||||
$(CXX) $(CXXFLAGS) -Ilib -c -o cli/threadexecutor.o cli/threadexecutor.cpp
|
$(CXX) $(CXXFLAGS) -Ilib -c -o cli/threadexecutor.o cli/threadexecutor.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/testautovariables.o: test/testautovariables.cpp lib/tokenize.h lib/classinfo.h lib/token.h lib/checkautovariables.h lib/check.h lib/settings.h lib/errorlogger.h test/testsuite.h
|
||||||
$(CXX) $(CXXFLAGS) -Ilib -Icli -c -o test/testautovariables.o test/testautovariables.cpp
|
$(CXX) $(CXXFLAGS) -Ilib -Icli -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 test/testsuite.h
|
test/testbufferoverrun.o: test/testbufferoverrun.cpp lib/tokenize.h lib/classinfo.h lib/token.h lib/checkbufferoverrun.h lib/check.h lib/settings.h lib/errorlogger.h test/testsuite.h
|
||||||
$(CXX) $(CXXFLAGS) -Ilib -Icli -c -o test/testbufferoverrun.o test/testbufferoverrun.cpp
|
$(CXX) $(CXXFLAGS) -Ilib -Icli -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/testcharvar.o: test/testcharvar.cpp lib/tokenize.h lib/classinfo.h lib/token.h lib/checkother.h lib/check.h lib/settings.h lib/errorlogger.h test/testsuite.h
|
||||||
$(CXX) $(CXXFLAGS) -Ilib -Icli -c -o test/testcharvar.o test/testcharvar.cpp
|
$(CXX) $(CXXFLAGS) -Ilib -Icli -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 test/testsuite.h
|
test/testclass.o: test/testclass.cpp lib/tokenize.h lib/classinfo.h lib/token.h lib/checkclass.h lib/check.h lib/settings.h lib/errorlogger.h test/testsuite.h
|
||||||
$(CXX) $(CXXFLAGS) -Ilib -Icli -c -o test/testclass.o test/testclass.cpp
|
$(CXX) $(CXXFLAGS) -Ilib -Icli -c -o test/testclass.o test/testclass.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 test/testsuite.h
|
test/testconstructors.o: test/testconstructors.cpp lib/tokenize.h lib/classinfo.h lib/token.h lib/checkclass.h lib/check.h lib/settings.h lib/errorlogger.h test/testsuite.h
|
||||||
$(CXX) $(CXXFLAGS) -Ilib -Icli -c -o test/testconstructors.o test/testconstructors.cpp
|
$(CXX) $(CXXFLAGS) -Ilib -Icli -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 lib/path.h test/tinyxml/tinyxml.h test/tinyxml/tinystr.h
|
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 lib/classinfo.h test/testsuite.h lib/path.h test/tinyxml/tinyxml.h test/tinyxml/tinystr.h
|
||||||
$(CXX) $(CXXFLAGS) -Ilib -Icli -c -o test/testcppcheck.o test/testcppcheck.cpp
|
$(CXX) $(CXXFLAGS) -Ilib -Icli -c -o test/testcppcheck.o test/testcppcheck.cpp
|
||||||
|
|
||||||
test/testdangerousfunctions.o: test/testdangerousfunctions.cpp lib/tokenize.h lib/checkdangerousfunctions.h lib/check.h lib/token.h lib/settings.h lib/errorlogger.h test/testsuite.h
|
test/testdangerousfunctions.o: test/testdangerousfunctions.cpp lib/tokenize.h lib/classinfo.h lib/token.h lib/checkdangerousfunctions.h lib/check.h lib/settings.h lib/errorlogger.h test/testsuite.h
|
||||||
$(CXX) $(CXXFLAGS) -Ilib -Icli -c -o test/testdangerousfunctions.o test/testdangerousfunctions.cpp
|
$(CXX) $(CXXFLAGS) -Ilib -Icli -c -o test/testdangerousfunctions.o test/testdangerousfunctions.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/testdivision.o: test/testdivision.cpp lib/tokenize.h lib/classinfo.h lib/token.h lib/checkother.h lib/check.h lib/settings.h lib/errorlogger.h test/testsuite.h
|
||||||
$(CXX) $(CXXFLAGS) -Ilib -Icli -c -o test/testdivision.o test/testdivision.cpp
|
$(CXX) $(CXXFLAGS) -Ilib -Icli -c -o test/testdivision.o test/testdivision.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/testexceptionsafety.o: test/testexceptionsafety.cpp lib/tokenize.h lib/classinfo.h lib/token.h lib/checkexceptionsafety.h lib/check.h lib/settings.h lib/errorlogger.h test/testsuite.h
|
||||||
$(CXX) $(CXXFLAGS) -Ilib -Icli -c -o test/testexceptionsafety.o test/testexceptionsafety.cpp
|
$(CXX) $(CXXFLAGS) -Ilib -Icli -c -o test/testexceptionsafety.o test/testexceptionsafety.cpp
|
||||||
|
|
||||||
test/testfilelister.o: test/testfilelister.cpp test/testsuite.h lib/errorlogger.h lib/filelister_win32.h lib/filelister.h lib/filelister_unix.h
|
test/testfilelister.o: test/testfilelister.cpp test/testsuite.h lib/errorlogger.h lib/filelister_win32.h lib/filelister.h lib/filelister_unix.h
|
||||||
$(CXX) $(CXXFLAGS) -Ilib -Icli -c -o test/testfilelister.o test/testfilelister.cpp
|
$(CXX) $(CXXFLAGS) -Ilib -Icli -c -o test/testfilelister.o test/testfilelister.cpp
|
||||||
|
|
||||||
test/testincompletestatement.o: test/testincompletestatement.cpp test/testsuite.h lib/errorlogger.h lib/tokenize.h lib/checkother.h lib/check.h lib/token.h lib/settings.h
|
test/testincompletestatement.o: test/testincompletestatement.cpp test/testsuite.h lib/errorlogger.h lib/tokenize.h lib/classinfo.h lib/token.h lib/checkother.h lib/check.h lib/settings.h
|
||||||
$(CXX) $(CXXFLAGS) -Ilib -Icli -c -o test/testincompletestatement.o test/testincompletestatement.cpp
|
$(CXX) $(CXXFLAGS) -Ilib -Icli -c -o test/testincompletestatement.o test/testincompletestatement.cpp
|
||||||
|
|
||||||
test/testmathlib.o: test/testmathlib.cpp lib/mathlib.h test/testsuite.h lib/errorlogger.h
|
test/testmathlib.o: test/testmathlib.cpp lib/mathlib.h test/testsuite.h lib/errorlogger.h
|
||||||
$(CXX) $(CXXFLAGS) -Ilib -Icli -c -o test/testmathlib.o test/testmathlib.cpp
|
$(CXX) $(CXXFLAGS) -Ilib -Icli -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 test/testsuite.h
|
test/testmemleak.o: test/testmemleak.cpp lib/tokenize.h lib/classinfo.h lib/token.h lib/checkmemoryleak.h lib/check.h lib/settings.h lib/errorlogger.h test/testsuite.h
|
||||||
$(CXX) $(CXXFLAGS) -Ilib -Icli -c -o test/testmemleak.o test/testmemleak.cpp
|
$(CXX) $(CXXFLAGS) -Ilib -Icli -c -o test/testmemleak.o test/testmemleak.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/testother.o: test/testother.cpp lib/tokenize.h lib/classinfo.h lib/token.h lib/checkother.h lib/check.h lib/settings.h lib/errorlogger.h test/testsuite.h
|
||||||
$(CXX) $(CXXFLAGS) -Ilib -Icli -c -o test/testother.o test/testother.cpp
|
$(CXX) $(CXXFLAGS) -Ilib -Icli -c -o test/testother.o test/testother.cpp
|
||||||
|
|
||||||
test/testpreprocessor.o: test/testpreprocessor.cpp test/testsuite.h lib/errorlogger.h lib/preprocessor.h lib/tokenize.h lib/token.h lib/settings.h
|
test/testpreprocessor.o: test/testpreprocessor.cpp test/testsuite.h lib/errorlogger.h lib/preprocessor.h lib/tokenize.h lib/classinfo.h lib/token.h lib/settings.h
|
||||||
$(CXX) $(CXXFLAGS) -Ilib -Icli -c -o test/testpreprocessor.o test/testpreprocessor.cpp
|
$(CXX) $(CXXFLAGS) -Ilib -Icli -c -o test/testpreprocessor.o test/testpreprocessor.cpp
|
||||||
|
|
||||||
test/testredundantif.o: test/testredundantif.cpp lib/tokenize.h lib/checkother.h lib/check.h lib/token.h lib/settings.h lib/errorlogger.h test/testsuite.h
|
test/testredundantif.o: test/testredundantif.cpp lib/tokenize.h lib/classinfo.h lib/token.h lib/checkother.h lib/check.h lib/settings.h lib/errorlogger.h test/testsuite.h
|
||||||
$(CXX) $(CXXFLAGS) -Ilib -Icli -c -o test/testredundantif.o test/testredundantif.cpp
|
$(CXX) $(CXXFLAGS) -Ilib -Icli -c -o test/testredundantif.o test/testredundantif.cpp
|
||||||
|
|
||||||
test/testrunner.o: test/testrunner.cpp test/testsuite.h lib/errorlogger.h
|
test/testrunner.o: test/testrunner.cpp test/testsuite.h lib/errorlogger.h
|
||||||
|
@ -224,31 +224,31 @@ test/testrunner.o: test/testrunner.cpp test/testsuite.h lib/errorlogger.h
|
||||||
test/testsettings.o: test/testsettings.cpp lib/settings.h test/testsuite.h lib/errorlogger.h
|
test/testsettings.o: test/testsettings.cpp lib/settings.h test/testsuite.h lib/errorlogger.h
|
||||||
$(CXX) $(CXXFLAGS) -Ilib -Icli -c -o test/testsettings.o test/testsettings.cpp
|
$(CXX) $(CXXFLAGS) -Ilib -Icli -c -o test/testsettings.o test/testsettings.cpp
|
||||||
|
|
||||||
test/testsimplifytokens.o: test/testsimplifytokens.cpp test/testsuite.h lib/errorlogger.h lib/tokenize.h lib/token.h lib/settings.h
|
test/testsimplifytokens.o: test/testsimplifytokens.cpp test/testsuite.h lib/errorlogger.h lib/tokenize.h lib/classinfo.h lib/token.h lib/settings.h
|
||||||
$(CXX) $(CXXFLAGS) -Ilib -Icli -c -o test/testsimplifytokens.o test/testsimplifytokens.cpp
|
$(CXX) $(CXXFLAGS) -Ilib -Icli -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/teststl.o: test/teststl.cpp lib/tokenize.h lib/classinfo.h lib/token.h lib/checkstl.h lib/check.h lib/settings.h lib/errorlogger.h test/testsuite.h
|
||||||
$(CXX) $(CXXFLAGS) -Ilib -Icli -c -o test/teststl.o test/teststl.cpp
|
$(CXX) $(CXXFLAGS) -Ilib -Icli -c -o test/teststl.o test/teststl.cpp
|
||||||
|
|
||||||
test/testsuite.o: test/testsuite.cpp test/testsuite.h lib/errorlogger.h
|
test/testsuite.o: test/testsuite.cpp test/testsuite.h lib/errorlogger.h
|
||||||
$(CXX) $(CXXFLAGS) -Ilib -Icli -c -o test/testsuite.o test/testsuite.cpp
|
$(CXX) $(CXXFLAGS) -Ilib -Icli -c -o test/testsuite.o test/testsuite.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/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 lib/classinfo.h test/testsuite.h
|
||||||
$(CXX) $(CXXFLAGS) -Ilib -Icli -c -o test/testthreadexecutor.o test/testthreadexecutor.cpp
|
$(CXX) $(CXXFLAGS) -Ilib -Icli -c -o test/testthreadexecutor.o test/testthreadexecutor.cpp
|
||||||
|
|
||||||
test/testtoken.o: test/testtoken.cpp test/testsuite.h lib/errorlogger.h lib/tokenize.h lib/token.h
|
test/testtoken.o: test/testtoken.cpp test/testsuite.h lib/errorlogger.h lib/tokenize.h lib/classinfo.h lib/token.h
|
||||||
$(CXX) $(CXXFLAGS) -Ilib -Icli -c -o test/testtoken.o test/testtoken.cpp
|
$(CXX) $(CXXFLAGS) -Ilib -Icli -c -o test/testtoken.o test/testtoken.cpp
|
||||||
|
|
||||||
test/testtokenize.o: test/testtokenize.cpp test/testsuite.h lib/errorlogger.h lib/tokenize.h lib/token.h lib/classinfo.h lib/settings.h
|
test/testtokenize.o: test/testtokenize.cpp test/testsuite.h lib/errorlogger.h lib/tokenize.h lib/classinfo.h lib/token.h lib/settings.h
|
||||||
$(CXX) $(CXXFLAGS) -Ilib -Icli -c -o test/testtokenize.o test/testtokenize.cpp
|
$(CXX) $(CXXFLAGS) -Ilib -Icli -c -o test/testtokenize.o test/testtokenize.cpp
|
||||||
|
|
||||||
test/testunusedfunctions.o: test/testunusedfunctions.cpp lib/tokenize.h test/testsuite.h lib/errorlogger.h lib/checkunusedfunctions.h lib/check.h lib/token.h lib/settings.h
|
test/testunusedfunctions.o: test/testunusedfunctions.cpp lib/tokenize.h lib/classinfo.h lib/token.h test/testsuite.h lib/errorlogger.h lib/checkunusedfunctions.h lib/check.h lib/settings.h
|
||||||
$(CXX) $(CXXFLAGS) -Ilib -Icli -c -o test/testunusedfunctions.o test/testunusedfunctions.cpp
|
$(CXX) $(CXXFLAGS) -Ilib -Icli -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 test/testsuite.h
|
test/testunusedprivfunc.o: test/testunusedprivfunc.cpp lib/tokenize.h lib/classinfo.h lib/token.h lib/checkclass.h lib/check.h lib/settings.h lib/errorlogger.h test/testsuite.h
|
||||||
$(CXX) $(CXXFLAGS) -Ilib -Icli -c -o test/testunusedprivfunc.o test/testunusedprivfunc.cpp
|
$(CXX) $(CXXFLAGS) -Ilib -Icli -c -o test/testunusedprivfunc.o test/testunusedprivfunc.cpp
|
||||||
|
|
||||||
test/testunusedvar.o: test/testunusedvar.cpp test/testsuite.h lib/errorlogger.h lib/tokenize.h lib/checkother.h lib/check.h lib/token.h lib/settings.h
|
test/testunusedvar.o: test/testunusedvar.cpp test/testsuite.h lib/errorlogger.h lib/tokenize.h lib/classinfo.h lib/token.h lib/checkother.h lib/check.h lib/settings.h
|
||||||
$(CXX) $(CXXFLAGS) -Ilib -Icli -c -o test/testunusedvar.o test/testunusedvar.cpp
|
$(CXX) $(CXXFLAGS) -Ilib -Icli -c -o test/testunusedvar.o test/testunusedvar.cpp
|
||||||
|
|
||||||
test/tinyxml/tinystr.o: test/tinyxml/tinystr.cpp test/tinyxml/tinystr.h
|
test/tinyxml/tinystr.o: test/tinyxml/tinystr.cpp test/tinyxml/tinystr.h
|
||||||
|
|
|
@ -61,7 +61,7 @@ void CheckBufferOverrun::arrayIndexOutOfBounds(const Token *tok, int size, int i
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CheckBufferOverrun::arrayIndexOutOfBounds(const Token *tok, const ArrayInfo &arrayInfo, const std::vector<int> &index)
|
void CheckBufferOverrun::arrayIndexOutOfBounds(const Token *tok, const ArrayInfo &arrayInfo, const std::vector<unsigned int> &index)
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
oss << "Array '" << arrayInfo.varname;
|
oss << "Array '" << arrayInfo.varname;
|
||||||
|
@ -80,7 +80,7 @@ void CheckBufferOverrun::arrayIndexOutOfBounds(const Token *tok, const ArrayInfo
|
||||||
reportError(tok, Severity::error, "arrayIndexOutOfBounds", oss.str().c_str());
|
reportError(tok, Severity::error, "arrayIndexOutOfBounds", oss.str().c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CheckBufferOverrun::arrayIndexOutOfBounds(const std::list<const Token *> &callstack, const ArrayInfo &arrayInfo, const std::vector<int> &index)
|
void CheckBufferOverrun::arrayIndexOutOfBounds(const std::list<const Token *> &callstack, const ArrayInfo &arrayInfo, const std::vector<unsigned int> &index)
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
oss << "Array '" << arrayInfo.varname;
|
oss << "Array '" << arrayInfo.varname;
|
||||||
|
@ -586,17 +586,17 @@ void CheckBufferOverrun::checkFunctionCall(const Token &tok, unsigned int par, c
|
||||||
{
|
{
|
||||||
if (Token::Match(ftok->previous(), "[=+-*/;{}] %var% [ %num% ]"))
|
if (Token::Match(ftok->previous(), "[=+-*/;{}] %var% [ %num% ]"))
|
||||||
{
|
{
|
||||||
unsigned long index = MathLib::toLongNumber(ftok->strAt(2));
|
long index = MathLib::toLongNumber(ftok->strAt(2));
|
||||||
if (index >= arrayInfo.num[0])
|
if (index >= arrayInfo.num[0])
|
||||||
{
|
{
|
||||||
std::list<const Token *> callstack;
|
std::list<const Token *> callstack;
|
||||||
callstack.push_back(&tok);
|
callstack.push_back(&tok);
|
||||||
callstack.push_back(ftok);
|
callstack.push_back(ftok);
|
||||||
|
|
||||||
std::vector<int> ints;
|
std::vector<unsigned int> indexes;
|
||||||
ints.push_back(index);
|
indexes.push_back(index);
|
||||||
|
|
||||||
arrayIndexOutOfBounds(callstack, arrayInfo, ints);
|
arrayIndexOutOfBounds(callstack, arrayInfo, indexes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -613,7 +613,7 @@ void CheckBufferOverrun::checkScope(const Token *tok, const std::vector<std::str
|
||||||
for (unsigned int i = 0; i < varname.size(); ++i)
|
for (unsigned int i = 0; i < varname.size(); ++i)
|
||||||
varnames += (i == 0 ? "" : " . ") + varname[i];
|
varnames += (i == 0 ? "" : " . ") + varname[i];
|
||||||
|
|
||||||
const unsigned int varc(varname.empty() ? 0 : (varname.size() - 1) * 2);
|
const unsigned char varc(varname.empty() ? 0U : (varname.size() - 1) * 2U);
|
||||||
|
|
||||||
if (Token::Match(tok, "return"))
|
if (Token::Match(tok, "return"))
|
||||||
{
|
{
|
||||||
|
@ -702,7 +702,7 @@ void CheckBufferOverrun::checkScope(const Token *tok, const std::vector<std::str
|
||||||
// memset, memcmp, memcpy, strncpy, fgets..
|
// memset, memcmp, memcpy, strncpy, fgets..
|
||||||
if (varid == 0)
|
if (varid == 0)
|
||||||
{
|
{
|
||||||
ArrayInfo arrayInfo(0, varnames, 1, total_size);
|
ArrayInfo arrayInfo(0U, varnames, 1U, static_cast<unsigned int>(total_size));
|
||||||
if (Token::Match(tok, ("%var% ( " + varnames + " ,").c_str()))
|
if (Token::Match(tok, ("%var% ( " + varnames + " ,").c_str()))
|
||||||
checkFunctionCall(*tok, 1, arrayInfo);
|
checkFunctionCall(*tok, 1, arrayInfo);
|
||||||
if (Token::Match(tok, ("%var% ( %var% , " + varnames + " ,").c_str()))
|
if (Token::Match(tok, ("%var% ( %var% , " + varnames + " ,").c_str()))
|
||||||
|
@ -748,19 +748,18 @@ void CheckBufferOverrun::checkScope(const Token *tok, const std::vector<std::str
|
||||||
if (for_bailout(tok2->next(), counter_varid))
|
if (for_bailout(tok2->next(), counter_varid))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
ArrayInfo arrayInfo(varid, varnames, size, total_size);
|
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);
|
parse_for_body(tok2->next(), arrayInfo, strindex, condition_out_of_bounds, counter_varid, min_counter_value, max_counter_value);
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Writing data into array..
|
// Writing data into array..
|
||||||
if ((varid > 0 && Token::Match(tok, "strcpy|strcat ( %varid% , %str% )", varid)) ||
|
if ((varid > 0 && Token::Match(tok, "strcpy|strcat ( %varid% , %str% )", varid)) ||
|
||||||
(varid == 0 && Token::Match(tok, ("strcpy|strcat ( " + varnames + " , %str% )").c_str())))
|
(varid == 0 && Token::Match(tok, ("strcpy|strcat ( " + varnames + " , %str% )").c_str())))
|
||||||
{
|
{
|
||||||
const long len = Token::getStrLength(tok->tokAt(varc + 4));
|
const size_t len = Token::getStrLength(tok->tokAt(varc + 4));
|
||||||
if (len < 0 || len >= total_size)
|
if (total_size > 0 && len >= static_cast<unsigned int>(total_size))
|
||||||
{
|
{
|
||||||
bufferOverrun(tok, varid > 0 ? "" : varnames.c_str());
|
bufferOverrun(tok, varid > 0 ? "" : varnames.c_str());
|
||||||
continue;
|
continue;
|
||||||
|
@ -788,17 +787,18 @@ void CheckBufferOverrun::checkScope(const Token *tok, const std::vector<std::str
|
||||||
}
|
}
|
||||||
|
|
||||||
// sprintf..
|
// sprintf..
|
||||||
|
// TODO: change total_size to an unsigned value and remove the "&& total_size > 0" check.
|
||||||
const std::string sprintfPattern = varid > 0 ? std::string("sprintf ( %varid% , %str% [,)]") : ("sprintf ( " + varnames + " , %str% [,)]");
|
const std::string sprintfPattern = varid > 0 ? std::string("sprintf ( %varid% , %str% [,)]") : ("sprintf ( " + varnames + " , %str% [,)]");
|
||||||
if (Token::Match(tok, sprintfPattern.c_str(), varid))
|
if (Token::Match(tok, sprintfPattern.c_str(), varid) && total_size > 0)
|
||||||
{
|
{
|
||||||
checkSprintfCall(tok, total_size);
|
checkSprintfCall(tok, static_cast<unsigned int>(total_size));
|
||||||
}
|
}
|
||||||
|
|
||||||
// snprintf..
|
// snprintf..
|
||||||
const std::string snprintfPattern = varid > 0 ? std::string("snprintf ( %varid% , %num% ,") : ("snprintf ( " + varnames + " , %num% ,");
|
const std::string snprintfPattern = varid > 0 ? std::string("snprintf ( %varid% , %num% ,") : ("snprintf ( " + varnames + " , %num% ,");
|
||||||
if (Token::Match(tok, snprintfPattern.c_str(), varid))
|
if (Token::Match(tok, snprintfPattern.c_str(), varid))
|
||||||
{
|
{
|
||||||
int n = MathLib::toLongNumber(tok->strAt(4 + varc));
|
const long n = MathLib::toLongNumber(tok->strAt(4 + varc));
|
||||||
if (n > total_size)
|
if (n > total_size)
|
||||||
outOfBounds(tok->tokAt(4 + varc), "snprintf size");
|
outOfBounds(tok->tokAt(4 + varc), "snprintf size");
|
||||||
}
|
}
|
||||||
|
@ -833,16 +833,16 @@ void CheckBufferOverrun::checkScope(const Token *tok, const ArrayInfo &arrayInfo
|
||||||
|
|
||||||
else if (Token::Match(tok, "%varid% [ %num% ]", arrayInfo.varid))
|
else if (Token::Match(tok, "%varid% [ %num% ]", arrayInfo.varid))
|
||||||
{
|
{
|
||||||
std::vector<int> indexes;
|
std::vector<unsigned int> indexes;
|
||||||
for (const Token *tok2 = tok->next(); Token::Match(tok2, "[ %num% ]"); tok2 = tok2->tokAt(3))
|
for (const Token *tok2 = tok->next(); Token::Match(tok2, "[ %num% ]"); tok2 = tok2->tokAt(3))
|
||||||
{
|
{
|
||||||
const int index = MathLib::toLongNumber(tok2->strAt(1));
|
const long index = MathLib::toLongNumber(tok2->strAt(1));
|
||||||
if (index < 0)
|
if (index < 0)
|
||||||
{
|
{
|
||||||
indexes.clear();
|
indexes.clear();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
indexes.push_back(index);
|
indexes.push_back(static_cast<unsigned int>(index));
|
||||||
}
|
}
|
||||||
if (indexes.size() == arrayInfo.num.size())
|
if (indexes.size() == arrayInfo.num.size())
|
||||||
{
|
{
|
||||||
|
@ -1090,7 +1090,7 @@ void CheckBufferOverrun::checkGlobalAndLocalVariable()
|
||||||
|
|
||||||
if (Token::Match(tok, "%type% *| %var% [ %var% ] [;=]"))
|
if (Token::Match(tok, "%type% *| %var% [ %var% ] [;=]"))
|
||||||
{
|
{
|
||||||
unsigned int varpos = 1;
|
unsigned char varpos = 1;
|
||||||
if (tok->next()->str() == "*")
|
if (tok->next()->str() == "*")
|
||||||
++varpos;
|
++varpos;
|
||||||
|
|
||||||
|
@ -1186,7 +1186,7 @@ void CheckBufferOverrun::checkGlobalAndLocalVariable()
|
||||||
// manually
|
// manually
|
||||||
unsigned int sizeOfType = _tokenizer->sizeOfType(declTok->next());
|
unsigned int sizeOfType = _tokenizer->sizeOfType(declTok->next());
|
||||||
if (sizeOfType > 0)
|
if (sizeOfType > 0)
|
||||||
size /= sizeOfType;
|
size /= static_cast<int>(sizeOfType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1199,7 +1199,7 @@ void CheckBufferOverrun::checkGlobalAndLocalVariable()
|
||||||
|
|
||||||
Token sizeTok(0);
|
Token sizeTok(0);
|
||||||
sizeTok.str(type);
|
sizeTok.str(type);
|
||||||
int total_size = size * _tokenizer->sizeOfType(&sizeTok);
|
int total_size = size * static_cast<int>(_tokenizer->sizeOfType(&sizeTok));
|
||||||
if (total_size == 0)
|
if (total_size == 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -1266,7 +1266,7 @@ void CheckBufferOverrun::checkStructVariable()
|
||||||
if (Token::simpleMatch(tok4, ") {"))
|
if (Token::simpleMatch(tok4, ") {"))
|
||||||
{
|
{
|
||||||
std::vector<std::string> v;
|
std::vector<std::string> v;
|
||||||
checkScope(tok4->tokAt(2), v, arrayInfo.num[0], arrayInfo.num[0] * arrayInfo.element_size, arrayInfo.varid);
|
checkScope(tok4->tokAt(2), v, static_cast<int>(arrayInfo.num[0]), static_cast<int>(arrayInfo.num[0] * arrayInfo.element_size), arrayInfo.varid);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1323,7 +1323,7 @@ void CheckBufferOverrun::checkStructVariable()
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Check variable usage..
|
// Check variable usage..
|
||||||
checkScope(CheckTok, varname, arrayInfo.num[0], arrayInfo.num[0] * arrayInfo.element_size, 0);
|
checkScope(CheckTok, varname, static_cast<int>(arrayInfo.num[0]), static_cast<int>(arrayInfo.num[0] * arrayInfo.element_size), 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1340,10 +1340,10 @@ void CheckBufferOverrun::bufferOverrun()
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
int CheckBufferOverrun::countSprintfLength(const std::string &input_string, const std::list<const Token*> ¶meters)
|
unsigned int CheckBufferOverrun::countSprintfLength(const std::string &input_string, const std::list<const Token*> ¶meters)
|
||||||
{
|
{
|
||||||
bool percentCharFound = false;
|
bool percentCharFound = false;
|
||||||
int input_string_size = 1;
|
unsigned int input_string_size = 1;
|
||||||
bool handleNextParameter = false;
|
bool handleNextParameter = false;
|
||||||
std::string digits_string = "";
|
std::string digits_string = "";
|
||||||
bool i_d_x_f_found = false;
|
bool i_d_x_f_found = false;
|
||||||
|
@ -1408,14 +1408,14 @@ int CheckBufferOverrun::countSprintfLength(const std::string &input_string, cons
|
||||||
|
|
||||||
if (handleNextParameter)
|
if (handleNextParameter)
|
||||||
{
|
{
|
||||||
unsigned int tempDigits = std::abs(std::atoi(digits_string.c_str()));
|
unsigned int tempDigits = static_cast<unsigned int>(std::abs(std::atoi(digits_string.c_str())));
|
||||||
if (i_d_x_f_found)
|
if (i_d_x_f_found)
|
||||||
tempDigits = std::max(static_cast<int>(tempDigits), 1);
|
tempDigits = std::max(static_cast<unsigned int>(tempDigits), 1U);
|
||||||
|
|
||||||
if (digits_string.find('.') != std::string::npos)
|
if (digits_string.find('.') != std::string::npos)
|
||||||
{
|
{
|
||||||
const std::string endStr = digits_string.substr(digits_string.find('.') + 1);
|
const std::string endStr = digits_string.substr(digits_string.find('.') + 1);
|
||||||
unsigned int maxLen = std::max(std::abs(std::atoi(endStr.c_str())), 1);
|
unsigned int maxLen = std::max(static_cast<unsigned int>(std::abs(std::atoi(endStr.c_str()))), 1U);
|
||||||
|
|
||||||
if (input_string[i] == 's')
|
if (input_string[i] == 's')
|
||||||
{
|
{
|
||||||
|
@ -1451,7 +1451,7 @@ int CheckBufferOverrun::countSprintfLength(const std::string &input_string, cons
|
||||||
return input_string_size;
|
return input_string_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CheckBufferOverrun::checkSprintfCall(const Token *tok, int size)
|
void CheckBufferOverrun::checkSprintfCall(const Token *tok, const unsigned int size)
|
||||||
{
|
{
|
||||||
const Token *end = tok->next()->link();
|
const Token *end = tok->next()->link();
|
||||||
|
|
||||||
|
@ -1471,7 +1471,6 @@ void CheckBufferOverrun::checkSprintfCall(const Token *tok, int size)
|
||||||
{
|
{
|
||||||
if (Token::Match(tok2, ", %any% [,)]"))
|
if (Token::Match(tok2, ", %any% [,)]"))
|
||||||
{
|
{
|
||||||
|
|
||||||
if (Token::Match(tok2->next(), "%str%"))
|
if (Token::Match(tok2->next(), "%str%"))
|
||||||
parameters.push_back(tok2->next());
|
parameters.push_back(tok2->next());
|
||||||
|
|
||||||
|
@ -1512,7 +1511,7 @@ void CheckBufferOverrun::checkSprintfCall(const Token *tok, int size)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int len = countSprintfLength(tok->tokAt(4 + varc)->strValue(), parameters);
|
unsigned int len = countSprintfLength(tok->tokAt(4 + varc)->strValue(), parameters);
|
||||||
if (len > size)
|
if (len > size)
|
||||||
{
|
{
|
||||||
bufferOverrun(tok);
|
bufferOverrun(tok);
|
||||||
|
@ -1920,7 +1919,7 @@ private:
|
||||||
CheckBufferOverrun *checkBufferOverrun = dynamic_cast<CheckBufferOverrun *>(c->owner);
|
CheckBufferOverrun *checkBufferOverrun = dynamic_cast<CheckBufferOverrun *>(c->owner);
|
||||||
if (checkBufferOverrun)
|
if (checkBufferOverrun)
|
||||||
{
|
{
|
||||||
std::vector<int> index;
|
std::vector<unsigned int> index;
|
||||||
index.push_back(c->value);
|
index.push_back(c->value);
|
||||||
checkBufferOverrun->arrayIndexOutOfBounds(tok, ai, index);
|
checkBufferOverrun->arrayIndexOutOfBounds(tok, ai, index);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -79,7 +79,7 @@ public:
|
||||||
* @param parameters given parameters to sprintf
|
* @param parameters given parameters to sprintf
|
||||||
* @return minimum length of resulting string
|
* @return minimum length of resulting string
|
||||||
*/
|
*/
|
||||||
static int countSprintfLength(const std::string &input_string, const std::list<const Token*> ¶meters);
|
static unsigned int countSprintfLength(const std::string &input_string, const std::list<const Token*> ¶meters);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief %Check code that matches: "sprintf ( %varid% , %str% [,)]" when varid is not 0,
|
* @brief %Check code that matches: "sprintf ( %varid% , %str% [,)]" when varid is not 0,
|
||||||
|
@ -87,7 +87,7 @@ public:
|
||||||
* @param tok The "sprintf" token.
|
* @param tok The "sprintf" token.
|
||||||
* @param size The size of the buffer where sprintf is writing.
|
* @param size The size of the buffer where sprintf is writing.
|
||||||
*/
|
*/
|
||||||
void checkSprintfCall(const Token *tok, int size);
|
void checkSprintfCall(const Token *tok, const unsigned int size);
|
||||||
|
|
||||||
/** Check for buffer overruns - locate struct variables and check them with the .._CheckScope function */
|
/** Check for buffer overruns - locate struct variables and check them with the .._CheckScope function */
|
||||||
void checkStructVariable();
|
void checkStructVariable();
|
||||||
|
@ -176,8 +176,8 @@ public:
|
||||||
void checkFunctionCall(const Token &tok, const unsigned int par, const ArrayInfo &arrayInfo);
|
void checkFunctionCall(const Token &tok, const unsigned int par, const ArrayInfo &arrayInfo);
|
||||||
|
|
||||||
void arrayIndexOutOfBounds(const Token *tok, int size, int index);
|
void arrayIndexOutOfBounds(const Token *tok, int size, int index);
|
||||||
void arrayIndexOutOfBounds(const Token *tok, const ArrayInfo &arrayInfo, const std::vector<int> &index);
|
void arrayIndexOutOfBounds(const Token *tok, const ArrayInfo &arrayInfo, const std::vector<unsigned int> &index);
|
||||||
void arrayIndexOutOfBounds(const std::list<const Token *> &callstack, const ArrayInfo &arrayInfo, const std::vector<int> &index);
|
void arrayIndexOutOfBounds(const std::list<const Token *> &callstack, const ArrayInfo &arrayInfo, const std::vector<unsigned int> &index);
|
||||||
void bufferOverrun(const Token *tok, const std::string &varnames = "");
|
void bufferOverrun(const Token *tok, const std::string &varnames = "");
|
||||||
void strncatUsage(const Token *tok);
|
void strncatUsage(const Token *tok);
|
||||||
void outOfBounds(const Token *tok, const std::string &what);
|
void outOfBounds(const Token *tok, const std::string &what);
|
||||||
|
|
|
@ -777,7 +777,7 @@ bool CheckClass::argsMatch(const Token *first, const Token *second, const std::s
|
||||||
|
|
||||||
if (Token::Match(second->next(), param.c_str()))
|
if (Token::Match(second->next(), param.c_str()))
|
||||||
{
|
{
|
||||||
second = second->tokAt(depth * 2);
|
second = second->tokAt(int(depth) * 2);
|
||||||
}
|
}
|
||||||
else if (depth > 1)
|
else if (depth > 1)
|
||||||
{
|
{
|
||||||
|
@ -794,7 +794,7 @@ bool CheckClass::argsMatch(const Token *first, const Token *second, const std::s
|
||||||
|
|
||||||
if (Token::Match(second->next(), param.c_str()))
|
if (Token::Match(second->next(), param.c_str()))
|
||||||
{
|
{
|
||||||
second = second->tokAt((depth - 1) * 2);
|
second = second->tokAt((int(depth) - 1) * 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1892,7 +1892,7 @@ void CheckClass::checkConst()
|
||||||
const std::string s(previous->str());
|
const std::string s(previous->str());
|
||||||
for (std::string::size_type pos = 0; pos < s.size(); ++pos)
|
for (std::string::size_type pos = 0; pos < s.size(); ++pos)
|
||||||
{
|
{
|
||||||
unsigned char ch = s[pos];
|
const char ch = s[pos];
|
||||||
if (!(ch == '_' || (ch >= 'A' && ch <= 'Z')))
|
if (!(ch == '_' || (ch >= 'A' && ch <= 'Z')))
|
||||||
{
|
{
|
||||||
allupper = false;
|
allupper = false;
|
||||||
|
|
|
@ -71,7 +71,7 @@ std::string FileLister::simplifyPath(const char *originalPath)
|
||||||
if (subPath.length() > 0)
|
if (subPath.length() > 0)
|
||||||
pathParts.push_back(subPath);
|
pathParts.push_back(subPath);
|
||||||
|
|
||||||
for (std::vector<std::string>::size_type i = 0; i < pathParts.size(); ++i)
|
for (unsigned int i = 0; i < pathParts.size(); ++i)
|
||||||
{
|
{
|
||||||
if (pathParts[i] == ".." && i > 1 && pathParts.size() > i + 1)
|
if (pathParts[i] == ".." && i > 1 && pathParts.size() > i + 1)
|
||||||
{
|
{
|
||||||
|
|
|
@ -219,7 +219,7 @@ std::string Preprocessor::removeComments(const std::string &str, const std::stri
|
||||||
unsigned char previous = 0;
|
unsigned char previous = 0;
|
||||||
std::vector<std::string> suppressionIDs;
|
std::vector<std::string> suppressionIDs;
|
||||||
|
|
||||||
for (std::string::size_type i = static_cast<unsigned char>(hasbom(str) ? 3 : 0); i < str.length(); ++i)
|
for (std::string::size_type i = hasbom(str) ? 3U : 0U; i < str.length(); ++i)
|
||||||
{
|
{
|
||||||
unsigned char ch = static_cast<unsigned char>(str[i]);
|
unsigned char ch = static_cast<unsigned char>(str[i]);
|
||||||
if (ch & 0x80)
|
if (ch & 0x80)
|
||||||
|
|
|
@ -684,7 +684,7 @@ std::string Token::stringifyList(bool varid, const char *title, const std::vecto
|
||||||
|
|
||||||
unsigned int lineNumber = 0;
|
unsigned int lineNumber = 0;
|
||||||
int fileInd = -1;
|
int fileInd = -1;
|
||||||
std::map<unsigned int, unsigned int> lineNumbers;
|
std::map<int, unsigned int> lineNumbers;
|
||||||
for (const Token *tok = this; tok; tok = tok->next())
|
for (const Token *tok = this; tok; tok = tok->next())
|
||||||
{
|
{
|
||||||
bool fileChange = false;
|
bool fileChange = false;
|
||||||
|
@ -697,8 +697,8 @@ std::string Token::stringifyList(bool varid, const char *title, const std::vecto
|
||||||
|
|
||||||
fileInd = static_cast<int>(tok->_fileIndex);
|
fileInd = static_cast<int>(tok->_fileIndex);
|
||||||
ret << "\n\n##file ";
|
ret << "\n\n##file ";
|
||||||
if (fileNames.size() > static_cast<unsigned int>(fileInd))
|
if (fileNames.size() > tok->_fileIndex)
|
||||||
ret << fileNames.at(fileInd);
|
ret << fileNames.at(tok->_fileIndex);
|
||||||
else
|
else
|
||||||
ret << fileInd;
|
ret << fileInd;
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,7 @@ private:
|
||||||
* Execute check using n jobs for y files which are have
|
* Execute check using n jobs for y files which are have
|
||||||
* identical data, given within data.
|
* identical data, given within data.
|
||||||
*/
|
*/
|
||||||
void check(int jobs, int files, int result, const std::string &data)
|
void check(unsigned int jobs, int files, int result, const std::string &data)
|
||||||
{
|
{
|
||||||
errout.str("");
|
errout.str("");
|
||||||
output.str("");
|
output.str("");
|
||||||
|
|
|
@ -163,6 +163,7 @@ int main(int argc, char **argv)
|
||||||
<< "-Wno-long-long "
|
<< "-Wno-long-long "
|
||||||
<< "-Wfloat-equal "
|
<< "-Wfloat-equal "
|
||||||
<< "-Wcast-qual "
|
<< "-Wcast-qual "
|
||||||
|
<< "-Wsign-conversion "
|
||||||
<< "-g -D_GLIBCXX_DEBUG\n";
|
<< "-g -D_GLIBCXX_DEBUG\n";
|
||||||
}
|
}
|
||||||
fout << "CXX=g++\n";
|
fout << "CXX=g++\n";
|
||||||
|
|
Loading…
Reference in New Issue