|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r62884 - in sandbox/SOC/2010/bit_masks: boost/integer/details/bft lib/integer/test lib/integer/test/bft_testing lib/integer/test/bft_testing/compile_fail lib/integer/test/bft_testing/compile_pass
From: bbartmanboost_at_[hidden]
Date: 2010-06-12 18:52:14
Author: bbartman
Date: 2010-06-12 18:52:13 EDT (Sat, 12 Jun 2010)
New Revision: 62884
URL: http://svn.boost.org/trac/boost/changeset/62884
Log:
working on implementing preconditions and making sure that those preconditions work and don't breat existing things
Text files modified:
sandbox/SOC/2010/bit_masks/boost/integer/details/bft/arg_parse_impl.hpp | 23 +++++++++++++++++++++--
sandbox/SOC/2010/bit_masks/lib/integer/test/Jamfile.v2 | 2 ++
sandbox/SOC/2010/bit_masks/lib/integer/test/bft_testing/compile_fail/one_name_two_members.cpp | 20 ++++++++++++++++++++
sandbox/SOC/2010/bit_masks/lib/integer/test/bft_testing/compile_pass/bft_member_max_out.cpp | 4 ++--
sandbox/SOC/2010/bit_masks/lib/integer/test/bft_testing/ref_type_testing.cpp | 1 +
5 files changed, 46 insertions(+), 4 deletions(-)
Modified: sandbox/SOC/2010/bit_masks/boost/integer/details/bft/arg_parse_impl.hpp
==============================================================================
--- sandbox/SOC/2010/bit_masks/boost/integer/details/bft/arg_parse_impl.hpp (original)
+++ sandbox/SOC/2010/bit_masks/boost/integer/details/bft/arg_parse_impl.hpp 2010-06-12 18:52:13 EDT (Sat, 12 Jun 2010)
@@ -11,6 +11,9 @@
#include <boost/mpl/push_back.hpp>
#include <boost/mpl/plus.hpp>
#include <boost/mpl/if.hpp>
+#include <boost/mpl/find_if.hpp>
+#include <boost/integer/details/bft/name_lookup.hpp>
+
namespace boost { namespace details {
@@ -72,6 +75,9 @@
FieldVector,
Offset >
{
+ // make sure that the storage type is not specifed twice
+ BOOST_STATIC_ASSERT(( is_same<StoragePolicy,mpl::void_>::value ));
+
typedef typename storage<
StorageType,
AllocationPolicy
@@ -99,8 +105,6 @@
* (This may result in additional overhead during compile time ).
* Currently not enforced, will take more time then I have at the moment.
*/
-
-// TODO: Implement Precondition 1 listed above!
template < typename StoragePolicy,
typename FieldVector,
std::size_t FieldWidth,
@@ -118,6 +122,21 @@
FieldVector,
Offset >
{
+
+ BOOST_STATIC_ASSERT((
+ is_same<
+ typename mpl::find_if<
+ FieldVector,
+ details::match_name<
+ typename mpl::_1,
+ NameType
+ >
+ >::type,
+ typename mpl::end<
+ FieldVector
+ >::type
+ >::value
+ ));
typedef member< ReturnType, NameType, FieldWidth > param;
// typedef
Modified: sandbox/SOC/2010/bit_masks/lib/integer/test/Jamfile.v2
==============================================================================
--- sandbox/SOC/2010/bit_masks/lib/integer/test/Jamfile.v2 (original)
+++ sandbox/SOC/2010/bit_masks/lib/integer/test/Jamfile.v2 2010-06-12 18:52:13 EDT (Sat, 12 Jun 2010)
@@ -30,6 +30,8 @@
[ compile-fail bft_testing/compile_fail/non_pod_storage_type.cpp ]
[ compile-fail bft_testing/compile_fail/bft_storage_width_acceded.cpp ]
[ compile-fail bft_testing/compile_fail/no_array_types.cpp ]
+ [ compile-fail bft_testing/compile_fail/set_storage_more_then_once.cpp ]
+ [ compile-fail bft_testing/compile_fail/one_name_two_members.cpp ]
[ compile bft_testing/compile_pass/bft_member_max_out.cpp ]
[ run bitfield_tuple_test.cpp ]
[ run bft_testing/ref_type_testing.cpp ]
Modified: sandbox/SOC/2010/bit_masks/lib/integer/test/bft_testing/compile_fail/one_name_two_members.cpp
==============================================================================
--- sandbox/SOC/2010/bit_masks/lib/integer/test/bft_testing/compile_fail/one_name_two_members.cpp (original)
+++ sandbox/SOC/2010/bit_masks/lib/integer/test/bft_testing/compile_fail/one_name_two_members.cpp 2010-06-12 18:52:13 EDT (Sat, 12 Jun 2010)
@@ -0,0 +1,20 @@
+// Copyright 2010 Brian Bartman.
+// 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)
+
+
+#include <boost/integer/bitfield_tuple.hpp>
+
+using namespace boost;
+struct red;
+
+
+// Fails because more then one member has the same name
+typedef bitfield_tuple<storage<int>, member<int,red,3>, member<int,red,3> > bft;
+
+
+int main() {
+ bft();
+ return 0;
+}
Modified: sandbox/SOC/2010/bit_masks/lib/integer/test/bft_testing/compile_pass/bft_member_max_out.cpp
==============================================================================
--- sandbox/SOC/2010/bit_masks/lib/integer/test/bft_testing/compile_pass/bft_member_max_out.cpp (original)
+++ sandbox/SOC/2010/bit_masks/lib/integer/test/bft_testing/compile_pass/bft_member_max_out.cpp 2010-06-12 18:52:13 EDT (Sat, 12 Jun 2010)
@@ -8,7 +8,7 @@
using namespace boost;
struct red { };
-
+struct pink;
// this needs to pass because its a basic declaration and I should asume people
// arn't going to be all that happy if things don't work the way the should
@@ -17,7 +17,7 @@
typedef bitfield_tuple<
storage<int>,
member<int, red, 15u>,
- member<int, red, 17u>
+ member<int, pink, 17u>
> bft;
Modified: sandbox/SOC/2010/bit_masks/lib/integer/test/bft_testing/ref_type_testing.cpp
==============================================================================
--- sandbox/SOC/2010/bit_masks/lib/integer/test/bft_testing/ref_type_testing.cpp (original)
+++ sandbox/SOC/2010/bit_masks/lib/integer/test/bft_testing/ref_type_testing.cpp 2010-06-12 18:52:13 EDT (Sat, 12 Jun 2010)
@@ -32,6 +32,7 @@
typedef details::bitfield_element_< char,
red, mpl::size_t<24>, mpl::size_t<8> > element_5;
+
int main() {
int data_storage(0);
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