[accumulator] A lot of unused "parameter" warnings

Hi, I'm getting a lot of warnings while using Boost.Accumulators. Would you accept a patch that resolve them by commenting the parameter name? Best, Vicente In file included from stopwatch/basic_stopwatch_laps_accumulator_set_pass.cpp:17: In file included from ../../../boost/chrono/stopwatches/memories/laps_accumulator_set.hpp:12: In file included from ../../../boost/accumulators/framework/accumulator_set.hpp:19: In file included from ../../../boost/parameter/parameters.hpp:45: ../../../boost/parameter/aux_/tagged_argument.hpp:123:60: warning: unused parameter 'x' [-Wunused-parameter] reference operator[](default_<key_type,Default> const& x) const ^ ../../../boost/parameter/aux_/tagged_argument.hpp:129:58: warning: unused parameter 'x' [-Wunused-parameter] reference operator[](lazy_default<key_type,F> const& x) const ^ In file included from stopwatch/basic_stopwatch_laps_accumulator_set_pass.cpp:17: In file included from ../../../boost/chrono/stopwatches/memories/laps_accumulator_set.hpp:12: In file included from ../../../boost/accumulators/framework/accumulator_set.hpp:23: In file included from ../../../boost/accumulators/framework/depends_on.hpp:39: In file included from ../../../boost/fusion/include/mpl.hpp:11: In file included from ../../../boost/fusion/mpl.hpp:23: In file included from ../../../boost/fusion/mpl/has_key.hpp:11: ../../../boost/fusion/sequence/intrinsic/has_key.hpp:71:29: warning: unused parameter 'seq' [-Wunused-parameter] has_key(Sequence const& seq) ^ In file included from stopwatch/basic_stopwatch_laps_accumulator_set_pass.cpp:17: In file included from ../../../boost/chrono/stopwatches/memories/laps_accumulator_set.hpp:12: In file included from ../../../boost/accumulators/framework/accumulator_set.hpp:29: In file included from ../../../boost/fusion/include/any.hpp:10: In file included from ../../../boost/fusion/algorithm/query/any.hpp:13: ../../../boost/fusion/algorithm/query/detail/any.hpp:112:36: warning: unused parameter 'it' [-Wunused-parameter] static bool call(It const& it, F f) ^ ../../../boost/fusion/algorithm/query/detail/any.hpp:112:42: warning: unused parameter 'f' [-Wunused-parameter] static bool call(It const& it, F f) ^ In file included from stopwatch/basic_stopwatch_laps_accumulator_set_pass.cpp:17: In file included from ../../../boost/chrono/stopwatches/memories/laps_accumulator_set.hpp:14: In file included from ../../../boost/accumulators/statistics/sum.hpp:14: ../../../boost/accumulators/numeric/functional.hpp:188:5: warning: unused variable 'plus' [-Wunused-variable] BOOST_NUMERIC_FUNCTIONAL_DEFINE_BINARY_OP(plus, +, BOOST_NUMERIC_FUNCTIONAL_DEDUCED) ^ ../../../boost/accumulators/numeric/functional.hpp:188:47: note: instantiated from: BOOST_NUMERIC_FUNCTIONAL_DEFINE_BINARY_OP(plus, +, BOOST_NUMERIC_FUNCTIONAL_DEDUCED) ^ ../../../boost/accumulators/numeric/functional.hpp:189:5: warning: unused variable 'minus' [-Wunused-variable] BOOST_NUMERIC_FUNCTIONAL_DEFINE_BINARY_OP(minus, -, BOOST_NUMERIC_FUNCTIONAL_DEDUCED) ^ ../../../boost/accumulators/numeric/functional.hpp:189:47: note: instantiated from: BOOST_NUMERIC_FUNCTIONAL_DEFINE_BINARY_OP(minus, -, BOOST_NUMERIC_FUNCTIONAL_DEDUCED) ^ ../../../boost/accumulators/numeric/functional.hpp:190:5: warning: unused variable 'multiplies' [-Wunused-variable] BOOST_NUMERIC_FUNCTIONAL_DEFINE_BINARY_OP(multiplies, *, BOOST_NUMERIC_FUNCTIONAL_DEDUCED) ^ ../../../boost/accumulators/numeric/functional.hpp:190:47: note: instantiated from: BOOST_NUMERIC_FUNCTIONAL_DEFINE_BINARY_OP(multiplies, *, BOOST_NUMERIC_FUNCTIONAL_DEDUCED) ^ ../../../boost/accumulators/numeric/functional.hpp:191:5: warning: unused variable 'divides' [-Wunused-variable] BOOST_NUMERIC_FUNCTIONAL_DEFINE_BINARY_OP(divides, /, BOOST_NUMERIC_FUNCTIONAL_DEDUCED) ^ ../../../boost/accumulators/numeric/functional.hpp:191:47: note: instantiated from: BOOST_NUMERIC_FUNCTIONAL_DEFINE_BINARY_OP(divides, /, BOOST_NUMERIC_FUNCTIONAL_DEDUCED) ^ ../../../boost/accumulators/numeric/functional.hpp:192:5: warning: unused variable 'modulus' [-Wunused-variable] BOOST_NUMERIC_FUNCTIONAL_DEFINE_BINARY_OP(modulus, %, BOOST_NUMERIC_FUNCTIONAL_DEDUCED) ^ ../../../boost/accumulators/numeric/functional.hpp:192:47: note: instantiated from: BOOST_NUMERIC_FUNCTIONAL_DEFINE_BINARY_OP(modulus, %, BOOST_NUMERIC_FUNCTIONAL_DEDUCED) ^ ../../../boost/accumulators/numeric/functional.hpp:194:5: warning: unused variable 'greater_equal' [-Wunused-variable] BOOST_NUMERIC_FUNCTIONAL_DEFINE_BINARY_OP(greater_equal, >=, BOOST_NUMERIC_FUNCTIONAL_DEDUCED) ^ ../../../boost/accumulators/numeric/functional.hpp:194:47: note: instantiated from: BOOST_NUMERIC_FUNCTIONAL_DEFINE_BINARY_OP(greater_equal, >=, BOOST_NUMERIC_FUNCTIONAL_DEDUCED) ^ ../../../boost/accumulators/numeric/functional.hpp:196:5: warning: unused variable 'less_equal' [-Wunused-variable] BOOST_NUMERIC_FUNCTIONAL_DEFINE_BINARY_OP(less_equal, <=, BOOST_NUMERIC_FUNCTIONAL_DEDUCED) ^ ../../../boost/accumulators/numeric/functional.hpp:196:47: note: instantiated from: BOOST_NUMERIC_FUNCTIONAL_DEFINE_BINARY_OP(less_equal, <=, BOOST_NUMERIC_FUNCTIONAL_DEDUCED) ^ ../../../boost/accumulators/numeric/functional.hpp:197:5: warning: unused variable 'equal_to' [-Wunused-variable] BOOST_NUMERIC_FUNCTIONAL_DEFINE_BINARY_OP(equal_to, ==, BOOST_NUMERIC_FUNCTIONAL_DEDUCED) ^ ../../../boost/accumulators/numeric/functional.hpp:197:47: note: instantiated from: BOOST_NUMERIC_FUNCTIONAL_DEFINE_BINARY_OP(equal_to, ==, BOOST_NUMERIC_FUNCTIONAL_DEDUCED) ^ ../../../boost/accumulators/numeric/functional.hpp:198:5: warning: unused variable 'not_equal_to' [-Wunused-variable] BOOST_NUMERIC_FUNCTIONAL_DEFINE_BINARY_OP(not_equal_to, !=, BOOST_NUMERIC_FUNCTIONAL_DEDUCED) ^ ../../../boost/accumulators/numeric/functional.hpp:198:47: note: instantiated from: BOOST_NUMERIC_FUNCTIONAL_DEFINE_BINARY_OP(not_equal_to, !=, BOOST_NUMERIC_FUNCTIONAL_DEDUCED) ^ ../../../boost/accumulators/numeric/functional.hpp:200:5: warning: unused variable 'assign' [-Wunused-variable] BOOST_NUMERIC_FUNCTIONAL_DEFINE_BINARY_OP(assign, =, BOOST_NUMERIC_FUNCTIONAL_LEFT) ^ ../../../boost/accumulators/numeric/functional.hpp:200:47: note: instantiated from: BOOST_NUMERIC_FUNCTIONAL_DEFINE_BINARY_OP(assign, =, BOOST_NUMERIC_FUNCTIONAL_LEFT) ^ ../../../boost/accumulators/numeric/functional.hpp:201:5: warning: unused variable 'plus_assign' [-Wunused-variable] BOOST_NUMERIC_FUNCTIONAL_DEFINE_BINARY_OP(plus_assign, +=, BOOST_NUMERIC_FUNCTIONAL_LEFT) ^ ../../../boost/accumulators/numeric/functional.hpp:201:47: note: instantiated from: BOOST_NUMERIC_FUNCTIONAL_DEFINE_BINARY_OP(plus_assign, +=, BOOST_NUMERIC_FUNCTIONAL_LEFT) ^ ../../../boost/accumulators/numeric/functional.hpp:202:5: warning: unused variable 'minus_assign' [-Wunused-variable] BOOST_NUMERIC_FUNCTIONAL_DEFINE_BINARY_OP(minus_assign, -=, BOOST_NUMERIC_FUNCTIONAL_LEFT) ^ ../../../boost/accumulators/numeric/functional.hpp:202:47: note: instantiated from: BOOST_NUMERIC_FUNCTIONAL_DEFINE_BINARY_OP(minus_assign, -=, BOOST_NUMERIC_FUNCTIONAL_LEFT) ^ ../../../boost/accumulators/numeric/functional.hpp:203:5: warning: unused variable 'multiplies_assign' [-Wunused-variable] BOOST_NUMERIC_FUNCTIONAL_DEFINE_BINARY_OP(multiplies_assign, *=, BOOST_NUMERIC_FUNCTIONAL_LEFT) ^ ../../../boost/accumulators/numeric/functional.hpp:203:47: note: instantiated from: BOOST_NUMERIC_FUNCTIONAL_DEFINE_BINARY_OP(multiplies_assign, *=, BOOST_NUMERIC_FUNCTIONAL_LEFT) ^ ../../../boost/accumulators/numeric/functional.hpp:204:5: warning: unused variable 'divides_assign' [-Wunused-variable] BOOST_NUMERIC_FUNCTIONAL_DEFINE_BINARY_OP(divides_assign, /=, BOOST_NUMERIC_FUNCTIONAL_LEFT) ^ ../../../boost/accumulators/numeric/functional.hpp:204:47: note: instantiated from: BOOST_NUMERIC_FUNCTIONAL_DEFINE_BINARY_OP(divides_assign, /=, BOOST_NUMERIC_FUNCTIONAL_LEFT) ^ ../../../boost/accumulators/numeric/functional.hpp:205:5: warning: unused variable 'modulus_assign' [-Wunused-variable] BOOST_NUMERIC_FUNCTIONAL_DEFINE_BINARY_OP(modulus_assign, %=, BOOST_NUMERIC_FUNCTIONAL_LEFT) ^ ../../../boost/accumulators/numeric/functional.hpp:205:47: note: instantiated from: BOOST_NUMERIC_FUNCTIONAL_DEFINE_BINARY_OP(modulus_assign, %=, BOOST_NUMERIC_FUNCTIONAL_LEFT) ^ ../../../boost/accumulators/numeric/functional.hpp:207:5: warning: unused variable 'unary_plus' [-Wunused-variable] BOOST_NUMERIC_FUNCTIONAL_DEFINE_UNARY_OP(unary_plus, +) ^ ../../../boost/accumulators/numeric/functional.hpp:207:46: note: instantiated from: BOOST_NUMERIC_FUNCTIONAL_DEFINE_UNARY_OP(unary_plus, +) ^ ../../../boost/accumulators/numeric/functional.hpp:208:5: warning: unused variable 'unary_minus' [-Wunused-variable] BOOST_NUMERIC_FUNCTIONAL_DEFINE_UNARY_OP(unary_minus, -) ^ ../../../boost/accumulators/numeric/functional.hpp:208:46: note: instantiated from: BOOST_NUMERIC_FUNCTIONAL_DEFINE_UNARY_OP(unary_minus, -) ^ ../../../boost/accumulators/numeric/functional.hpp:209:5: warning: unused variable 'complement' [-Wunused-variable] BOOST_NUMERIC_FUNCTIONAL_DEFINE_UNARY_OP(complement, ~) ^ ../../../boost/accumulators/numeric/functional.hpp:209:46: note: instantiated from: BOOST_NUMERIC_FUNCTIONAL_DEFINE_UNARY_OP(complement, ~) ^ ../../../boost/accumulators/numeric/functional.hpp:210:5: warning: unused variable 'logical_not' [-Wunused-variable] BOOST_NUMERIC_FUNCTIONAL_DEFINE_UNARY_OP(logical_not, !) ^ ../../../boost/accumulators/numeric/functional.hpp:210:46: note: instantiated from: BOOST_NUMERIC_FUNCTIONAL_DEFINE_UNARY_OP(logical_not, !) ^ ../../../boost/accumulators/numeric/functional.hpp:414:28: warning: unused variable 'average' [-Wunused-variable] op::average const &average = boost::detail::pod_singleton<op::average>::instance; ^ ../../../boost/accumulators/numeric/functional.hpp:417:28: warning: unused variable 'as_zero' [-Wunused-variable] op::as_zero const &as_zero = boost::detail::pod_singleton<op::as_zero>::instance; ^ ../../../boost/accumulators/numeric/functional.hpp:418:27: warning: unused variable 'as_one' [-Wunused-variable] op::as_one const &as_one = boost::detail::pod_singleton<op::as_one>::instance; ^ In file included from stopwatch/basic_stopwatch_laps_accumulator_set_pass.cpp:17: In file included from ../../../boost/chrono/stopwatches/memories/laps_accumulator_set.hpp:14: In file included from ../../../boost/accumulators/statistics/sum.hpp:16: ../../../boost/accumulators/framework/parameters/weight.hpp:17:1: warning: unused variable 'weight' [-Wunused-variable] BOOST_PARAMETER_KEYWORD(tag, weight) ^ ../../../boost/accumulators/framework/parameters/weight.hpp:17:30: note: instantiated from: BOOST_PARAMETER_KEYWORD(tag, weight) ^ In file included from stopwatch/basic_stopwatch_laps_accumulator_set_pass.cpp:17: In file included from ../../../boost/chrono/stopwatches/memories/laps_accumulator_set.hpp:18: In file included from ../../../boost/accumulators/accumulators.hpp:21: ../../../boost/accumulators/framework/parameters/weights.hpp:17:1: warning: unused variable 'weights' [-Wunused-variable] BOOST_PARAMETER_KEYWORD(tag, weights) ^ ../../../boost/accumulators/framework/parameters/weights.hpp:17:30: note: instantiated from: BOOST_PARAMETER_KEYWORD(tag, weights) ^

