diff --git a/.appveyor.yml b/.appveyor.yml index bd69995445..ef3f4e4075 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -56,7 +56,6 @@ before_build: -wd4996 # Call to 'std::copy' with parameters that may be unsafe -wd4100 # unreferenced formal parameter -wd4310 # cast truncates constant value - -wd4457 # declaration of 'varname' hides function parameter -wd4458 # declaration of 'varname' hides class member -wd4459 # declaration of 'varname' hides global declaration -wd4512 # assignment operator could not be generated diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f96da6b8a2..c2d4cdf8ad 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -413,6 +413,11 @@ jobs: variant sanitize : speed off full off ; + # Enable additional warnings + toolset.flags gcc.compile OPTIONS extra : + -Wshadow-local + : unchecked ; + # Ignore some warnings feature.feature known-warnings : suppress : optional incidental propagated ; toolset.flags gcc.compile OPTIONS suppress : diff --git a/.travis.yml b/.travis.yml index c95a0df789..af65877393 100644 --- a/.travis.yml +++ b/.travis.yml @@ -107,6 +107,11 @@ before_install: variant sanitize : speed off full off ; + # Enable additional warnings + toolset.flags gcc.compile OPTIONS extra : + -Wshadow-local + : unchecked ; + # Ignore some warnings feature.feature known-warnings : suppress : optional incidental propagated ; toolset.flags gcc.compile OPTIONS suppress : diff --git a/include/boost/spirit/home/support/detail/lexer/parser/tokeniser/re_tokeniser_helper.hpp b/include/boost/spirit/home/support/detail/lexer/parser/tokeniser/re_tokeniser_helper.hpp index caa19ba4cb..1d4840da59 100644 --- a/include/boost/spirit/home/support/detail/lexer/parser/tokeniser/re_tokeniser_helper.hpp +++ b/include/boost/spirit/home/support/detail/lexer/parser/tokeniser/re_tokeniser_helper.hpp @@ -523,21 +523,21 @@ class basic_re_tokeniser_helper for (; start_ <= end_; ++start_) { - CharT ch_ = static_cast (start_); + CharT ch_i = static_cast (start_); if ((state_._flags & icase) && - (std::isupper (ch_, state_._locale) || - std::islower (ch_, state_._locale))) + (std::isupper (ch_i, state_._locale) || + std::islower (ch_i, state_._locale))) { - CharT upper_ = std::toupper (ch_, state_._locale); - CharT lower_ = std::tolower (ch_, state_._locale); + CharT upper_ = std::toupper (ch_i, state_._locale); + CharT lower_ = std::tolower (ch_i, state_._locale); chars_ += (upper_); chars_ += (lower_); } else { - chars_ += (ch_); + chars_ += (ch_i); } } } diff --git a/test/x3/debug.cpp b/test/x3/debug.cpp index 5d3508ac8c..20c9bb07ee 100644 --- a/test/x3/debug.cpp +++ b/test/x3/debug.cpp @@ -68,9 +68,9 @@ main() { // basic tests - auto a = rule("a") = 'a'; - auto b = rule("b") = 'b'; - auto c = rule("c") = 'c'; + auto a = rule("a") = 'a'; + auto b = rule("b") = 'b'; + auto c = rule("c") = 'c'; { auto start = *(a | b | c); @@ -89,9 +89,9 @@ main() { // basic tests w/ skipper - auto a = rule("a") = 'a'; - auto b = rule("b") = 'b'; - auto c = rule("c") = 'c'; + auto a = rule("a") = 'a'; + auto b = rule("b") = 'b'; + auto c = rule("c") = 'c'; { auto start = *(a | b | c); @@ -133,7 +133,7 @@ main() { symbols a{{{ "a", my_attribute{} }}}; - auto b = rule("b") = a; + auto b = rule("b") = a; my_attribute attr; diff --git a/test/x3/rule1.cpp b/test/x3/rule1.cpp index c88514c2fb..71fe15fe01 100644 --- a/test/x3/rule1.cpp +++ b/test/x3/rule1.cpp @@ -92,17 +92,17 @@ main() { // basic tests w/ skipper but no final post-skip - auto a = rule() + auto a = rule() = lit('a'); - auto b = rule() + auto b = rule() = lit('b'); - auto c = rule() + auto c = rule() = lit('c'); { - auto start = rule() = *(a | b) >> c; + auto start = rule() = *(a | b) >> c; char const *s1 = " a b a a b b a c ... " , *const e1 = s1 + std::strlen(s1); diff --git a/test/x3/rule2.cpp b/test/x3/rule2.cpp index 158360b850..5c308deb06 100644 --- a/test/x3/rule2.cpp +++ b/test/x3/rule2.cpp @@ -47,7 +47,7 @@ main() { // context tests char ch; - auto a = rule() = alpha; + auto a = rule() = alpha; // this semantic action requires the context auto f = [&](auto& ctx){ ch = _attr(ctx); }; @@ -71,7 +71,7 @@ main() { // auto rules tests char ch = '\0'; - auto a = rule() = alpha; + auto a = rule() = alpha; auto f = [&](auto& ctx){ ch = _attr(ctx); }; BOOST_TEST(test("x", a[f])); @@ -98,7 +98,7 @@ main() auto f = [&](auto& ctx){ s = _attr(ctx); }; { - auto r = rule() + auto r = rule() = char_ >> *(',' >> char_) ; @@ -107,7 +107,7 @@ main() } { - auto r = rule() + auto r = rule() = char_ >> *(',' >> char_); s.clear(); BOOST_TEST(test("a,b,c,d,e,f", r[f])); @@ -115,7 +115,7 @@ main() } { - auto r = rule() + auto r = rule() = char_ >> char_ >> char_ >> char_ >> char_ >> char_; s.clear(); BOOST_TEST(test("abcdef", r[f])); diff --git a/test/x3/rule3.cpp b/test/x3/rule3.cpp index e87fc5e0a9..7deeb9b788 100644 --- a/test/x3/rule3.cpp +++ b/test/x3/rule3.cpp @@ -138,7 +138,7 @@ int main() } { - auto r = rule{} = eps[([] (auto& ctx) { + auto r = rule{} = eps[([] (auto& ctx) { using boost::spirit::x3::_val; static_assert(std::is_same, unused_type>::value, "Attribute must not be synthesized"); diff --git a/test/x3/rule4.cpp b/test/x3/rule4.cpp index 80e2a78a0d..551be7059b 100644 --- a/test/x3/rule4.cpp +++ b/test/x3/rule4.cpp @@ -95,7 +95,7 @@ main() // test deduced auto rule behavior - auto text = rule() + auto text = rule() = +(!char_(')') >> !char_('>') >> char_); attr.clear(); @@ -119,14 +119,14 @@ main() { typedef boost::variant v_type; - auto r1 = rule() + auto r1 = rule() = int_; v_type v; BOOST_TEST(test_attr("1", r1, v) && v.which() == 1 && boost::get(v) == 1); typedef boost::optional ov_type; - auto r2 = rule() + auto r2 = rule() = int_; ov_type ov; BOOST_TEST(test_attr("1", r2, ov) && ov && boost::get(ov) == 1); @@ -136,7 +136,7 @@ main() { using boost::fusion::vector; using boost::fusion::at_c; - auto r = rule>() + auto r = rule>() = int_; vector v(0); diff --git a/test/x3/sequence.cpp b/test/x3/sequence.cpp index 0839521b75..63167912bd 100644 --- a/test/x3/sequence.cpp +++ b/test/x3/sequence.cpp @@ -149,7 +149,7 @@ main() typedef deque attr_type; attr_type fv; - auto r = rule() + auto r = rule() = char_ >> ',' >> int_; BOOST_TEST((test_attr("test:x,1", "test:" >> r, fv) && @@ -164,7 +164,7 @@ main() typedef deque attr_type; attr_type fv; - auto r = rule() + auto r = rule() = int_; BOOST_TEST((test_attr("test:1", "test:" >> r, fv) && @@ -319,10 +319,10 @@ main() { std::vector v; - auto e = rule() + auto e = rule() = *~char_(','); - auto l = rule>() + auto l = rule>() = e >> *(',' >> e); BOOST_TEST(test_attr("abc1,abc2,abc3", l, v)); @@ -342,10 +342,10 @@ main() { std::string s; - auto e = rule() + auto e = rule() = *~char_(','); - auto l = rule() + auto l = rule() = e >> *(',' >> e); BOOST_TEST(test_attr("abc1,abc2,abc3", l, s)); @@ -428,8 +428,8 @@ main() { using Attr = boost::variant; Attr attr; - auto const term = rule("term") = int_ | float_; - auto const expr = rule("expr") = term | ('(' > term > ')'); + auto const term = rule("term") = int_ | float_; + auto const expr = rule("expr") = term | ('(' > term > ')'); BOOST_TEST((test_attr("(1)", expr, attr, space))); }