Opened 9 years ago

Closed 6 years ago

#9113 closed Bugs (fixed)

Warning in visit_each with -Wshadow

Reported by: Mathias Gaunard Owned by: Thomas Heller
Milestone: To Be Determined Component: phoenix
Version: Boost Development Trunk Severity: Problem
Keywords: Cc:

Description

/home/nt2/dev/boost/trunk/boost/phoenix/core/visit_each.hpp: In constructor ‘boost::phoenix::detail::visit_each_impl<Visitor>::visit_each_impl(Visitor&)’:
/home/nt2/dev/boost/trunk/boost/phoenix/core/visit_each.hpp:25:48: warning: declaration of ‘visitor’ shadows a member of 'this' [-Wshadow]

Attachments (2)

phoenix_shadow_warnings.txt (27.0 KB ) - added by Mathias Gaunard 9 years ago.
shadow_warnings2.txt (8.1 KB ) - added by Mathias Gaunard 9 years ago.

Download all attachments as: .zip

Change History (14)

comment:1 by Mathias Gaunard, 9 years ago

Other warnings in Phoenix of the same type:

/home/nt2/dev/boost/trunk/boost/phoenix/operator/detail/preprocessed/mem_fun_ptr_gen_10.hpp: In constructor ‘boost::phoenix::detail::mem_fun_ptr_gen<Object, MemPtr>::mem_fun_ptr_gen(const Object&, MemPtr)’:
/home/nt2/dev/boost/trunk/boost/phoenix/operator/detail/preprocessed/mem_fun_ptr_gen_10.hpp:16:15: warning: declaration of ‘ptr’ shadows a member of 'this' [-Wshadow]
/home/nt2/dev/boost/trunk/boost/phoenix/operator/detail/preprocessed/mem_fun_ptr_gen_10.hpp:16:15: warning: declaration of ‘obj’ shadows a member of 'this' [-Wshadow]
/home/nt2/dev/boost/trunk/boost/phoenix/function/function.hpp: In constructor ‘boost::phoenix::function<F>::function(F)’:
/home/nt2/dev/boost/trunk/boost/phoenix/function/function.hpp:41:11: warning: declaration of ‘f’ shadows a member of 'this' [-Wshadow]
/home/nt2/dev/boost/trunk/boost/phoenix/statement/do_while.hpp: In constructor ‘boost::phoenix::do_while_gen<Do>::do_while_gen(const Do&)’:
/home/nt2/dev/boost/trunk/boost/phoenix/statement/do_while.hpp:47:13: warning: declaration of ‘do_’ shadows a member of 'this' [-Wshadow]
/home/nt2/dev/boost/trunk/boost/phoenix/statement/for.hpp: In member function ‘boost::phoenix::for_eval::result_type boost::phoenix::for_eval::operator()(const Init&, const Cond&, const Step&, const Do&, const Context&) const’:
/home/nt2/dev/boost/trunk/boost/phoenix/statement/for.hpp:45:9: warning: declaration of ‘do_’ shadows a global declaration [-Wshadow]
/home/nt2/dev/boost/trunk/boost/phoenix/statement/for.hpp: In constructor ‘boost::phoenix::for_gen<Init, Cond, Step>::for_gen(const Init&, const Cond&, const Step&)’:
/home/nt2/dev/boost/trunk/boost/phoenix/statement/for.hpp:60:13: warning: declaration of ‘step’ shadows a member of 'this' [-Wshadow]
/home/nt2/dev/boost/trunk/boost/phoenix/statement/for.hpp:60:13: warning: declaration of ‘cond’ shadows a member of 'this' [-Wshadow]
/home/nt2/dev/boost/trunk/boost/phoenix/statement/for.hpp:60:13: warning: declaration of ‘init’ shadows a member of 'this' [-Wshadow]
/home/nt2/dev/boost/trunk/boost/phoenix/statement/for.hpp: In member function ‘const typename boost::phoenix::expression::for_<Init, Cond, Step, Do>::type boost::phoenix::for_gen<Init, Cond, Step>::operator[](const Do&) const’:
/home/nt2/dev/boost/trunk/boost/phoenix/statement/for.hpp:65:9: warning: declaration of ‘do_’ shadows a global declaration [-Wshadow]
/home/nt2/dev/boost/trunk/boost/phoenix/statement/if.hpp: In constructor ‘boost::phoenix::else_gen<Cond, Then>::else_gen(const Cond&, const Then&)’:
/home/nt2/dev/boost/trunk/boost/phoenix/statement/if.hpp:97:13: warning: declaration of ‘then’ shadows a member of 'this' [-Wshadow]
/home/nt2/dev/boost/trunk/boost/phoenix/statement/if.hpp:97:13: warning: declaration of ‘cond’ shadows a member of 'this' [-Wshadow]
/home/nt2/dev/boost/trunk/boost/phoenix/statement/if.hpp: In constructor ‘boost::phoenix::if_gen<Cond>::if_gen(const Cond&)’:
/home/nt2/dev/boost/trunk/boost/phoenix/statement/if.hpp:139:13: warning: declaration of ‘cond’ shadows a member of 'this' [-Wshadow]
/home/nt2/dev/boost/trunk/boost/phoenix/statement/switch.hpp: In constructor ‘boost::phoenix::switch_gen<Cond>::switch_gen(const Cond&)’:
/home/nt2/dev/boost/trunk/boost/phoenix/statement/switch.hpp:241:38: warning: declaration of ‘cond’ shadows a member of 'this' [-Wshadow]
/home/nt2/dev/boost/trunk/boost/phoenix/statement/try_catch.hpp: In constructor ‘boost::phoenix::catch_gen<TryCatch, Exception>::catch_gen(const TryCatch&)’:
/home/nt2/dev/boost/trunk/boost/phoenix/statement/try_catch.hpp:277:46: warning: declaration of ‘try_catch’ shadows a member of 'this' [-Wshadow]
/home/nt2/dev/boost/trunk/boost/phoenix/statement/try_catch.hpp: In constructor ‘boost::phoenix::catch_all_gen<TryCatch>::catch_all_gen(const TryCatch&)’:
/home/nt2/dev/boost/trunk/boost/phoenix/statement/try_catch.hpp:304:50: warning: declaration of ‘try_catch’ shadows a member of 'this' [-Wshadow]
/home/nt2/dev/boost/trunk/boost/phoenix/statement/while.hpp: In member function ‘boost::phoenix::while_eval::result_type boost::phoenix::while_eval::operator()(const Cond&, const Do&, const Context&) const’:
/home/nt2/dev/boost/trunk/boost/phoenix/statement/while.hpp:31:9: warning: declaration of ‘do_’ shadows a global declaration [-Wshadow]