On 10/1/2011 9:29 AM, Vicente J. Botet Escriba wrote:
Would you accept a patch that resolve them by commenting the parameter name?
Patches gladly accepted. Just open a ticket on svn.boost.org and attach the patch. Thanks! -- Eric Niebler BoostPro Computing http://www.boostpro.com

Le 01/10/11 20:03, Eric Niebler a écrit :
On 10/1/2011 9:29 AM, Vicente J. Botet Escriba wrote:
Would you accept a patch that resolve them by commenting the parameter name? Patches gladly accepted. Just open a ticket on svn.boost.org and attach the patch. Thanks!
Well, I have reached to remove the warnings in Boost.Parameter and Boost.Fusion. The warnings in Boost.Accumulators are related to static variables included in a unnamed namespace such as ../../../boost/accumulators/numeric/functional_fwd.hpp:187:38: warning: unused variable 'min_assign' [-Wunused-variable] extern op::min_assign const &min_assign; Unfortunately, I don't know how to silent these warnings :( Have you an idea how to silent them? Best, Vicente

On 10/01/2011 08:51 PM, Vicente J. Botet Escriba wrote:
Le 01/10/11 20:03, Eric Niebler a écrit :
On 10/1/2011 9:29 AM, Vicente J. Botet Escriba wrote:
Would you accept a patch that resolve them by commenting the parameter name? Patches gladly accepted. Just open a ticket on svn.boost.org and attach the patch. Thanks!
Well, I have reached to remove the warnings in Boost.Parameter and Boost.Fusion.
The warnings in Boost.Accumulators are related to static variables included in a unnamed namespace such as
../../../boost/accumulators/numeric/functional_fwd.hpp:187:38: warning: unused variable 'min_assign' [-Wunused-variable] extern op::min_assign const &min_assign;
Unfortunately, I don't know how to silent these warnings :(
Have you an idea how to silent them?
Best, Vicente
I had the same problem with some other library. I used the following method to silence the warnings (replaced namespaces): namespace boost { template<class T> void touch(const T&) {} } #define BOOST_TOUCH_FUNC(WHAT) \ namespace\ {\ template<class T> void touch_WHAT()\ { boost::touch(WHAT); }\ } #define BOOST_TOUCH_VAL(WHAT) boost::touch(WHAT); If you find that useful, too, maybe it could be added to boost utility? There is similar stuff in some libraries, but none of it is documented, I think. Regards, Roland

