|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r51448 - in trunk: boost/lambda boost/lambda/detail libs/lambda/test
From: steven_at_[hidden]
Date: 2009-02-25 21:33:17
Author: steven_watanabe
Date: 2009-02-25 21:33:15 EST (Wed, 25 Feb 2009)
New Revision: 51448
URL: http://svn.boost.org/trac/boost/changeset/51448
Log:
Supress warnings on gcc and msvc. Fixes #1515
Added:
trunk/boost/lambda/detail/suppress_unused.hpp (contents, props changed)
Text files modified:
trunk/boost/lambda/casts.hpp | 5 +++
trunk/boost/lambda/detail/lambda_functor_base.hpp | 10 +++++++
trunk/boost/lambda/detail/lambda_functors.hpp | 8 +++++
trunk/boost/lambda/detail/lambda_traits.hpp | 50 ++++++++++++++++++++++++++++++++++++++++
trunk/boost/lambda/detail/operator_return_type_traits.hpp | 17 ++++++++-----
trunk/boost/lambda/switch.hpp | 8 +++++
trunk/libs/lambda/test/constructor_tests.cpp | 8 ++++-
trunk/libs/lambda/test/exception_test.cpp | 4 +-
trunk/libs/lambda/test/extending_rt_traits.cpp | 18 +++++++++++---
trunk/libs/lambda/test/member_pointer_test.cpp | 4 +-
trunk/libs/lambda/test/operator_tests_simple.cpp | 4 +++
11 files changed, 115 insertions(+), 21 deletions(-)
Modified: trunk/boost/lambda/casts.hpp
==============================================================================
--- trunk/boost/lambda/casts.hpp (original)
+++ trunk/boost/lambda/casts.hpp 2009-02-25 21:33:15 EST (Wed, 25 Feb 2009)
@@ -14,6 +14,8 @@
#if !defined(BOOST_LAMBDA_CASTS_HPP)
#define BOOST_LAMBDA_CASTS_HPP
+#include "boost/lambda/detail/suppress_unused.hpp"
+
#include <typeinfo>
namespace boost {
@@ -64,11 +66,12 @@
}
};
- // typedid action
+// typeid action
class typeid_action {
public:
template<class RET, class Arg1>
static RET apply(Arg1 &a1) {
+ detail::suppress_unused_variable_warnings(a1);
return typeid(a1);
}
};
Modified: trunk/boost/lambda/detail/lambda_functor_base.hpp
==============================================================================
--- trunk/boost/lambda/detail/lambda_functor_base.hpp (original)
+++ trunk/boost/lambda/detail/lambda_functor_base.hpp 2009-02-25 21:33:15 EST (Wed, 25 Feb 2009)
@@ -16,6 +16,10 @@
namespace boost {
namespace lambda {
+#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
+#pragma warning(push)
+#pragma warning(disable:4512) //assignment operator could not be generated
+#endif
// for return type deductions we wrap bound argument to this class,
// which fulfils the base class contract for lambda_functors
@@ -42,6 +46,10 @@
RET call(CALL_FORMAL_ARGS) const { CALL_USE_ARGS; return elem; }
};
+#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
+#pragma warning(pop)
+#endif
+
template <class T>
inline lambda_functor<identity<T&> > var(T& t) { return identity<T&>(t); }
@@ -337,7 +345,7 @@
{
public:
// Args args; not needed
- explicit lambda_functor_base(const Args& a) {}
+ explicit lambda_functor_base(const Args& /*a*/) {}
template<class SigArgs> struct sig {
typedef typename return_type_N<Act, null_type>::type type;
Modified: trunk/boost/lambda/detail/lambda_functors.hpp
==============================================================================
--- trunk/boost/lambda/detail/lambda_functors.hpp (original)
+++ trunk/boost/lambda/detail/lambda_functors.hpp 2009-02-25 21:33:15 EST (Wed, 25 Feb 2009)
@@ -105,7 +105,10 @@
// other lambda_functors.
// -------------------------------------------------------------------
-
+#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
+#pragma warning(push)
+#pragma warning(disable:4512) //assignment operator could not be generated
+#endif
// -- lambda_functor NONE ------------------------------------------------
template <class T>
@@ -244,6 +247,9 @@
}
};
+#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
+#pragma warning(pop)
+#endif
} // namespace lambda
} // namespace boost
Modified: trunk/boost/lambda/detail/lambda_traits.hpp
==============================================================================
--- trunk/boost/lambda/detail/lambda_traits.hpp (original)
+++ trunk/boost/lambda/detail/lambda_traits.hpp 2009-02-25 21:33:15 EST (Wed, 25 Feb 2009)
@@ -430,6 +430,56 @@
typedef const volatile T (&type)[n];
};
+template<class R>
+struct bind_traits<R()> {
+ typedef R(&type)();
+};
+
+template<class R, class Arg1>
+struct bind_traits<R(Arg1)> {
+ typedef R(&type)(Arg1);
+};
+
+template<class R, class Arg1, class Arg2>
+struct bind_traits<R(Arg1, Arg2)> {
+ typedef R(&type)(Arg1, Arg2);
+};
+
+template<class R, class Arg1, class Arg2, class Arg3>
+struct bind_traits<R(Arg1, Arg2, Arg3)> {
+ typedef R(&type)(Arg1, Arg2, Arg3);
+};
+
+template<class R, class Arg1, class Arg2, class Arg3, class Arg4>
+struct bind_traits<R(Arg1, Arg2, Arg3, Arg4)> {
+ typedef R(&type)(Arg1, Arg2, Arg3, Arg4);
+};
+
+template<class R, class Arg1, class Arg2, class Arg3, class Arg4, class Arg5>
+struct bind_traits<R(Arg1, Arg2, Arg3, Arg4, Arg5)> {
+ typedef R(&type)(Arg1, Arg2, Arg3, Arg4, Arg5);
+};
+
+template<class R, class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, class Arg6>
+struct bind_traits<R(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6)> {
+ typedef R(&type)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6);
+};
+
+template<class R, class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, class Arg6, class Arg7>
+struct bind_traits<R(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7)> {
+ typedef R(&type)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7);
+};
+
+template<class R, class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, class Arg6, class Arg7, class Arg8>
+struct bind_traits<R(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8)> {
+ typedef R(&type)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8);
+};
+
+template<class R, class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, class Arg6, class Arg7, class Arg8, class Arg9>
+struct bind_traits<R(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8, Arg9)> {
+ typedef R(&type)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8, Arg9);
+};
+
template<class T>
struct bind_traits<reference_wrapper<T> >{
typedef T& type;
Modified: trunk/boost/lambda/detail/operator_return_type_traits.hpp
==============================================================================
--- trunk/boost/lambda/detail/operator_return_type_traits.hpp (original)
+++ trunk/boost/lambda/detail/operator_return_type_traits.hpp 2009-02-25 21:33:15 EST (Wed, 25 Feb 2009)
@@ -233,28 +233,31 @@
// the IF is because the A::reference in the primary template could
// be some class type rather than a real reference, hence
// we do not want to make it a reference here either
- typedef typename detail::IF<
+ typedef typename boost::remove_reference<type1>::type no_reference;
+ typedef typename detail::IF<
is_reference<type1>::value,
- const typename boost::remove_reference<type1>::type &,
- const type1
+ const no_reference &,
+ const no_reference
>::RET type;
};
template <class A> struct contentsof_type<volatile A> {
typedef typename contentsof_type<A>::type type1;
+ typedef typename boost::remove_reference<type1>::type no_reference;
typedef typename detail::IF<
is_reference<type1>::value,
- volatile typename boost::remove_reference<type1>::type &,
- volatile type1
+ volatile no_reference &,
+ volatile no_reference
>::RET type;
};
template <class A> struct contentsof_type<const volatile A> {
typedef typename contentsof_type<A>::type type1;
+ typedef typename boost::remove_reference<type1>::type no_reference;
typedef typename detail::IF<
is_reference<type1>::value,
- const volatile typename boost::remove_reference<type1>::type &,
- const volatile type1
+ const volatile no_reference &,
+ const volatile no_reference
>::RET type;
};
Added: trunk/boost/lambda/detail/suppress_unused.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/lambda/detail/suppress_unused.hpp 2009-02-25 21:33:15 EST (Wed, 25 Feb 2009)
@@ -0,0 +1,27 @@
+// Boost Lambda Library suppress_unused.hpp -----------------------------
+//
+// Copyright (C) 2009 Steven Watanabe
+//
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+//
+// For more information, see www.boost.org
+
+// ------------------------------------------------------------
+
+#ifndef BOOST_LAMBDA_SUPRESS_UNUSED_HPP
+#define BOOST_LAMBDA_SUPRESS_UNUSED_HPP
+
+namespace boost {
+namespace lambda {
+namespace detail {
+
+template<class T>
+inline void suppress_unused_variable_warnings(const T&) {}
+
+}
+}
+}
+
+#endif
Modified: trunk/boost/lambda/switch.hpp
==============================================================================
--- trunk/boost/lambda/switch.hpp (original)
+++ trunk/boost/lambda/switch.hpp 2009-02-25 21:33:15 EST (Wed, 25 Feb 2009)
@@ -465,12 +465,18 @@
#define BOOST_LAMBDA_SWITCH_STATEMENT_HELPER(z, N, A) \
BOOST_LAMBDA_SWITCH_STATEMENT(BOOST_PP_INC(N))
-
+#ifdef BOOST_MSVC
+#pragma warning(push)
+#pragma warning(disable:4065)
+#endif
// up to 9 cases supported (counting default:)
BOOST_PP_REPEAT_2ND(9,BOOST_LAMBDA_SWITCH_HELPER,FOO)
BOOST_PP_REPEAT_2ND(9,BOOST_LAMBDA_SWITCH_STATEMENT_HELPER,FOO)
+#ifdef BOOST_MSVC
+#pragma warning(pop)
+#endif
} // namespace lambda
} // namespace boost
Modified: trunk/libs/lambda/test/constructor_tests.cpp
==============================================================================
--- trunk/libs/lambda/test/constructor_tests.cpp (original)
+++ trunk/libs/lambda/test/constructor_tests.cpp 2009-02-25 21:33:15 EST (Wed, 25 Feb 2009)
@@ -24,6 +24,10 @@
#include <algorithm>
#include <vector>
+#ifdef BOOST_MSVC
+#pragma warning(disable:4512)
+#endif
+
using namespace boost::lambda;
using namespace std;
@@ -34,7 +38,7 @@
}
template <>
-bool check_tuple(int n, const null_type& ) { return true; }
+bool check_tuple(int /*n*/, const null_type& ) { return true; }
void constructor_all_lengths()
@@ -183,7 +187,7 @@
void test_destructor ()
{
char space[sizeof(is_destructor_called)];
- bool flag;
+ bool flag = false;
is_destructor_called* idc = new(space) is_destructor_called(flag);
BOOST_CHECK(flag == false);
Modified: trunk/libs/lambda/test/exception_test.cpp
==============================================================================
--- trunk/libs/lambda/test/exception_test.cpp (original)
+++ trunk/libs/lambda/test/exception_test.cpp 2009-02-25 21:33:15 EST (Wed, 25 Feb 2009)
@@ -29,7 +29,7 @@
using namespace std;
// to prevent unused variables warnings
-template <class T> void dummy(const T& t) {}
+template <class T> void dummy(const T&) {}
void erroneous_exception_related_lambda_expressions() {
@@ -603,7 +603,7 @@
return_type_matching();
test_empty_catch_blocks();
}
- catch (int x)
+ catch (int)
{
BOOST_CHECK(false);
}
Modified: trunk/libs/lambda/test/extending_rt_traits.cpp
==============================================================================
--- trunk/libs/lambda/test/extending_rt_traits.cpp (original)
+++ trunk/libs/lambda/test/extending_rt_traits.cpp 2009-02-25 21:33:15 EST (Wed, 25 Feb 2009)
@@ -16,6 +16,7 @@
#include "boost/lambda/bind.hpp"
#include "boost/lambda/lambda.hpp"
+#include "boost/lambda/detail/suppress_unused.hpp"
#include <iostream>
@@ -23,6 +24,8 @@
#include <algorithm>
+using boost::lambda::detail::suppress_unused_variable_warnings;
+
class A {};
class B {};
@@ -81,7 +84,7 @@
} // lambda
} // boost
-void ok(B b) {}
+void ok(B /*b*/) {}
void test_unary_operators()
{
@@ -127,7 +130,7 @@
template<class A, class B>
my_vector<typename return_type_2<arithmetic_action<plus_action>, A&, B&>::type>
-operator+(const my_vector<A>& a, const my_vector<B>& b)
+operator+(const my_vector<A>& /*a*/, const my_vector<B>& /*b*/)
{
typedef typename
return_type_2<arithmetic_action<plus_action>, A&, B&>::type res_type;
@@ -175,8 +178,8 @@
// assignment
class Assign {
public:
- void operator=(const Assign& a) {}
- X operator[](const int& i) { return X(); }
+ void operator=(const Assign& /*a*/) {}
+ X operator[](const int& /*i*/) { return X(); }
};
@@ -329,9 +332,16 @@
XX dummy3 = (_1 * _2)(vxx, vyy);
VV dummy4 = (_1 * _2)(cvxx, cvyy);
+ suppress_unused_variable_warnings(dummy1);
+ suppress_unused_variable_warnings(dummy2);
+ suppress_unused_variable_warnings(dummy3);
+ suppress_unused_variable_warnings(dummy4);
+
my_vector<int> v1; my_vector<double> v2;
my_vector<double> d = (_1 + _2)(v1, v2);
+ suppress_unused_variable_warnings(d);
+
// bitwise
(_1 << _2)(x, y);
Modified: trunk/libs/lambda/test/member_pointer_test.cpp
==============================================================================
--- trunk/libs/lambda/test/member_pointer_test.cpp (original)
+++ trunk/libs/lambda/test/member_pointer_test.cpp 2009-02-25 21:33:15 EST (Wed, 25 Feb 2009)
@@ -118,11 +118,11 @@
class D {};
// ->* can be overloaded to do anything
-bool operator->*(A a, B b) {
+bool operator->*(A /*a*/, B /*b*/) {
return false;
}
-bool operator->*(B b, A a) {
+bool operator->*(B /*b*/, A /*a*/) {
return true;
}
Modified: trunk/libs/lambda/test/operator_tests_simple.cpp
==============================================================================
--- trunk/libs/lambda/test/operator_tests_simple.cpp (original)
+++ trunk/libs/lambda/test/operator_tests_simple.cpp 2009-02-25 21:33:15 EST (Wed, 25 Feb 2009)
@@ -17,6 +17,8 @@
#include "boost/lambda/lambda.hpp"
+#include "boost/lambda/detail/suppress_unused.hpp"
+
#include <vector>
#include <map>
#include <set>
@@ -96,6 +98,8 @@
// test that unary plus really does something
unary_plus_tester u;
unary_plus_tester up = (+_1)(u);
+
+ boost::lambda::detail::suppress_unused_variable_warnings(up);
}
void bitwise_operators() {
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk