* build: remove -Wabi and add -Wundef

gcc >= 8 throws a warning about -Wabi (without a specific ABI version)
being ignored, while -Wundef seems more useful (as shown by the change
in config.h, which was probably an unfortunate typo)

travis.yaml should probably be updated soon, but was left out from this
change as the current images don't yet need it

* lib: unused function in valueflow

refactored out since 8c03be3212

lib/valueflow.cpp:3124:21: warning: unused function 'endTemplateArgument' [-Wunused-function]

* readme: include picojson

* make: also clean exe
This commit is contained in:
Carlo Marcelo Arenas Belón 2019-05-17 00:31:41 -07:00 committed by Daniel Marjamäki
parent 57c6628732
commit bf5c71bdca
8 changed files with 11 additions and 25 deletions

View File

@ -80,7 +80,7 @@ ifeq (clang++, $(findstring clang++,$(CXX)))
CPPCHK_GLIBCXX_DEBUG=
endif
ifndef CXXFLAGS
CXXFLAGS=-pedantic -Wall -Wextra -Wabi -Wcast-qual -Wno-deprecated-declarations -Wfloat-equal -Wmissing-declarations -Wmissing-format-attribute -Wno-long-long -Wpacked -Wredundant-decls -Wno-shadow -Wno-missing-field-initializers -Wno-missing-braces -Wno-sign-compare -Wno-multichar $(CPPCHK_GLIBCXX_DEBUG) -g
CXXFLAGS=-pedantic -Wall -Wextra -Wcast-qual -Wno-deprecated-declarations -Wfloat-equal -Wmissing-declarations -Wmissing-format-attribute -Wno-long-long -Wpacked -Wredundant-decls -Wundef -Wno-shadow -Wno-missing-field-initializers -Wno-missing-braces -Wno-sign-compare -Wno-multichar $(CPPCHK_GLIBCXX_DEBUG) -g
endif
ifeq (g++, $(findstring g++,$(CXX)))
@ -277,7 +277,7 @@ run-dmake: dmake
generate_cfg_tests: tools/generate_cfg_tests.o $(EXTOBJ)
g++ -isystem externals/tinyxml -o generate_cfg_tests tools/generate_cfg_tests.o $(EXTOBJ)
clean:
rm -f build/*.o lib/*.o cli/*.o test/*.o tools/*.o externals/*/*.o testrunner dmake cppcheck cppcheck.1
rm -f build/*.o lib/*.o cli/*.o test/*.o tools/*.o externals/*/*.o testrunner dmake cppcheck cppcheck.exe cppcheck.1
man: man/cppcheck.1
@ -422,7 +422,7 @@ $(SRCDIR)/checktype.o: lib/checktype.cpp lib/checktype.h lib/check.h lib/config.
$(SRCDIR)/checkuninitvar.o: lib/checkuninitvar.cpp lib/checkuninitvar.h lib/check.h lib/config.h lib/errorlogger.h lib/suppressions.h lib/settings.h lib/importproject.h lib/platform.h lib/utils.h lib/library.h lib/mathlib.h lib/standards.h lib/timer.h lib/token.h lib/valueflow.h lib/templatesimplifier.h lib/tokenize.h lib/tokenlist.h lib/ctu.h lib/astutils.h lib/checknullpointer.h lib/symboldatabase.h
$(CXX) ${INCLUDE_FOR_LIB} $(CPPFLAGS) $(CFG) $(CXXFLAGS) $(UNDEF_STRICT_ANSI) -c -o $(SRCDIR)/checkuninitvar.o $(SRCDIR)/checkuninitvar.cpp
$(SRCDIR)/checkunusedfunctions.o: lib/checkunusedfunctions.cpp lib/checkunusedfunctions.h lib/check.h lib/config.h lib/errorlogger.h lib/suppressions.h lib/settings.h lib/importproject.h lib/platform.h lib/utils.h lib/library.h lib/mathlib.h lib/standards.h lib/timer.h lib/token.h lib/valueflow.h lib/templatesimplifier.h lib/tokenize.h lib/tokenlist.h lib/symboldatabase.h
$(SRCDIR)/checkunusedfunctions.o: lib/checkunusedfunctions.cpp lib/checkunusedfunctions.h lib/check.h lib/config.h lib/errorlogger.h lib/suppressions.h lib/settings.h lib/importproject.h lib/platform.h lib/utils.h lib/library.h lib/mathlib.h lib/standards.h lib/timer.h lib/token.h lib/valueflow.h lib/templatesimplifier.h lib/tokenize.h lib/tokenlist.h lib/astutils.h lib/symboldatabase.h
$(CXX) ${INCLUDE_FOR_LIB} $(CPPFLAGS) $(CFG) $(CXXFLAGS) $(UNDEF_STRICT_ANSI) -c -o $(SRCDIR)/checkunusedfunctions.o $(SRCDIR)/checkunusedfunctions.cpp
$(SRCDIR)/checkunusedvar.o: lib/checkunusedvar.cpp lib/checkunusedvar.h lib/check.h lib/config.h lib/errorlogger.h lib/suppressions.h lib/settings.h lib/importproject.h lib/platform.h lib/utils.h lib/library.h lib/mathlib.h lib/standards.h lib/timer.h lib/token.h lib/valueflow.h lib/templatesimplifier.h lib/tokenize.h lib/tokenlist.h lib/astutils.h lib/symboldatabase.h

View File

@ -42,7 +42,6 @@ if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
message(FATAL_ERROR "${PROJECT_NAME} c++11 support requires g++ 4.6 or greater, but it is ${GCC_VERSION}")
endif ()
set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} -Wabi")
set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} -Wcast-qual") # Cast for removing type qualifiers
set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} -Wconversion") # Implicit conversions that may alter a value
set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} -Wfloat-equal") # Floating values used in equality comparisons

View File

@ -20,7 +20,7 @@
#endif
// C++11 override
#if defined(_MSC_VER) || (defined(__GNUC__) && (__GNUC >= 5)) || defined(__CPPCHECK__)
#if defined(_MSC_VER) || (defined(__GNUC__) && (__GNUC__ >= 5)) || defined(__CPPCHECK__)
# define OVERRIDE override
#else
# define OVERRIDE

View File

@ -3121,19 +3121,6 @@ struct LifetimeStore {
}
};
static const Token *endTemplateArgument(const Token *tok)
{
for (; tok; tok = tok->next()) {
if (Token::Match(tok, ">|,"))
return tok;
else if (tok->link() && Token::Match(tok, "(|{|[|<"))
tok = tok->link();
else if (Token::simpleMatch(tok, ";"))
return nullptr;
}
return nullptr;
}
static void valueFlowLifetimeFunction(Token *tok, TokenList *tokenlist, ErrorLogger *errorLogger, const Settings *settings)
{
if (!Token::Match(tok, "%name% ("))

View File

@ -91,13 +91,13 @@ Flags:
If you just want to build Cppcheck without dependencies then you can use this command:
```shell
g++ -o cppcheck -std=c++11 -Iexternals/simplecpp -Iexternals/tinyxml -Ilib cli/*.cpp lib/*.cpp externals/simplecpp/simplecpp.cpp externals/tinyxml/*.cpp
g++ -o cppcheck -std=c++11 -Iexternals -Iexternals/simplecpp -Iexternals/tinyxml -Ilib cli/*.cpp lib/*.cpp externals/simplecpp/simplecpp.cpp externals/tinyxml/*.cpp
```
If you want to use `--rule` and `--rule-file` then dependencies are needed:
```shell
g++ -o cppcheck -std=c++11 -lpcre -DHAVE_RULES -Ilib -Iexternals/simplecpp -Iexternals/tinyxml cli/*.cpp lib/*.cpp externals/simplecpp/simplecpp.cpp externals/tinyxml/*.cpp
g++ -o cppcheck -std=c++11 -lpcre -DHAVE_RULES -Ilib -Iexternals -Iexternals/simplecpp -Iexternals/tinyxml cli/*.cpp lib/*.cpp externals/simplecpp/simplecpp.cpp externals/tinyxml/*.cpp
```
### MinGW

View File

@ -68,10 +68,10 @@ Compiling
g++ (for experts)
=================
If you just want to build Cppcheck without dependencies then you can use this command:
g++ -o cppcheck -std=c++11 -Iexternals/simplecpp -Iexternals/tinyxml -Ilib cli/*.cpp lib/*.cpp externals/simplecpp/simplecpp.cpp externals/tinyxml/*.cpp
g++ -o cppcheck -std=c++11 -Iexternals -Iexternals/simplecpp -Iexternals/tinyxml -Ilib cli/*.cpp lib/*.cpp externals/simplecpp/simplecpp.cpp externals/tinyxml/*.cpp
If you want to use --rule and --rule-file then dependencies are needed:
g++ -o cppcheck -std=c++11 -lpcre -DHAVE_RULES -Ilib -Iexternals/simplecpp -Iexternals/tinyxml cli/*.cpp lib/*.cpp externals/simplecpp/simplecpp.cpp externals/tinyxml/*.cpp
g++ -o cppcheck -std=c++11 -lpcre -DHAVE_RULES -Ilib -Iexternals -Iexternals/simplecpp -Iexternals/tinyxml cli/*.cpp lib/*.cpp externals/simplecpp/simplecpp.cpp externals/tinyxml/*.cpp
mingw
=====

View File

@ -91,13 +91,13 @@ cppcheckの設定ファイル(.cfg)を置くディレクトリを指定します
依存関係なく Cppcheckをビルドしたい場合、次のコマンドを利用できます。
```shell
g++ -o cppcheck -std=c++11 -Iexternals/simplecpp -Iexternals/tinyxml -Ilib cli/*.cpp lib/*.cpp externals/simplecpp/simplecpp.cpp externals/tinyxml/*.cpp
g++ -o cppcheck -std=c++11 -Iexternals -Iexternals/simplecpp -Iexternals/tinyxml -Ilib cli/*.cpp lib/*.cpp externals/simplecpp/simplecpp.cpp externals/tinyxml/*.cpp
```
`--rule``--rule-file` を利用する場合、依存ライブラリが必要です。
```shell
g++ -o cppcheck -std=c++11 -Iexternals/simplecpp -Iexternals/tinyxml -Ilib cli/*.cpp lib/*.cpp externals/simplecpp/simplecpp.cpp externals/tinyxml/*.cpp
g++ -o cppcheck -std=c++11 -lpcre -DHAVE_RULES -Iexternals -Iexternals/simplecpp -Iexternals/tinyxml -Ilib cli/*.cpp lib/*.cpp externals/simplecpp/simplecpp.cpp externals/tinyxml/*.cpp
```
### MinGW

View File

@ -290,7 +290,6 @@ int main(int argc, char **argv)
"-pedantic "
"-Wall "
"-Wextra "
"-Wabi "
"-Wcast-qual "
// "-Wconversion " // danmar: gives fp. for instance: unsigned int sizeof_pointer = sizeof(void *);
"-Wno-deprecated-declarations "
@ -302,6 +301,7 @@ int main(int argc, char **argv)
// "-Woverloaded-virtual " // danmar: we get fp when overloading analyseWholeProgram()
"-Wpacked "
"-Wredundant-decls "
"-Wundef "
"-Wno-shadow "
// "-Wsign-conversion "
// "-Wsign-promo "