diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2019-02-17 18:32:16 +0000 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2019-02-24 20:08:01 +0000 |
commit | 3f6ed65ff6efb56949ab71eed7542c49ea25ae97 (patch) | |
tree | 33c1d3733e50dd5bbfbe43af13c2f58064294c4b | |
parent | Parallel lto only with gcc (diff) | |
download | libjsonpp-3f6ed65ff6efb56949ab71eed7542c49ea25ae97.tar.bz2 libjsonpp-3f6ed65ff6efb56949ab71eed7542c49ea25ae97.tar.xz libjsonpp-3f6ed65ff6efb56949ab71eed7542c49ea25ae97.zip |
Fixes recommend from clang build and clang-tidy
-rw-r--r-- | Jamroot.jam | 9 | ||||
-rw-r--r-- | libjsonpp/Jamfile.jam | 5 | ||||
-rw-r--r-- | libjsonpp/json.ll | 4 | ||||
-rw-r--r-- | libjsonpp/jsonFlexLexer.cpp | 6 | ||||
-rw-r--r-- | libjsonpp/jsonFlexLexer.h | 4 | ||||
-rw-r--r-- | libjsonpp/parse.cpp | 4 |
6 files changed, 23 insertions, 9 deletions
diff --git a/Jamroot.jam b/Jamroot.jam index ab6e837..50ceecf 100644 --- a/Jamroot.jam +++ b/Jamroot.jam @@ -15,7 +15,14 @@ project <variant>debug:<cxxflags>"-W -Wall -Werror -Wextra" <variant>coverage:<cxxflags>"-W -Wall -Werror -Wextra -std=c++1y --coverage" <variant>coverage:<linkflags>"--coverage" - ; + <toolset>tidy:<checkxx>boost-* + <toolset>tidy:<checkxx>bugprone-* + <toolset>tidy:<checkxx>clang-* + <toolset>tidy:<checkxx>misc-* + <toolset>tidy:<checkxx>modernize-* + <toolset>tidy:<checkxx>hicpp-* + <toolset>tidy:<checkxx>performance-* + ; build-project libjsonpp ; diff --git a/libjsonpp/Jamfile.jam b/libjsonpp/Jamfile.jam index 8ebe4cb..ebab24d 100644 --- a/libjsonpp/Jamfile.jam +++ b/libjsonpp/Jamfile.jam @@ -2,7 +2,10 @@ import package ; import testing ; import lex ; -lib boost_utf : : <name>boost_unit_test_framework ; +lib boost_utf : : <name>boost_unit_test_framework : : + <toolset>tidy:<xcheckxx>hicpp-vararg + <toolset>tidy:<xcheckxx>modernize-raw-string-literal + ; lib stdc++fs ; path-constant me : . ; diff --git a/libjsonpp/json.ll b/libjsonpp/json.ll index 2fd8317..fa6ad8d 100644 --- a/libjsonpp/json.ll +++ b/libjsonpp/json.ll @@ -10,6 +10,10 @@ %{ #include "jsonFlexLexer.h" #pragma GCC diagnostic ignored "-Wsign-compare" +#pragma GCC diagnostic ignored "-Wimplicit-fallthrough" +#ifdef __clang__ +#pragma clang diagnostic ignored "-Wnull-conversion" +#endif %} beginobj "{" diff --git a/libjsonpp/jsonFlexLexer.cpp b/libjsonpp/jsonFlexLexer.cpp index 95fb955..e4019be 100644 --- a/libjsonpp/jsonFlexLexer.cpp +++ b/libjsonpp/jsonFlexLexer.cpp @@ -3,9 +3,9 @@ #include <glibmm/convert.h> namespace json { - jsonFlexLexer::jsonFlexLexer(std::istream & in, const std::string & enc, Value & v) : - yyFlexLexer(&in, NULL), - encoding(enc) + jsonFlexLexer::jsonFlexLexer(std::istream & in, std::string enc, Value & v) : + yyFlexLexer(&in, nullptr), + encoding(std::move(enc)) { yy_push_state(0); acceptValues.push([&v](const auto & value) { diff --git a/libjsonpp/jsonFlexLexer.h b/libjsonpp/jsonFlexLexer.h index c95636e..f17fdfc 100644 --- a/libjsonpp/jsonFlexLexer.h +++ b/libjsonpp/jsonFlexLexer.h @@ -9,9 +9,9 @@ namespace json { class jsonFlexLexer : public yyFlexLexer { public: - jsonFlexLexer(std::istream &, const std::string & enc, Value & v); + jsonFlexLexer(std::istream &, std::string enc, Value & v); - int yylex(); + int yylex() override; void LexerError(const char * msg) override; void BeginObject(); diff --git a/libjsonpp/parse.cpp b/libjsonpp/parse.cpp index 4f82aac..9dc27fa 100644 --- a/libjsonpp/parse.cpp +++ b/libjsonpp/parse.cpp @@ -15,7 +15,7 @@ namespace json { Value parseValue(std::istream & s, const std::string & enc) { Value v; jsonFlexLexer jfl(s, enc, v); - while (jfl.yylex()) ; + while (jfl.yylex()) {} return v; } @@ -26,7 +26,7 @@ namespace json { Value parseValue(Glib::ustring::const_iterator & s) { Glib::ustring::const_iterator start = s; - while (*s++) ; + while (*s++) {} return parseValue(Glib::ustring(start, --s)); } } |