Bug 15718

Summary: boost::spirit example program produce many warnings when compiled with -Wshadow option
Product: Sisyphus Reporter: Slava Semushin <php-coder>
Component: boost-develAssignee: Ivan A. Melnikov <iv>
Status: CLOSED FIXED QA Contact: qa-sisyphus
Severity: minor    
Priority: P2 CC: iv, sem
Version: unstableKeywords: patch
Hardware: all   
OS: Linux   
URL: http://www.nabble.com/boost%3A%3Aspirit-example-program-produce-many-warnings-when-compiled-with--Wshadow-option-to17324157.html
Attachments:
Description Flags
Example of code.
none
Патч, устраняющий эту проблему.
none
Патч для boost 1.36.0 none

Description Slava Semushin 2008-05-19 20:11:24 MSD
I have following stuff:

boost-devel-1.34.1-alt1
gcc4.1-c++-4.1.2-alt2

When I compile simple code with -Wshadow flag I got many warnings:

/usr/include/boost/spirit/core/scanner/scanner.hpp: In member function 'bool
boost::spirit::scanner<IteratorT, PoliciesT>::at_end() const [with IteratorT =
const char*, PoliciesT =
boost::spirit::scanner_policies<boost::spirit::skip_parser_iteration_policy<boost::spirit::nothing_parser,
boost::spirit::iteration_policy>, boost::spirit::match_policy,
boost::spirit::action_policy>]':
/usr/include/boost/spirit/core/scanner/scanner.hpp:233:   instantiated from
'boost::spirit::scanner<IteratorT, PoliciesT>::scanner(IteratorT&, typename
boost::call_traits<IteratorT>::param_type, const PoliciesT&) [with IteratorT =
const char*, PoliciesT =
boost::spirit::scanner_policies<boost::spirit::skip_parser_iteration_policy<boost::spirit::nothing_parser,
boost::spirit::iteration_policy>, boost::spirit::match_policy,
boost::spirit::action_policy>]'
/usr/include/boost/spirit/core/scanner/impl/skipper.ipp:106:   instantiated from
'static boost::spirit::parse_info<IteratorT>
boost::spirit::impl::phrase_parser<SkipT>::parse(const IteratorT&, const
IteratorT&, const ParserT&, const SkipT&) [with IteratorT = const char*, ParserT
=
boost::spirit::sequence<boost::spirit::sequence<boost::spirit::kleene_star<boost::spirit::blank_parser>,
boost::spirit::chlit<char> >,
boost::spirit::kleene_star<boost::spirit::blank_parser> >, SkipT =
boost::spirit::nothing_parser]'
/usr/include/boost/spirit/core/scanner/impl/skipper.ipp:153:   instantiated from
'boost::spirit::parse_info<IteratorT> boost::spirit::parse(const IteratorT&,
const IteratorT&, const boost::spirit::parser<DerivedT>&, const
boost::spirit::parser<SkipT>&) [with IteratorT = const char*, ParserT =
boost::spirit::sequence<boost::spirit::sequence<boost::spirit::kleene_star<boost::spirit::blank_parser>,
boost::spirit::chlit<char> >,
boost::spirit::kleene_star<boost::spirit::blank_parser> >, SkipT =
boost::spirit::nothing_parser]'
/usr/include/boost/spirit/core/scanner/impl/skipper.ipp:171:   instantiated from
'boost::spirit::parse_info<const CharT*> boost::spirit::parse(const CharT*,
const boost::spirit::parser<DerivedT>&, const boost::spirit::parser<SkipT>&)
[with CharT = char, ParserT =
boost::spirit::sequence<boost::spirit::sequence<boost::spirit::kleene_star<boost::spirit::blank_parser>,
boost::spirit::chlit<char> >,
boost::spirit::kleene_star<boost::spirit::blank_parser> >, SkipT =
boost::spirit::nothing_parser]'
boost-test.cc:8:   instantiated from here
/usr/include/boost/spirit/core/scanner/scanner.hpp:245: warning: declaration of
'iteration_policy_t' shadows a member of 'this'
/usr/include/boost/spirit/core/scanner/scanner.hpp: In member function 'typename
boost::detail::iterator_traits<IteratorT>::value_type
boost::spirit::scanner<IteratorT, PoliciesT>::operator*() const [with IteratorT
= const char*, PoliciesT =
boost::spirit::scanner_policies<boost::spirit::skip_parser_iteration_policy<boost::spirit::nothing_parser,
boost::spirit::iteration_policy>, boost::spirit::match_policy,
boost::spirit::action_policy>]':
/usr/include/boost/spirit/core/primitives/primitives.hpp:53:   instantiated from
'typename boost::spirit::parser_result<DerivedT, ScannerT>::type
boost::spirit::char_parser<DrivedT>::parse(const ScannerT&) const [with ScannerT
= boost::spirit::scanner<const char*,
boost::spirit::scanner_policies<boost::spirit::skip_parser_iteration_policy<boost::spirit::nothing_parser,
boost::spirit::iteration_policy>, boost::spirit::match_policy,
boost::spirit::action_policy> >, DerivedT = boost::spirit::chlit<char>]'
/usr/include/boost/spirit/core/composite/sequence.hpp:54:   instantiated from
'typename boost::spirit::parser_result<boost::spirit::sequence<A, B>,
ScannerT>::type boost::spirit::sequence<A, B>::parse(const ScannerT&) const
[with ScannerT = boost::spirit::scanner<const char*,
boost::spirit::scanner_policies<boost::spirit::skip_parser_iteration_policy<boost::spirit::nothing_parser,
boost::spirit::iteration_policy>, boost::spirit::match_policy,
boost::spirit::action_policy> >, A =
boost::spirit::kleene_star<boost::spirit::blank_parser>, B =
boost::spirit::chlit<char>]'
/usr/include/boost/spirit/core/composite/sequence.hpp:53:   instantiated from
'typename boost::spirit::parser_result<boost::spirit::sequence<A, B>,
ScannerT>::type boost::spirit::sequence<A, B>::parse(const ScannerT&) const
[with ScannerT = boost::spirit::scanner<const char*,
boost::spirit::scanner_policies<boost::spirit::skip_parser_iteration_policy<boost::spirit::nothing_parser,
boost::spirit::iteration_policy>, boost::spirit::match_policy,
boost::spirit::action_policy> >, A =
boost::spirit::sequence<boost::spirit::kleene_star<boost::spirit::blank_parser>,
boost::spirit::chlit<char> >, B =
boost::spirit::kleene_star<boost::spirit::blank_parser>]'
/usr/include/boost/spirit/core/scanner/impl/skipper.ipp:107:   instantiated from
'static boost::spirit::parse_info<IteratorT>
boost::spirit::impl::phrase_parser<SkipT>::parse(const IteratorT&, const
IteratorT&, const ParserT&, const SkipT&) [with IteratorT = const char*, ParserT
=
boost::spirit::sequence<boost::spirit::sequence<boost::spirit::kleene_star<boost::spirit::blank_parser>,
boost::spirit::chlit<char> >,
boost::spirit::kleene_star<boost::spirit::blank_parser> >, SkipT =
boost::spirit::nothing_parser]'
/usr/include/boost/spirit/core/scanner/impl/skipper.ipp:153:   instantiated from
'boost::spirit::parse_info<IteratorT> boost::spirit::parse(const IteratorT&,
const IteratorT&, const boost::spirit::parser<DerivedT>&, const
boost::spirit::parser<SkipT>&) [with IteratorT = const char*, ParserT =
boost::spirit::sequence<boost::spirit::sequence<boost::spirit::kleene_star<boost::spirit::blank_parser>,
boost::spirit::chlit<char> >,
boost::spirit::kleene_star<boost::spirit::blank_parser> >, SkipT =
boost::spirit::nothing_parser]'
/usr/include/boost/spirit/core/scanner/impl/skipper.ipp:171:   instantiated from
'boost::spirit::parse_info<const CharT*> boost::spirit::parse(const CharT*,
const boost::spirit::parser<DerivedT>&, const boost::spirit::parser<SkipT>&)
[with CharT = char, ParserT =
boost::spirit::sequence<boost::spirit::sequence<boost::spirit::kleene_star<boost::spirit::blank_parser>,
boost::spirit::chlit<char> >,
boost::spirit::kleene_star<boost::spirit::blank_parser> >, SkipT =
boost::spirit::nothing_parser]'
boost-test.cc:8:   instantiated from here
/usr/include/boost/spirit/core/scanner/scanner.hpp:252: warning: declaration of
'iteration_policy_t' shadows a member of 'this'
/usr/include/boost/spirit/core/impl/match.ipp: In constructor
'boost::spirit::match<T>::match(size_t, typename
boost::optional<T>::argument_type) [with T = char]':
/usr/include/boost/spirit/core/scanner/scanner.hpp:86:   instantiated from
'boost::spirit::match<T> boost::spirit::match_policy::create_match(size_t, const
AttrT&, const IteratorT&, const IteratorT&) const [with AttrT = char, IteratorT
= const char*]'
/usr/include/boost/spirit/core/primitives/primitives.hpp:58:   instantiated from
'typename boost::spirit::parser_result<DerivedT, ScannerT>::type
boost::spirit::char_parser<DrivedT>::parse(const ScannerT&) const [with ScannerT
= boost::spirit::scanner<const char*,
boost::spirit::scanner_policies<boost::spirit::skip_parser_iteration_policy<boost::spirit::nothing_parser,
boost::spirit::iteration_policy>, boost::spirit::match_policy,
boost::spirit::action_policy> >, DerivedT = boost::spirit::chlit<char>]'
/usr/include/boost/spirit/core/composite/sequence.hpp:54:   instantiated from
'typename boost::spirit::parser_result<boost::spirit::sequence<A, B>,
ScannerT>::type boost::spirit::sequence<A, B>::parse(const ScannerT&) const
[with ScannerT = boost::spirit::scanner<const char*,
boost::spirit::scanner_policies<boost::spirit::skip_parser_iteration_policy<boost::spirit::nothing_parser,
boost::spirit::iteration_policy>, boost::spirit::match_policy,
boost::spirit::action_policy> >, A =
boost::spirit::kleene_star<boost::spirit::blank_parser>, B =
boost::spirit::chlit<char>]'
/usr/include/boost/spirit/core/composite/sequence.hpp:53:   instantiated from
'typename boost::spirit::parser_result<boost::spirit::sequence<A, B>,
ScannerT>::type boost::spirit::sequence<A, B>::parse(const ScannerT&) const
[with ScannerT = boost::spirit::scanner<const char*,
boost::spirit::scanner_policies<boost::spirit::skip_parser_iteration_policy<boost::spirit::nothing_parser,
boost::spirit::iteration_policy>, boost::spirit::match_policy,
boost::spirit::action_policy> >, A =
boost::spirit::sequence<boost::spirit::kleene_star<boost::spirit::blank_parser>,
boost::spirit::chlit<char> >, B =
boost::spirit::kleene_star<boost::spirit::blank_parser>]'
/usr/include/boost/spirit/core/scanner/impl/skipper.ipp:107:   instantiated from
'static boost::spirit::parse_info<IteratorT>
boost::spirit::impl::phrase_parser<SkipT>::parse(const IteratorT&, const
IteratorT&, const ParserT&, const SkipT&) [with IteratorT = const char*, ParserT
=
boost::spirit::sequence<boost::spirit::sequence<boost::spirit::kleene_star<boost::spirit::blank_parser>,
boost::spirit::chlit<char> >,
boost::spirit::kleene_star<boost::spirit::blank_parser> >, SkipT =
boost::spirit::nothing_parser]'
/usr/include/boost/spirit/core/scanner/impl/skipper.ipp:153:   instantiated from
'boost::spirit::parse_info<IteratorT> boost::spirit::parse(const IteratorT&,
const IteratorT&, const boost::spirit::parser<DerivedT>&, const
boost::spirit::parser<SkipT>&) [with IteratorT = const char*, ParserT =
boost::spirit::sequence<boost::spirit::sequence<boost::spirit::kleene_star<boost::spirit::blank_parser>,
boost::spirit::chlit<char> >,
boost::spirit::kleene_star<boost::spirit::blank_parser> >, SkipT =
boost::spirit::nothing_parser]'
/usr/include/boost/spirit/core/scanner/impl/skipper.ipp:171:   instantiated from
'boost::spirit::parse_info<const CharT*> boost::spirit::parse(const CharT*,
const boost::spirit::parser<DerivedT>&, const boost::spirit::parser<SkipT>&)
[with CharT = char, ParserT =
boost::spirit::sequence<boost::spirit::sequence<boost::spirit::kleene_star<boost::spirit::blank_parser>,
boost::spirit::chlit<char> >,
boost::spirit::kleene_star<boost::spirit::blank_parser> >, SkipT =
boost::spirit::nothing_parser]'
boost-test.cc:8:   instantiated from here
/usr/include/boost/spirit/core/impl/match.ipp:24: warning: declaration of
'length' shadows a member of 'this'
/usr/include/boost/spirit/core/scanner/scanner.hpp: In member function 'bool
boost::spirit::scanner<IteratorT, PoliciesT>::at_end() const [with IteratorT =
const char*, PoliciesT =
boost::spirit::scanner_policies<boost::spirit::no_skipper_iteration_policy<boost::spirit::skip_parser_iteration_policy<boost::spirit::nothing_parser,
boost::spirit::iteration_policy> >, boost::spirit::match_policy,
boost::spirit::action_policy>]':
/usr/include/boost/spirit/core/scanner/scanner.hpp:233:   instantiated from
'boost::spirit::scanner<IteratorT, PoliciesT>::scanner(IteratorT&, typename
boost::call_traits<IteratorT>::param_type, const PoliciesT&) [with IteratorT =
const char*, PoliciesT =
boost::spirit::scanner_policies<boost::spirit::no_skipper_iteration_policy<boost::spirit::skip_parser_iteration_policy<boost::spirit::nothing_parser,
boost::spirit::iteration_policy> >, boost::spirit::match_policy,
boost::spirit::action_policy>]'
/usr/include/boost/spirit/core/scanner/impl/skipper.ipp:36:   instantiated from
'void boost::spirit::impl::skipper_skip(const ST&, const ScannerT&, const
boost::spirit::skipper_iteration_policy<BaseT>&) [with ST =
boost::spirit::nothing_parser, ScannerT = boost::spirit::scanner<const char*,
boost::spirit::scanner_policies<boost::spirit::skip_parser_iteration_policy<boost::spirit::nothing_parser,
boost::spirit::iteration_policy>, boost::spirit::match_policy,
boost::spirit::action_policy> >, BaseT = boost::spirit::iteration_policy]'
/usr/include/boost/spirit/core/scanner/skipper.hpp:135:   instantiated from
'void boost::spirit::skip_parser_iteration_policy<ParserT, BaseT>::skip(const
ScannerT&) const [with ScannerT = boost::spirit::scanner<const char*,
boost::spirit::scanner_policies<boost::spirit::skip_parser_iteration_policy<boost::spirit::nothing_parser,
boost::spirit::iteration_policy>, boost::spirit::match_policy,
boost::spirit::action_policy> >, ParserT = boost::spirit::nothing_parser, BaseT
= boost::spirit::iteration_policy]'
/usr/include/boost/spirit/core/scanner/skipper.hpp:51:   instantiated from 'bool
boost::spirit::skipper_iteration_policy<BaseT>::at_end(const ScannerT&) const
[with ScannerT = boost::spirit::scanner<const char*,
boost::spirit::scanner_policies<boost::spirit::skip_parser_iteration_policy<boost::spirit::nothing_parser,
boost::spirit::iteration_policy>, boost::spirit::match_policy,
boost::spirit::action_policy> >, BaseT = boost::spirit::iteration_policy]'
/usr/include/boost/spirit/core/scanner/scanner.hpp:246:   instantiated from
'bool boost::spirit::scanner<IteratorT, PoliciesT>::at_end() const [with
IteratorT = const char*, PoliciesT =
boost::spirit::scanner_policies<boost::spirit::skip_parser_iteration_policy<boost::spirit::nothing_parser,
boost::spirit::iteration_policy>, boost::spirit::match_policy,
boost::spirit::action_policy>]'
/usr/include/boost/spirit/core/scanner/scanner.hpp:233:   instantiated from
'boost::spirit::scanner<IteratorT, PoliciesT>::scanner(IteratorT&, typename
boost::call_traits<IteratorT>::param_type, const PoliciesT&) [with IteratorT =
const char*, PoliciesT =
boost::spirit::scanner_policies<boost::spirit::skip_parser_iteration_policy<boost::spirit::nothing_parser,
boost::spirit::iteration_policy>, boost::spirit::match_policy,
boost::spirit::action_policy>]'
/usr/include/boost/spirit/core/scanner/impl/skipper.ipp:106:   instantiated from
'static boost::spirit::parse_info<IteratorT>
boost::spirit::impl::phrase_parser<SkipT>::parse(const IteratorT&, const
IteratorT&, const ParserT&, const SkipT&) [with IteratorT = const char*, ParserT
=
boost::spirit::sequence<boost::spirit::sequence<boost::spirit::kleene_star<boost::spirit::blank_parser>,
boost::spirit::chlit<char> >,
boost::spirit::kleene_star<boost::spirit::blank_parser> >, SkipT =
boost::spirit::nothing_parser]'
/usr/include/boost/spirit/core/scanner/impl/skipper.ipp:153:   instantiated from
'boost::spirit::parse_info<IteratorT> boost::spirit::parse(const IteratorT&,
const IteratorT&, const boost::spirit::parser<DerivedT>&, const
boost::spirit::parser<SkipT>&) [with IteratorT = const char*, ParserT =
boost::spirit::sequence<boost::spirit::sequence<boost::spirit::kleene_star<boost::spirit::blank_parser>,
boost::spirit::chlit<char> >,
boost::spirit::kleene_star<boost::spirit::blank_parser> >, SkipT =
boost::spirit::nothing_parser]'
/usr/include/boost/spirit/core/scanner/impl/skipper.ipp:171:   instantiated from
'boost::spirit::parse_info<const CharT*> boost::spirit::parse(const CharT*,
const boost::spirit::parser<DerivedT>&, const boost::spirit::parser<SkipT>&)
[with CharT = char, ParserT =
boost::spirit::sequence<boost::spirit::sequence<boost::spirit::kleene_star<boost::spirit::blank_parser>,
boost::spirit::chlit<char> >,
boost::spirit::kleene_star<boost::spirit::blank_parser> >, SkipT =
boost::spirit::nothing_parser]'
boost-test.cc:8:   instantiated from here
/usr/include/boost/spirit/core/scanner/scanner.hpp:245: warning: declaration of
'iteration_policy_t' shadows a member of 'this'


