From 3f6ed65ff6efb56949ab71eed7542c49ea25ae97 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sun, 17 Feb 2019 18:32:16 +0000 Subject: Fixes recommend from clang build and clang-tidy --- Jamroot.jam | 9 ++++++++- libjsonpp/Jamfile.jam | 5 ++++- libjsonpp/json.ll | 4 ++++ libjsonpp/jsonFlexLexer.cpp | 6 +++--- libjsonpp/jsonFlexLexer.h | 4 ++-- 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 debug:"-W -Wall -Werror -Wextra" coverage:"-W -Wall -Werror -Wextra -std=c++1y --coverage" coverage:"--coverage" - ; + tidy:boost-* + tidy:bugprone-* + tidy:clang-* + tidy:misc-* + tidy:modernize-* + tidy:hicpp-* + tidy: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 : : boost_unit_test_framework ; +lib boost_utf : : boost_unit_test_framework : : + tidy:hicpp-vararg + tidy: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 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)); } } -- cgit v1.2.3