diff --git a/Makefile b/Makefile index b10e022f9..e658955e2 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ # This file is generated by tools/dmake, do not edit. ifndef CXXFLAGS - CXXFLAGS=-Wall -Wextra -Wshadow -pedantic -Wno-long-long -Wfloat-equal -Wcast-qual -Wsign-conversion -g + CXXFLAGS=-Wall -Wextra -Wshadow -pedantic -Wno-long-long -Wfloat-equal -Wcast-qual -Wsign-conversion -Wconversion -g endif ifndef CXX @@ -99,12 +99,12 @@ EXTOBJ = externals/tinyxml/tinystr.o \ ###### Targets cppcheck: $(LIBOBJ) $(CLIOBJ) $(EXTOBJ) - $(CXX) $(CXXFLAGS) -o cppcheck $(CLIOBJ) $(LIBOBJ) $(EXTOBJ) -lpcre $(LDFLAGS) + $(CXX) $(CPPFLAGS) $(CXXFLAGS) -o cppcheck $(CLIOBJ) $(LIBOBJ) $(EXTOBJ) -lpcre $(LDFLAGS) all: cppcheck testrunner testrunner: $(TESTOBJ) $(LIBOBJ) $(EXTOBJ) cli/threadexecutor.o cli/cmdlineparser.o cli/cppcheckexecutor.o - $(CXX) $(CXXFLAGS) -o testrunner $(TESTOBJ) $(LIBOBJ) $(EXTOBJ) -lpcre cli/threadexecutor.o cli/cmdlineparser.o cli/cppcheckexecutor.o $(LDFLAGS) + $(CXX) $(CPPFLAGS) $(CXXFLAGS) -o testrunner $(TESTOBJ) $(LIBOBJ) $(EXTOBJ) -lpcre cli/threadexecutor.o cli/cmdlineparser.o cli/cppcheckexecutor.o $(LDFLAGS) test: all ./testrunner @@ -135,197 +135,197 @@ 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 - $(CXX) $(CXXFLAGS) -Ilib -c -o lib/checkautovariables.o lib/checkautovariables.cpp + $(CXX) $(CPPFLAGS) $(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 - $(CXX) $(CXXFLAGS) -Ilib -c -o lib/checkbufferoverrun.o lib/checkbufferoverrun.cpp + $(CXX) $(CPPFLAGS) $(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/symboldatabase.h - $(CXX) $(CXXFLAGS) -Ilib -c -o lib/checkclass.o lib/checkclass.cpp + $(CXX) $(CPPFLAGS) $(CXXFLAGS) -Ilib -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) $(CXXFLAGS) -Ilib -c -o lib/checkexceptionsafety.o lib/checkexceptionsafety.cpp + $(CXX) $(CPPFLAGS) $(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/symboldatabase.h lib/mathlib.h lib/executionpath.h lib/checkuninitvar.h - $(CXX) $(CXXFLAGS) -Ilib -c -o lib/checkmemoryleak.o lib/checkmemoryleak.cpp + $(CXX) $(CPPFLAGS) $(CXXFLAGS) -Ilib -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) $(CXXFLAGS) -Ilib -c -o lib/checknullpointer.o lib/checknullpointer.cpp + $(CXX) $(CPPFLAGS) $(CXXFLAGS) -Ilib -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) $(CXXFLAGS) -Ilib -c -o lib/checkobsoletefunctions.o lib/checkobsoletefunctions.cpp + $(CXX) $(CPPFLAGS) $(CXXFLAGS) -Ilib -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) $(CXXFLAGS) -Ilib -c -o lib/checkother.o lib/checkother.cpp + $(CXX) $(CPPFLAGS) $(CXXFLAGS) -Ilib -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) $(CXXFLAGS) -Ilib -c -o lib/checkpostfixoperator.o lib/checkpostfixoperator.cpp + $(CXX) $(CPPFLAGS) $(CXXFLAGS) -Ilib -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) $(CXXFLAGS) -Ilib -c -o lib/checkstl.o lib/checkstl.cpp + $(CXX) $(CPPFLAGS) $(CXXFLAGS) -Ilib -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) $(CXXFLAGS) -Ilib -c -o lib/checkuninitvar.o lib/checkuninitvar.cpp + $(CXX) $(CPPFLAGS) $(CXXFLAGS) -Ilib -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) $(CXXFLAGS) -Ilib -c -o lib/checkunusedfunctions.o lib/checkunusedfunctions.cpp + $(CXX) $(CPPFLAGS) $(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/timer.h - $(CXX) $(CXXFLAGS) -Ilib -c -o lib/cppcheck.o lib/cppcheck.cpp + $(CXX) $(CPPFLAGS) $(CXXFLAGS) -Ilib -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) $(CXXFLAGS) -Ilib -c -o lib/errorlogger.o lib/errorlogger.cpp + $(CXX) $(CPPFLAGS) $(CXXFLAGS) -Ilib -c -o lib/errorlogger.o lib/errorlogger.cpp lib/executionpath.o: lib/executionpath.cpp lib/executionpath.h lib/token.h - $(CXX) $(CXXFLAGS) -Ilib -c -o lib/executionpath.o lib/executionpath.cpp + $(CXX) $(CPPFLAGS) $(CXXFLAGS) -Ilib -c -o lib/executionpath.o lib/executionpath.cpp lib/filelister.o: lib/filelister.cpp lib/filelister.h lib/filelister_win32.h lib/filelister_unix.h - $(CXX) $(CXXFLAGS) -Ilib -c -o lib/filelister.o lib/filelister.cpp + $(CXX) $(CPPFLAGS) $(CXXFLAGS) -Ilib -c -o lib/filelister.o lib/filelister.cpp lib/filelister_unix.o: lib/filelister_unix.cpp lib/filelister.h lib/filelister_unix.h - $(CXX) $(CXXFLAGS) -Ilib -c -o lib/filelister_unix.o lib/filelister_unix.cpp + $(CXX) $(CPPFLAGS) $(CXXFLAGS) -Ilib -c -o lib/filelister_unix.o lib/filelister_unix.cpp 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) $(CPPFLAGS) $(CXXFLAGS) -Ilib -c -o lib/filelister_win32.o lib/filelister_win32.cpp lib/mathlib.o: lib/mathlib.cpp lib/mathlib.h lib/tokenize.h - $(CXX) $(CXXFLAGS) -Ilib -c -o lib/mathlib.o lib/mathlib.cpp + $(CXX) $(CPPFLAGS) $(CXXFLAGS) -Ilib -c -o lib/mathlib.o lib/mathlib.cpp lib/path.o: lib/path.cpp lib/path.h - $(CXX) $(CXXFLAGS) -Ilib -c -o lib/path.o lib/path.cpp + $(CXX) $(CPPFLAGS) $(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/path.h lib/errorlogger.h lib/settings.h - $(CXX) $(CXXFLAGS) -Ilib -c -o lib/preprocessor.o lib/preprocessor.cpp + $(CXX) $(CPPFLAGS) $(CXXFLAGS) -Ilib -c -o lib/preprocessor.o lib/preprocessor.cpp lib/settings.o: lib/settings.cpp lib/settings.h - $(CXX) $(CXXFLAGS) -Ilib -c -o lib/settings.o lib/settings.cpp + $(CXX) $(CPPFLAGS) $(CXXFLAGS) -Ilib -c -o lib/settings.o lib/settings.cpp lib/symboldatabase.o: lib/symboldatabase.cpp lib/symboldatabase.h lib/tokenize.h lib/token.h lib/settings.h lib/errorlogger.h lib/check.h - $(CXX) $(CXXFLAGS) -Ilib -c -o lib/symboldatabase.o lib/symboldatabase.cpp + $(CXX) $(CPPFLAGS) $(CXXFLAGS) -Ilib -c -o lib/symboldatabase.o lib/symboldatabase.cpp lib/timer.o: lib/timer.cpp lib/timer.h - $(CXX) $(CXXFLAGS) -Ilib -c -o lib/timer.o lib/timer.cpp + $(CXX) $(CPPFLAGS) $(CXXFLAGS) -Ilib -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) $(CXXFLAGS) -Ilib -c -o lib/token.o lib/token.cpp + $(CXX) $(CPPFLAGS) $(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/path.h lib/symboldatabase.h - $(CXX) $(CXXFLAGS) -Ilib -c -o lib/tokenize.o lib/tokenize.cpp + $(CXX) $(CPPFLAGS) $(CXXFLAGS) -Ilib -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 - $(CXX) $(CXXFLAGS) -Ilib -Iexternals -c -o cli/cmdlineparser.o cli/cmdlineparser.cpp + $(CXX) $(CPPFLAGS) $(CXXFLAGS) -Ilib -Iexternals -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 lib/filelister.h - $(CXX) $(CXXFLAGS) -Ilib -Iexternals -c -o cli/cppcheckexecutor.o cli/cppcheckexecutor.cpp + $(CXX) $(CPPFLAGS) $(CXXFLAGS) -Ilib -Iexternals -c -o cli/cppcheckexecutor.o cli/cppcheckexecutor.cpp cli/main.o: cli/main.cpp cli/cppcheckexecutor.h lib/errorlogger.h lib/settings.h - $(CXX) $(CXXFLAGS) -Ilib -Iexternals -c -o cli/main.o cli/main.cpp + $(CXX) $(CPPFLAGS) $(CXXFLAGS) -Ilib -Iexternals -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 - $(CXX) $(CXXFLAGS) -Ilib -Iexternals -c -o cli/threadexecutor.o cli/threadexecutor.cpp + $(CXX) $(CPPFLAGS) $(CXXFLAGS) -Ilib -Iexternals -c -o cli/threadexecutor.o cli/threadexecutor.cpp test/options.o: test/options.cpp test/options.h - $(CXX) $(CXXFLAGS) -Ilib -Icli -Iexternals -c -o test/options.o test/options.cpp + $(CXX) $(CPPFLAGS) $(CXXFLAGS) -Ilib -Icli -Iexternals -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) $(CXXFLAGS) -Ilib -Icli -Iexternals -c -o test/testautovariables.o test/testautovariables.cpp + $(CXX) $(CPPFLAGS) $(CXXFLAGS) -Ilib -Icli -Iexternals -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) $(CXXFLAGS) -Ilib -Icli -Iexternals -c -o test/testbufferoverrun.o test/testbufferoverrun.cpp + $(CXX) $(CPPFLAGS) $(CXXFLAGS) -Ilib -Icli -Iexternals -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) $(CXXFLAGS) -Ilib -Icli -Iexternals -c -o test/testcharvar.o test/testcharvar.cpp + $(CXX) $(CPPFLAGS) $(CXXFLAGS) -Ilib -Icli -Iexternals -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) $(CXXFLAGS) -Ilib -Icli -Iexternals -c -o test/testclass.o test/testclass.cpp + $(CXX) $(CPPFLAGS) $(CXXFLAGS) -Ilib -Icli -Iexternals -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) $(CXXFLAGS) -Ilib -Icli -Iexternals -c -o test/testcmdlineparser.o test/testcmdlineparser.cpp + $(CXX) $(CPPFLAGS) $(CXXFLAGS) -Ilib -Icli -Iexternals -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) $(CXXFLAGS) -Ilib -Icli -Iexternals -c -o test/testconstructors.o test/testconstructors.cpp + $(CXX) $(CPPFLAGS) $(CXXFLAGS) -Ilib -Icli -Iexternals -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) $(CXXFLAGS) -Ilib -Icli -Iexternals -c -o test/testcppcheck.o test/testcppcheck.cpp + $(CXX) $(CPPFLAGS) $(CXXFLAGS) -Ilib -Icli -Iexternals -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) $(CXXFLAGS) -Ilib -Icli -Iexternals -c -o test/testdivision.o test/testdivision.cpp + $(CXX) $(CPPFLAGS) $(CXXFLAGS) -Ilib -Icli -Iexternals -c -o test/testdivision.o test/testdivision.cpp test/testerrorlogger.o: test/testerrorlogger.cpp test/testsuite.h lib/errorlogger.h test/redirect.h - $(CXX) $(CXXFLAGS) -Ilib -Icli -Iexternals -c -o test/testerrorlogger.o test/testerrorlogger.cpp + $(CXX) $(CPPFLAGS) $(CXXFLAGS) -Ilib -Icli -Iexternals -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) $(CXXFLAGS) -Ilib -Icli -Iexternals -c -o test/testexceptionsafety.o test/testexceptionsafety.cpp + $(CXX) $(CPPFLAGS) $(CXXFLAGS) -Ilib -Icli -Iexternals -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 lib/filelister_unix.h lib/filelister.h - $(CXX) $(CXXFLAGS) -Ilib -Icli -Iexternals -c -o test/testfilelister_unix.o test/testfilelister_unix.cpp + $(CXX) $(CPPFLAGS) $(CXXFLAGS) -Ilib -Icli -Iexternals -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) $(CXXFLAGS) -Ilib -Icli -Iexternals -c -o test/testincompletestatement.o test/testincompletestatement.cpp + $(CXX) $(CPPFLAGS) $(CXXFLAGS) -Ilib -Icli -Iexternals -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) $(CXXFLAGS) -Ilib -Icli -Iexternals -c -o test/testmathlib.o test/testmathlib.cpp + $(CXX) $(CPPFLAGS) $(CXXFLAGS) -Ilib -Icli -Iexternals -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) $(CXXFLAGS) -Ilib -Icli -Iexternals -c -o test/testmemleak.o test/testmemleak.cpp + $(CXX) $(CPPFLAGS) $(CXXFLAGS) -Ilib -Icli -Iexternals -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) $(CXXFLAGS) -Ilib -Icli -Iexternals -c -o test/testnullpointer.o test/testnullpointer.cpp + $(CXX) $(CPPFLAGS) $(CXXFLAGS) -Ilib -Icli -Iexternals -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) $(CXXFLAGS) -Ilib -Icli -Iexternals -c -o test/testobsoletefunctions.o test/testobsoletefunctions.cpp + $(CXX) $(CPPFLAGS) $(CXXFLAGS) -Ilib -Icli -Iexternals -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) $(CXXFLAGS) -Ilib -Icli -Iexternals -c -o test/testoptions.o test/testoptions.cpp + $(CXX) $(CPPFLAGS) $(CXXFLAGS) -Ilib -Icli -Iexternals -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) $(CXXFLAGS) -Ilib -Icli -Iexternals -c -o test/testother.o test/testother.cpp + $(CXX) $(CPPFLAGS) $(CXXFLAGS) -Ilib -Icli -Iexternals -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) $(CXXFLAGS) -Ilib -Icli -Iexternals -c -o test/testpath.o test/testpath.cpp + $(CXX) $(CPPFLAGS) $(CXXFLAGS) -Ilib -Icli -Iexternals -c -o test/testpath.o test/testpath.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) $(CXXFLAGS) -Ilib -Icli -Iexternals -c -o test/testpostfixoperator.o test/testpostfixoperator.cpp + $(CXX) $(CPPFLAGS) $(CXXFLAGS) -Ilib -Icli -Iexternals -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) $(CXXFLAGS) -Ilib -Icli -Iexternals -c -o test/testpreprocessor.o test/testpreprocessor.cpp + $(CXX) $(CPPFLAGS) $(CXXFLAGS) -Ilib -Icli -Iexternals -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) $(CXXFLAGS) -Ilib -Icli -Iexternals -c -o test/testrunner.o test/testrunner.cpp + $(CXX) $(CPPFLAGS) $(CXXFLAGS) -Ilib -Icli -Iexternals -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) $(CXXFLAGS) -Ilib -Icli -Iexternals -c -o test/testsettings.o test/testsettings.cpp + $(CXX) $(CPPFLAGS) $(CXXFLAGS) -Ilib -Icli -Iexternals -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) $(CXXFLAGS) -Ilib -Icli -Iexternals -c -o test/testsimplifytokens.o test/testsimplifytokens.cpp + $(CXX) $(CPPFLAGS) $(CXXFLAGS) -Ilib -Icli -Iexternals -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) $(CXXFLAGS) -Ilib -Icli -Iexternals -c -o test/teststl.o test/teststl.cpp + $(CXX) $(CPPFLAGS) $(CXXFLAGS) -Ilib -Icli -Iexternals -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) $(CXXFLAGS) -Ilib -Icli -Iexternals -c -o test/testsuite.o test/testsuite.cpp + $(CXX) $(CPPFLAGS) $(CXXFLAGS) -Ilib -Icli -Iexternals -c -o test/testsuite.o test/testsuite.cpp -test/testsymboldatabase.o: test/testsymboldatabase.cpp test/testsuite.h lib/errorlogger.h test/redirect.h lib/symboldatabase.h - $(CXX) $(CXXFLAGS) -Ilib -Icli -Iexternals -c -o test/testsymboldatabase.o test/testsymboldatabase.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 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) $(CXXFLAGS) -Ilib -Icli -Iexternals -c -o test/testthreadexecutor.o test/testthreadexecutor.cpp + $(CXX) $(CPPFLAGS) $(CXXFLAGS) -Ilib -Icli -Iexternals -c -o test/testthreadexecutor.o test/testthreadexecutor.cpp -test/testtoken.o: test/testtoken.cpp test/testsuite.h lib/errorlogger.h test/redirect.h lib/tokenize.h lib/token.h lib/settings.h - $(CXX) $(CXXFLAGS) -Ilib -Icli -Iexternals -c -o test/testtoken.o test/testtoken.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 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) $(CXXFLAGS) -Ilib -Icli -Iexternals -c -o test/testtokenize.o test/testtokenize.cpp + $(CXX) $(CPPFLAGS) $(CXXFLAGS) -Ilib -Icli -Iexternals -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) $(CXXFLAGS) -Ilib -Icli -Iexternals -c -o test/testuninitvar.o test/testuninitvar.cpp + $(CXX) $(CPPFLAGS) $(CXXFLAGS) -Ilib -Icli -Iexternals -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) $(CXXFLAGS) -Ilib -Icli -Iexternals -c -o test/testunusedfunctions.o test/testunusedfunctions.cpp + $(CXX) $(CPPFLAGS) $(CXXFLAGS) -Ilib -Icli -Iexternals -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) $(CXXFLAGS) -Ilib -Icli -Iexternals -c -o test/testunusedprivfunc.o test/testunusedprivfunc.cpp + $(CXX) $(CPPFLAGS) $(CXXFLAGS) -Ilib -Icli -Iexternals -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) $(CXXFLAGS) -Ilib -Icli -Iexternals -c -o test/testunusedvar.o test/testunusedvar.cpp + $(CXX) $(CPPFLAGS) $(CXXFLAGS) -Ilib -Icli -Iexternals -c -o test/testunusedvar.o test/testunusedvar.cpp diff --git a/test/testmathlib.cpp b/test/testmathlib.cpp index 10125691f..4e0f2d3d2 100644 --- a/test/testmathlib.cpp +++ b/test/testmathlib.cpp @@ -121,30 +121,30 @@ private: // ----------------- // to double number: // ----------------- - ASSERT_EQUALS(10.0 , MathLib::toDoubleNumber("10")); - ASSERT_EQUALS(1000.0, MathLib::toDoubleNumber("10E+2")); - ASSERT_EQUALS(100.0 , MathLib::toDoubleNumber("1.0E+2")); - ASSERT_EQUALS(-100.0, MathLib::toDoubleNumber("-1.0E+2")); - ASSERT_EQUALS(-1e+10, MathLib::toDoubleNumber("-1.0E+10")); - ASSERT_EQUALS(100.0 , MathLib::toDoubleNumber("+1.0E+2")); - ASSERT_EQUALS(1e+10 , MathLib::toDoubleNumber("+1.0E+10")); - ASSERT_EQUALS(100.0 , MathLib::toDoubleNumber("1.0E+2")); - ASSERT_EQUALS(1e+10 , MathLib::toDoubleNumber("1.0E+10")); - ASSERT_EQUALS(0.0 , MathLib::toDoubleNumber("0E+0")); - ASSERT_EQUALS(0.0 , MathLib::toDoubleNumber("0E-0")); - ASSERT_EQUALS(0.0 , MathLib::toDoubleNumber("0E+00")); - ASSERT_EQUALS(0.0 , MathLib::toDoubleNumber("0E-00")); - ASSERT_EQUALS(0.0 , MathLib::toDoubleNumber("-0E+00")); - ASSERT_EQUALS(0.0 , MathLib::toDoubleNumber("+0E-00")); - ASSERT_EQUALS(0.0 , MathLib::toDoubleNumber("0")); - ASSERT_EQUALS(0.0 , MathLib::toDoubleNumber("0.")); - ASSERT_EQUALS(0.0 , MathLib::toDoubleNumber("0.0")); - ASSERT_EQUALS(0.0 , MathLib::toDoubleNumber("-0")); - ASSERT_EQUALS(0.0 , MathLib::toDoubleNumber("+0")); - ASSERT_EQUALS(0.0 , MathLib::toDoubleNumber("-0.")); - ASSERT_EQUALS(0.0 , MathLib::toDoubleNumber("+0.")); - ASSERT_EQUALS(0.0 , MathLib::toDoubleNumber("-0.0")); - ASSERT_EQUALS(0.0 , MathLib::toDoubleNumber("+0.0")); + ASSERT_EQUALS_DOUBLE(10.0 , MathLib::toDoubleNumber("10")); + ASSERT_EQUALS_DOUBLE(1000.0, MathLib::toDoubleNumber("10E+2")); + ASSERT_EQUALS_DOUBLE(100.0 , MathLib::toDoubleNumber("1.0E+2")); + ASSERT_EQUALS_DOUBLE(-100.0, MathLib::toDoubleNumber("-1.0E+2")); + ASSERT_EQUALS_DOUBLE(-1e+10, MathLib::toDoubleNumber("-1.0E+10")); + ASSERT_EQUALS_DOUBLE(100.0 , MathLib::toDoubleNumber("+1.0E+2")); + ASSERT_EQUALS_DOUBLE(1e+10 , MathLib::toDoubleNumber("+1.0E+10")); + ASSERT_EQUALS_DOUBLE(100.0 , MathLib::toDoubleNumber("1.0E+2")); + ASSERT_EQUALS_DOUBLE(1e+10 , MathLib::toDoubleNumber("1.0E+10")); + ASSERT_EQUALS_DOUBLE(0.0 , MathLib::toDoubleNumber("0E+0")); + ASSERT_EQUALS_DOUBLE(0.0 , MathLib::toDoubleNumber("0E-0")); + ASSERT_EQUALS_DOUBLE(0.0 , MathLib::toDoubleNumber("0E+00")); + ASSERT_EQUALS_DOUBLE(0.0 , MathLib::toDoubleNumber("0E-00")); + ASSERT_EQUALS_DOUBLE(0.0 , MathLib::toDoubleNumber("-0E+00")); + ASSERT_EQUALS_DOUBLE(0.0 , MathLib::toDoubleNumber("+0E-00")); + ASSERT_EQUALS_DOUBLE(0.0 , MathLib::toDoubleNumber("0")); + ASSERT_EQUALS_DOUBLE(0.0 , MathLib::toDoubleNumber("0.")); + ASSERT_EQUALS_DOUBLE(0.0 , MathLib::toDoubleNumber("0.0")); + ASSERT_EQUALS_DOUBLE(0.0 , MathLib::toDoubleNumber("-0")); + ASSERT_EQUALS_DOUBLE(0.0 , MathLib::toDoubleNumber("+0")); + ASSERT_EQUALS_DOUBLE(0.0 , MathLib::toDoubleNumber("-0.")); + ASSERT_EQUALS_DOUBLE(0.0 , MathLib::toDoubleNumber("+0.")); + ASSERT_EQUALS_DOUBLE(0.0 , MathLib::toDoubleNumber("-0.0")); + ASSERT_EQUALS_DOUBLE(0.0 , MathLib::toDoubleNumber("+0.0")); } diff --git a/test/testsuite.cpp b/test/testsuite.cpp index fbece61fb..51a56fe60 100644 --- a/test/testsuite.cpp +++ b/test/testsuite.cpp @@ -158,7 +158,16 @@ void TestFixture::assertEquals(const char *filename, int linenr, const std::stri } } -void TestFixture::assertEquals(const char *filename, int linenr, double expected, double actual, const std::string &msg) +void TestFixture::assertEquals(const char *filename, int linenr, long long expected, long long actual, const std::string &msg) +{ + std::ostringstream ostr1; + ostr1 << expected; + std::ostringstream ostr2; + ostr2 << actual; + assertEquals(filename, linenr, ostr1.str(), ostr2.str(), msg); +} + +void TestFixture::assertEqualsDouble(const char *filename, int linenr, double expected, double actual, const std::string &msg) { std::ostringstream ostr1; ostr1 << expected; diff --git a/test/testsuite.h b/test/testsuite.h index 8feafafb1..ec3524cce 100644 --- a/test/testsuite.h +++ b/test/testsuite.h @@ -49,10 +49,8 @@ protected: void assert_(const char *filename, int linenr, bool condition); void assertEquals(const char *filename, int linenr, const std::string &expected, const std::string &actual, const std::string &msg = ""); - - // the vars expected and actual need to be of type double, in order to avoid overflow of unsigned int - // e.g: ASSERT_EQUALS(-100.0, MathLib::toDoubleNumber("-1.0E+2")); would not work without this. - void assertEquals(const char *filename, int linenr, double expected, double actual, const std::string &msg=""); + void assertEquals(const char *filename, int linenr, long long expected, long long actual, const std::string &msg=""); + void assertEqualsDouble(const char *filename, int linenr, double expected, double actual, const std::string &msg=""); void todoAssertEquals(const char *filename, int linenr, const std::string &expected, const std::string &actual); void todoAssertEquals(const char *filename, int linenr, unsigned int expected, unsigned int actual); @@ -74,6 +72,7 @@ public: #define TEST_CASE( NAME ) if ( runTest(#NAME) ) { if (quiet_tests) { REDIRECT; NAME(); } else { NAME ();} } #define ASSERT( CONDITION ) assert_(__FILE__, __LINE__, CONDITION) #define ASSERT_EQUALS( EXPECTED , ACTUAL ) assertEquals(__FILE__, __LINE__, EXPECTED, ACTUAL) +#define ASSERT_EQUALS_DOUBLE( EXPECTED , ACTUAL ) assertEqualsDouble(__FILE__, __LINE__, EXPECTED, ACTUAL) #define ASSERT_EQUALS_MSG( EXPECTED , ACTUAL, MSG ) assertEquals(__FILE__, __LINE__, EXPECTED, ACTUAL, MSG) #define ASSERT_THROW( CMD, EXCEPTION ) try { CMD ; assertThrowFail(__FILE__, __LINE__); } catch (EXCEPTION &) { } catch (...) { assertThrowFail(__FILE__, __LINE__); } #define TODO_ASSERT_EQUALS( EXPECTED , ACTUAL ) todoAssertEquals(__FILE__, __LINE__, EXPECTED, ACTUAL) diff --git a/tools/dmake.cpp b/tools/dmake.cpp index 6f4ca1ed2..3083bbf21 100644 --- a/tools/dmake.cpp +++ b/tools/dmake.cpp @@ -183,7 +183,6 @@ int main(int argc, char **argv) else { // TODO: add more compiler warnings. - // -Wconversion : generates too many compiler warnings currently // -Wlogical-op : doesn't work on older GCC // The _GLIBCXX_DEBUG doesn't work in cygwin @@ -196,7 +195,7 @@ int main(int argc, char **argv) "-Wfloat-equal " "-Wcast-qual " "-Wsign-conversion " - // "-Wconversion " + "-Wconversion " "-g"); } makeConditionalVariable(fout, "CXX", "g++");