Code with trivial example will me attached.
Comment 1 Slava Semushin 2008-05-19 20:12:41 MSD
Created attachment 2637 [details]
Example of code.
Comment 2 Slava Semushin 2008-05-19 20:16:06 MSD
P.S. May be it was fixed in boost-1.35 version, I don't known because doesn't
have it for testing... :-(
Comment 3 Damir Shayhutdinov 2008-05-19 20:17:26 MSD
Слава, поговори пожалуйста на эту тему с апстримом, я не настолько силен в С++,
и уж тем более не силен в том надругательстве над С++, которое постоянно делают
авторы boost.
Comment 4 Slava Semushin 2008-05-19 20:22:19 MSD
Я так и думал, поэтому и написал на английском, чтобы потом можно было сослаться
на баг :) Я просто думаю, вдруг это в 1.35 исправлено? Я что-то не смог найти у
них в системне контроя версий возможность посмотреть какие изменения
производились с файлом и когда. Ладно. Напишу им в рассылку, пожалуй..
Comment 5 algor 2008-05-20 09:39:17 MSD
php-coder: как напишешь в рассылку, прицепи сюда линк, плз. чисто поржать.
Comment 6 Slava Semushin 2008-05-22 12:08:37 MSD
Created attachment 2638 [details]
Патч, устраняющий эту проблему.
Comment 7 Slava Semushin 2008-05-22 21:16:59 MSD
(In reply to comment #5)
> php-coder: как напишешь в рассылку, прицепи сюда линк, плз. чисто поржать.

http://www.nabble.com/boost%3A%3Aspirit-example-program-produce-many-warnings-when-compiled-with--Wshadow-option-to17324157.html

Можешь ржать: патч "Applied in Boost SVN trunk."
Comment 8 Slava Semushin 2008-10-12 22:35:39 MSD
Created attachment 2992 [details]
Патч для boost 1.36.0

Странно, похоже, что в буст не полностью патч приняли, потому что варнинги частично всё равно остались. Обновил патч.
Comment 9 Ivan A. Melnikov 2008-10-13 14:11:22 MSD
Нашёл вот:

http://svn.boost.org/trac/boost/ticket/2304

Приложеный туда патч исправляет ещё несколько подобных потенциальных проблем. Стоит на него посмотреть, а заодно и спросить у апстрима их мнение по этому поводу.

2 php-coder@ : спросите? а то я на spirit-general не подписан...
Comment 10 Ivan A. Melnikov 2008-10-17 22:31:36 MSD
В сизифе уже лежит boost-1:1.36.0-alt3, где это исправлено. Багу можно закрывать.
Comment 11 Ivan A. Melnikov 2008-10-24 20:49:04 MSD
Обновил boost до 1.36.0-alt3 из Cизифа, проверил, работает.
Comment 12 Slava Semushin 2008-10-24 20:52:09 MSD
(In reply to comment #11)
> Обновил boost до 1.36.0-alt3 из Cизифа, проверил, работает.

Спасибо!!!