and many others...

comment:2 by John Fletcher <J.P.Fletcher@…>, 9 years ago

Fixes for some of these pushed to develop branch.

comment:3 by Mathias Gaunard, 9 years ago

Not quite fixed, attached is a text file with several warnings about shadowing variables in Phoenix

by Mathias Gaunard, 9 years ago

Attachment: phoenix_shadow_warnings.txt added

comment:4 by John Fletcher <J.P.Fletcher@…>, 9 years ago

Thank you I will look into these. I know I did not fix them all. John

comment:5 by John Fletcher <J.P.Fletcher@…>, 9 years ago

I think I have now fixed all of these. Would you check please and let me know of any remaining? Thanks John

in reply to:  5 comment:6 by John Fletcher <J.P.Fletcher@…>, 9 years ago

Replying to John Fletcher <J.P.Fletcher@…>:

I think I have now fixed all of these. Would you check please and let me know of any remaining? Thanks John

They will be on the develop branch shortly and into the next release (3.0.5).

comment:7 by Mathias Gaunard, 9 years ago

I still get warnings with latest develop, db1f0eed551cd2693144e1ccd6ffc38f7fd5bae8

by Mathias Gaunard, 9 years ago

Attachment: shadow_warnings2.txt added

comment:8 by John Fletcher <J.P.Fletcher@…>, 9 years ago

I think I have fixed those, including two sets of preprocessed files. Would you check again please? They are on develop. John

comment:9 by Mathias Gaunard, 9 years ago

Only one left:

/home/nt2/dev/boost/boost/phoenix/bind/detail/member_function_ptr.hpp: In constructor ‘boost::phoenix::detail::member_function_ptr_impl<0>::impl<RT, FP>::impl(FP)’: /home/nt2/dev/boost/boost/phoenix/bind/detail/member_function_ptr.hpp:57:17: warning: declaration of ‘fp’ shadows a member of 'this' [-Wshadow]

Thanks for this

comment:10 by John Fletcher <J.P.Fletcher@…>, 9 years ago

This one is now fixed on develop. I have some other things on test and will probably do another release to master, hopefully to get into the next Boost release. Thank you for your help. John

comment:11 by Mathias Gaunard, 9 years ago

Can't see any warnings anymore, thanks.

comment:12 by Kohei Takahashi, 6 years ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.