Skip to content

Commit

Permalink
sync (danmar#1835)
Browse files Browse the repository at this point in the history
* 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 8c03be3

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

* readme: include picojson

* make: also clean exe
  • Loading branch information
carenas authored and danmar committed May 17, 2019
1 parent 57c6628 commit bf5c71b
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 25 deletions.
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)))
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion cmake/compileroptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 0 additions & 13 deletions lib/valueflow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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% ("))
Expand Down
4 changes: 2 additions & 2 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
=====
Expand Down
4 changes: 2 additions & 2 deletions readmeja.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tools/dmake.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 "
Expand All @@ -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 "
Expand Down

0 comments on commit bf5c71b

Please sign in to comment.