Roland Bock-2 wrote:
On 10/01/2011 08:51 PM, Vicente J. Botet Escriba wrote:
Le 01/10/11 20:03, Eric Niebler a écrit :
On 10/1/2011 9:29 AM, Vicente J. Botet Escriba wrote:
Would you accept a patch that resolve them by commenting the parameter name? Patches gladly accepted. Just open a ticket on svn.boost.org and attach the patch. Thanks!
Well, I have reached to remove the warnings in Boost.Parameter and Boost.Fusion.
The warnings in Boost.Accumulators are related to static variables included in a unnamed namespace such as
../../../boost/accumulators/numeric/functional_fwd.hpp:187:38: warning: unused variable 'min_assign' [-Wunused-variable] extern op::min_assign const &min_assign;
Unfortunately, I don't know how to silent these warnings :(
Have you an idea how to silent them?
Best, Vicente
I had the same problem with some other library. I used the following method to silence the warnings (replaced namespaces):
namespace boost { template<class T> void touch(const T&) {} }
#define BOOST_TOUCH_FUNC(WHAT) \ namespace\ {\ template<class T> void touch_WHAT()\ { boost::touch(WHAT); }\ }
#define BOOST_TOUCH_VAL(WHAT) boost::touch(WHAT);
If you find that useful, too, maybe it could be added to boost utility? There is similar stuff in some libraries, but none of it is documented, I think.
I'm not sure I understand. You mean that one way to silence extern variable variables is to use them, isn't it? Are you suggesting that I add this kind of code to my programs or that the library author could add it on the files including extern declarations? Can someone explain me why the compiler is warning on this case? Best, Vicente -- View this message in context: http://boost.2283326.n4.nabble.com/accumulator-A-lot-of-unused-parameter-war... Sent from the Boost - Dev mailing list archive at Nabble.com.

