From eeb2c53b560f76a96e1e05b366c8c2828df29286 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaakko=20J=C3=A4rvi?= Date: Tue, 14 May 2002 16:59:33 +0000 Subject: [PATCH] added dummy uses of arguments to prevent unused argument errors [SVN r13860] --- .../boost/lambda/detail/lambda_functor_base.hpp | 8 ++++++-- include/boost/lambda/detail/lambda_functors.hpp | 7 ++++--- include/boost/lambda/detail/lambda_fwd.hpp | 16 ++++++++++++++++ include/boost/lambda/detail/select_functions.hpp | 4 ++-- 4 files changed, 28 insertions(+), 7 deletions(-) diff --git a/include/boost/lambda/detail/lambda_functor_base.hpp b/include/boost/lambda/detail/lambda_functor_base.hpp index 7f534a1..01ed220 100644 --- a/include/boost/lambda/detail/lambda_functor_base.hpp +++ b/include/boost/lambda/detail/lambda_functor_base.hpp @@ -44,7 +44,7 @@ public: struct sig { typedef element_t type; }; template - RET call(CALL_FORMAL_ARGS) const { return elem; } + RET call(CALL_FORMAL_ARGS) const { CALL_USE_ARGS; return elem; } }; template @@ -293,6 +293,7 @@ public: template RET call(CALL_FORMAL_ARGS) const { + CALL_USE_ARGS; return boost::tuples::get<0>(args); } @@ -311,7 +312,9 @@ class lambda_functor_base { public: explicit lambda_functor_base(const Args& a) {} - template RET call(CALL_FORMAL_ARGS) const {} + template RET call(CALL_FORMAL_ARGS) const { + CALL_USE_ARGS; + } template struct sig { typedef void type; }; }; @@ -345,6 +348,7 @@ public: template RET call(CALL_FORMAL_ARGS) const { + CALL_USE_ARGS; return Act::template apply(); } }; diff --git a/include/boost/lambda/detail/lambda_functors.hpp b/include/boost/lambda/detail/lambda_functors.hpp index b34ccb7..4f9e851 100644 --- a/include/boost/lambda/detail/lambda_functors.hpp +++ b/include/boost/lambda/detail/lambda_functors.hpp @@ -63,6 +63,7 @@ template<> struct placeholder { template RET call(CALL_FORMAL_ARGS) const { BOOST_STATIC_ASSERT(boost::is_reference::value); + CALL_USE_ARGS; // does nothing, prevents warnings for unused args return a; } }; @@ -74,7 +75,7 @@ template<> struct placeholder { }; template - RET call(CALL_FORMAL_ARGS) const { return b; } + RET call(CALL_FORMAL_ARGS) const { CALL_USE_ARGS; return b; } }; template<> struct placeholder { @@ -84,7 +85,7 @@ template<> struct placeholder { }; template - RET call(CALL_FORMAL_ARGS) const { return c; } + RET call(CALL_FORMAL_ARGS) const { CALL_USE_ARGS; return c; } }; template<> struct placeholder { @@ -94,7 +95,7 @@ template<> struct placeholder { }; template - RET call(CALL_FORMAL_ARGS) const { return env; } + RET call(CALL_FORMAL_ARGS) const { CALL_USE_ARGS; return env; } }; typedef const lambda_functor > placeholder1_type; diff --git a/include/boost/lambda/detail/lambda_fwd.hpp b/include/boost/lambda/detail/lambda_fwd.hpp index 0130a52..8f06a89 100644 --- a/include/boost/lambda/detail/lambda_fwd.hpp +++ b/include/boost/lambda/detail/lambda_fwd.hpp @@ -59,5 +59,21 @@ class lambda_functor_base; #define CALL_REFERENCE_TYPES A&, B&, C&, Env& #define CALL_PLAIN_TYPES A, B, C, Env +namespace boost { +namespace lambda { +namespace detail { + +template +void do_nothing(A1&, A2&, A3&, A4&) {} + +} // detail +} // lambda +} // boost + +// prevent the warnings from unused argumetns +#define CALL_USE_ARGS \ +::boost::lambda::detail::do_nothing(a, b, c, env) + + #endif diff --git a/include/boost/lambda/detail/select_functions.hpp b/include/boost/lambda/detail/select_functions.hpp index 0f7f33a..10e047d 100644 --- a/include/boost/lambda/detail/select_functions.hpp +++ b/include/boost/lambda/detail/select_functions.hpp @@ -24,7 +24,7 @@ namespace detail { // select functions ------------------------------- template -inline Any& select(Any& any, CALL_FORMAL_ARGS) { return any; } +inline Any& select(Any& any, CALL_FORMAL_ARGS) { CALL_USE_ARGS; return any; } template @@ -57,7 +57,7 @@ template struct r_select { // Any == RET template static - inline RET go (Any& any, CALL_FORMAL_ARGS) { return any; } + inline RET go (Any& any, CALL_FORMAL_ARGS) { CALL_USE_ARGS; return any; } template