On 10/02/2011 03:59 PM, Vicente Botet wrote:
Roland Bock-2 wrote:
On 10/01/2011 08:51 PM, Vicente J. Botet Escriba wrote:
Le 01/10/11 20:03, Eric Niebler a écrit :
On 10/1/2011 9:29 AM, Vicente J. Botet Escriba wrote:
Would you accept a patch that resolve them by commenting the parameter name? Patches gladly accepted. Just open a ticket on svn.boost.org and attach the patch. Thanks!
Well, I have reached to remove the warnings in Boost.Parameter and Boost.Fusion.
The warnings in Boost.Accumulators are related to static variables included in a unnamed namespace such as
../../../boost/accumulators/numeric/functional_fwd.hpp:187:38: warning: unused variable 'min_assign' [-Wunused-variable] extern op::min_assign const &min_assign;
Unfortunately, I don't know how to silent these warnings :(
Have you an idea how to silent them?
Best, Vicente
I had the same problem with some other library. I used the following method to silence the warnings (replaced namespaces):
namespace boost { template<class T> void touch(const T&) {} }
#define BOOST_TOUCH_FUNC(WHAT) \ namespace\ {\ template<class T> void touch_WHAT()\ { boost::touch(WHAT); }\ }
#define BOOST_TOUCH_VAL(WHAT) boost::touch(WHAT);
If you find that useful, too, maybe it could be added to boost utility? There is similar stuff in some libraries, but none of it is documented, I think.
I'm not sure I understand. You mean that one way to silence extern variable variables is to use them, isn't it? Are you suggesting that I add this kind of code to my programs or that the library author could add it on the files including extern declarations? Can someone explain me why the compiler is warning on this case?
Best, Vicente Right. This kind of "usage" will be optimized away, though.
Whether you or the library author have to do it, I don't know. Would be nicer, if the author could do it, I guess. To my understanding, the compiler just notifies you that you might have forgotten to remove some obsolete code. With gcc, you can also disable the warning via a pragma, btw. Regards, Roland
participants (4)
-
Eric Niebler
-
Roland Bock
-
Vicente Botet
-
Vicente J. Botet Escriba