Boost logo

Boost-Commit :

From: matt_calabrese_at_[hidden]
Date: 2007-06-28 20:03:42


Author: matt_calabrese
Date: 2007-06-28 20:03:41 EDT (Thu, 28 Jun 2007)
New Revision: 7300
URL: http://svn.boost.org/trac/boost/changeset/7300

Log:
Improved error reporting when testing interlocked operations which aren't implemented for a given system (check via preprocessor, if not available, don't compile the rest of the file, just report error).

Added:
   sandbox/SOC/2006/concurrency/trunk/libs/act/doc/html/images/Thumbs.db (contents, props changed)
Text files modified:
   sandbox/SOC/2006/concurrency/trunk/boost/act/config/interlocked/has.hpp | 59 +++++++++++++++++++++++++++++++++++++++
   sandbox/SOC/2006/concurrency/trunk/libs/act/test/interlocked/add_assign/add_assign_helper.hpp | 29 +++++++++++++++++++
   sandbox/SOC/2006/concurrency/trunk/libs/act/test/interlocked/assign/assign.cpp | 13 ++++++++
   sandbox/SOC/2006/concurrency/trunk/libs/act/test/interlocked/assign/assign_release.cpp | 14 ++++++++-
   sandbox/SOC/2006/concurrency/trunk/libs/act/test/interlocked/assign/assign_unordered.cpp | 13 ++++++++
   sandbox/SOC/2006/concurrency/trunk/libs/act/test/interlocked/assign_if_was/assign_if_was.cpp | 2 +
   sandbox/SOC/2006/concurrency/trunk/libs/act/test/interlocked/assign_if_was/assign_if_was_acquire.cpp | 2 +
   sandbox/SOC/2006/concurrency/trunk/libs/act/test/interlocked/assign_if_was/assign_if_was_release.cpp | 2 +
   sandbox/SOC/2006/concurrency/trunk/libs/act/test/interlocked/load/load.cpp | 14 ++++++++
   sandbox/SOC/2006/concurrency/trunk/libs/act/test/interlocked/load/load_acquire.cpp | 13 ++++++++
   sandbox/SOC/2006/concurrency/trunk/libs/act/test/interlocked/load/load_unordered.cpp | 13 ++++++++
   sandbox/SOC/2006/concurrency/trunk/libs/act/test/interlocked/subtract_assign/subtract_assign_helper.hpp | 33 ++++++++++++++++++++++
   12 files changed, 199 insertions(+), 8 deletions(-)

Modified: sandbox/SOC/2006/concurrency/trunk/boost/act/config/interlocked/has.hpp
==============================================================================
--- sandbox/SOC/2006/concurrency/trunk/boost/act/config/interlocked/has.hpp (original)
+++ sandbox/SOC/2006/concurrency/trunk/boost/act/config/interlocked/has.hpp 2007-06-28 20:03:41 EDT (Thu, 28 Jun 2007)
@@ -15,6 +15,43 @@
 #include <boost/preprocessor/comparison/equal.hpp>
 #include <boost/preprocessor/control/if.hpp>
 
+#define BOOST_ACT_CONFIG_DETAIL_IS_DEFAULT_SEMANTICSacquire() 0
+#define BOOST_ACT_CONFIG_DETAIL_IS_DEFAULT_SEMANTICSrelease() 0
+#define BOOST_ACT_CONFIG_DETAIL_IS_DEFAULT_SEMANTICSacq_rel() 0
+#define BOOST_ACT_CONFIG_DETAIL_IS_DEFAULT_SEMANTICSunordered() 0
+#define BOOST_ACT_CONFIG_DETAIL_IS_DEFAULT_SEMANTICSdefault() 1
+#define BOOST_ACT_CONFIG_DETAIL_IS_DEFAULT_SEMANTICSdefault_() 1
+#define BOOST_ACT_CONFIG_DETAIL_IS_DEFAULT_SEMANTICS_() 1
+
+#define BOOST_ACT_CONFIG_DETAIL_DEFAULT_OF_add_assign() acq_rel
+#define BOOST_ACT_CONFIG_DETAIL_DEFAULT_OF_assign() acq_rel
+#define BOOST_ACT_CONFIG_DETAIL_DEFAULT_OF_assign_if_was() acq_rel
+#define BOOST_ACT_CONFIG_DETAIL_DEFAULT_OF_bitand_assign() acq_rel
+#define BOOST_ACT_CONFIG_DETAIL_DEFAULT_OF_bitor_assign() acq_rel
+#define BOOST_ACT_CONFIG_DETAIL_DEFAULT_OF_compiler_fence() acq_rel /*Change*/
+#define BOOST_ACT_CONFIG_DETAIL_DEFAULT_OF_compl_assign() acq_rel
+#define BOOST_ACT_CONFIG_DETAIL_DEFAULT_OF_decrement() acq_rel
+#define BOOST_ACT_CONFIG_DETAIL_DEFAULT_OF_divide_assign() acq_rel
+#define BOOST_ACT_CONFIG_DETAIL_DEFAULT_OF_fence() acq_rel /*Change*/
+#define BOOST_ACT_CONFIG_DETAIL_DEFAULT_OF_increment() acq_rel
+#define BOOST_ACT_CONFIG_DETAIL_DEFAULT_OF_lshift_assign() acq_rel
+#define BOOST_ACT_CONFIG_DETAIL_DEFAULT_OF_mod_assign() acq_rel
+#define BOOST_ACT_CONFIG_DETAIL_DEFAULT_OF_modify() acq_rel
+#define BOOST_ACT_CONFIG_DETAIL_DEFAULT_OF_multiply_assign() acq_rel
+#define BOOST_ACT_CONFIG_DETAIL_DEFAULT_OF_negate_assign() acq_rel
+#define BOOST_ACT_CONFIG_DETAIL_DEFAULT_OF_not_assign() acq_rel
+#define BOOST_ACT_CONFIG_DETAIL_DEFAULT_OF_load() acquire
+#define BOOST_ACT_CONFIG_DETAIL_DEFAULT_OF_rshift_assign() acq_rel
+#define BOOST_ACT_CONFIG_DETAIL_DEFAULT_OF_store() release
+#define BOOST_ACT_CONFIG_DETAIL_DEFAULT_OF_subtract_assign() acq_rel
+#define BOOST_ACT_CONFIG_DETAIL_DEFAULT_OF_xor_assign() acq_rel
+
+#define BOOST_ACT_CONFIG_DETAIL_DEFAULT_OF( name ) \
+BOOST_PP_CAT( BOOST_ACT_CONFIG_DETAIL_DEFAULT_OF_, name )()
+
+#define BOOST_ACT_CONFIG_DETAIL_IS_DEFAULT_SEMANTICS( semantics ) \
+BOOST_PP_CAT( BOOST_ACT_CONFIG_DETAIL_IS_DEFAULT_SEMANTICS, semantics )()
+
 #define BOOST_ACT_CONFIG_DETAIL_HAS_ASSIGN_IF_WAS_acq_rel() \
 BOOST_ACT_INTERLOCKED_DETAIL_HAS_CUSTOM_IMPL( assign_if_was, acq_rel )
 
@@ -191,7 +228,7 @@
 #define BOOST_ACT_CONFIG_DETAIL_HAS_LOAD( name, semantics ) \
 BOOST_PP_CAT( BOOST_ACT_CONFIG_DETAIL_HAS_LOAD_, semantics )()
 
-#define BOOST_ACT_CONFIG_INTERLOCKED_HAS( name, semantics ) \
+#define BOOST_ACT_CONFIG_INTERLOCKED_HAS_IMPL( name, semantics ) \
 BOOST_PP_IF \
 ( BOOST_ACT_INTERLOCKED_DETAIL_IS_NAME( name, load ) \
 , BOOST_ACT_CONFIG_DETAIL_HAS_LOAD \
@@ -199,4 +236,24 @@
 ) \
 ( name, semantics )
 
+#define BOOST_ACT_CONFIG_INTERLOCKED_HAS_INTERNAL( name, semantics ) \
+BOOST_PP_IF \
+( BOOST_ACT_INTERLOCKED_DETAIL_IS_NAME( name, load ) \
+, BOOST_ACT_CONFIG_DETAIL_HAS_LOAD \
+, BOOST_ACT_CONFIG_DETAIL_HAS_NONLOAD \
+) \
+( name, semantics )
+
+#define BOOST_ACT_CONFIG_INTERLOCKED_HAS_DEFAULT_INTERNAL( name, semantics ) \
+BOOST_ACT_CONFIG_INTERLOCKED_HAS_INTERNAL \
+( name, BOOST_ACT_CONFIG_DETAIL_DEFAULT_OF( name ) )
+
+#define BOOST_ACT_CONFIG_INTERLOCKED_HAS( name, semantics ) \
+BOOST_PP_IF \
+( BOOST_ACT_CONFIG_DETAIL_IS_DEFAULT_SEMANTICS( semantics ) \
+, BOOST_ACT_CONFIG_INTERLOCKED_HAS_DEFAULT_INTERNAL \
+, BOOST_ACT_CONFIG_INTERLOCKED_HAS_INTERNAL \
+) \
+( name, semantics )
+
 #endif

Added: sandbox/SOC/2006/concurrency/trunk/libs/act/doc/html/images/Thumbs.db
==============================================================================
Binary file. No diff available.

Modified: sandbox/SOC/2006/concurrency/trunk/libs/act/test/interlocked/add_assign/add_assign_helper.hpp
==============================================================================
--- sandbox/SOC/2006/concurrency/trunk/libs/act/test/interlocked/add_assign/add_assign_helper.hpp (original)
+++ sandbox/SOC/2006/concurrency/trunk/libs/act/test/interlocked/add_assign/add_assign_helper.hpp 2007-06-28 20:03:41 EDT (Thu, 28 Jun 2007)
@@ -10,6 +10,18 @@
 #define BOOST_ACT_TEST_INTERLOCKED_ADD_ASSIGN_ADD_ASSIGN_HELPER
 
 #include <boost/test/minimal.hpp>
+
+#include <boost/act/config/interlocked/has.hpp>
+
+#define BOOST_ACT_TEST_DETAIL_HAS_OPERATION() \
+BOOST_ACT_CONFIG_INTERLOCKED_HAS( add_assign \
+ , BOOST_ACT_TEST_INTERLOCKED_SEMANTICS \
+ )
+
+#include <boost/preprocessor/cat.hpp>
+
+#if BOOST_ACT_TEST_DETAIL_HAS_OPERATION()
+
 #include "../integral_additive_helper.hpp"
 #include "../operation_result_checker.hpp"
 #include <boost/act/interlocked/add_assign.hpp>
@@ -30,8 +42,16 @@
   }
 };
 
+#else
+
+#include <boost/preprocessor/stringize.hpp>
+
+#endif
+
 int test_main( int, char *[] )
 {
+#if BOOST_ACT_TEST_DETAIL_HAS_OPERATION()
+
   brute_operation_result_checker( basic_add()
                                 , BOOST_PP_CAT( interlocked_add_assign_
                                               , BOOST_ACT_TEST_INTERLOCKED_SEMANTICS
@@ -45,6 +65,15 @@
                                           )
                                           ()
                             );
+#else
+ BOOST_FAIL( BOOST_PP_STRINGIZE
+ ( BOOST_PP_CAT( add_assign_
+ , BOOST_ACT_TEST_INTERLOCKED_SEMANTICS
+ )
+ )
+ " not implemented on this system."
+ );
+#endif
 
   return 0;
 }

Modified: sandbox/SOC/2006/concurrency/trunk/libs/act/test/interlocked/assign/assign.cpp
==============================================================================
--- sandbox/SOC/2006/concurrency/trunk/libs/act/test/interlocked/assign/assign.cpp (original)
+++ sandbox/SOC/2006/concurrency/trunk/libs/act/test/interlocked/assign/assign.cpp 2007-06-28 20:03:41 EDT (Thu, 28 Jun 2007)
@@ -6,6 +6,12 @@
     http://www.boost.org/LICENSE_1_0.txt)
 ==============================================================================*/
 
+#include <boost/test/minimal.hpp>
+
+#include <boost/act/config/interlocked/has.hpp>
+
+#if BOOST_ACT_CONFIG_INTERLOCKED_HAS( assign, _ )
+
 #include "../store_load_helper.hpp"
 #include <boost/thread/barrier.hpp>
 #include <boost/act/interlocked/assign/assign.hpp>
@@ -22,8 +28,11 @@
   }
 };
 
+#endif
+
 int test_main( int, char *[] )
 {
+#if BOOST_ACT_CONFIG_INTERLOCKED_HAS( assign, _ )
   test_store_load_no_threads( single_thread_basic_get()
                             , interlocked_assign_set()
                             );
@@ -42,6 +51,8 @@
   }
 
   brute_assign_test( interlocked_assign_set() );
-
+#else
+ BOOST_FAIL( "assign< default_ > not implemented on this system." );
+#endif
   return 0;
 }

Modified: sandbox/SOC/2006/concurrency/trunk/libs/act/test/interlocked/assign/assign_release.cpp
==============================================================================
--- sandbox/SOC/2006/concurrency/trunk/libs/act/test/interlocked/assign/assign_release.cpp (original)
+++ sandbox/SOC/2006/concurrency/trunk/libs/act/test/interlocked/assign/assign_release.cpp 2007-06-28 20:03:41 EDT (Thu, 28 Jun 2007)
@@ -6,6 +6,12 @@
     http://www.boost.org/LICENSE_1_0.txt)
 ==============================================================================*/
 
+#include <boost/test/minimal.hpp>
+
+#include <boost/act/config/interlocked/has.hpp>
+
+#if BOOST_ACT_CONFIG_INTERLOCKED_HAS( assign, release )
+
 #include "../store_load_helper.hpp"
 #include <boost/thread/barrier.hpp>
 #include <boost/type_traits/remove_cv.hpp>
@@ -24,9 +30,11 @@
   }
 };
 
+#endif
+
 int test_main( int, char *[] )
 {
-
+#if BOOST_ACT_CONFIG_INTERLOCKED_HAS( assign, release )
   test_store_load_no_threads( single_thread_basic_get()
                             , interlocked_assign_release_set()
                             );
@@ -45,6 +53,8 @@
   }
 
   brute_assign_test( interlocked_assign_release_set() );
-
+#else
+ BOOST_FAIL( "assign< release > not implemented on this system." );
+#endif
   return 0;
 }

Modified: sandbox/SOC/2006/concurrency/trunk/libs/act/test/interlocked/assign/assign_unordered.cpp
==============================================================================
--- sandbox/SOC/2006/concurrency/trunk/libs/act/test/interlocked/assign/assign_unordered.cpp (original)
+++ sandbox/SOC/2006/concurrency/trunk/libs/act/test/interlocked/assign/assign_unordered.cpp 2007-06-28 20:03:41 EDT (Thu, 28 Jun 2007)
@@ -6,6 +6,12 @@
     http://www.boost.org/LICENSE_1_0.txt)
 ==============================================================================*/
 
+#include <boost/test/minimal.hpp>
+
+#include <boost/act/config/interlocked/has.hpp>
+
+#if BOOST_ACT_CONFIG_INTERLOCKED_HAS( assign, unordered )
+
 #include "../store_load_helper.hpp"
 #include <boost/thread/barrier.hpp>
 #include <boost/type_traits/remove_cv.hpp>
@@ -24,8 +30,11 @@
   }
 };
 
+#endif
+
 int test_main( int, char *[] )
 {
+#if BOOST_ACT_CONFIG_INTERLOCKED_HAS( assign, unordered )
   test_store_load_no_threads( single_thread_basic_get()
                             , interlocked_assign_unordered_set()
                             );
@@ -44,6 +53,8 @@
   }
 
   brute_assign_test( interlocked_assign_unordered_set() );
-
+#else
+ BOOST_FAIL( "assign< unordered > not implemented on this system." );
+#endif
   return 0;
 }

Modified: sandbox/SOC/2006/concurrency/trunk/libs/act/test/interlocked/assign_if_was/assign_if_was.cpp
==============================================================================
--- sandbox/SOC/2006/concurrency/trunk/libs/act/test/interlocked/assign_if_was/assign_if_was.cpp (original)
+++ sandbox/SOC/2006/concurrency/trunk/libs/act/test/interlocked/assign_if_was/assign_if_was.cpp 2007-06-28 20:03:41 EDT (Thu, 28 Jun 2007)
@@ -10,6 +10,8 @@
 // forcing compound CAS operations to use their default implementation
 // (which is to internally use assign_if_was).
 
+#include <boost/test/minimal.hpp>
+
 #define BOOST_ACT_INTERLOCKED_FORCE_DEFAULTS
 
 #include "../add_assign/add_assign.cpp"

Modified: sandbox/SOC/2006/concurrency/trunk/libs/act/test/interlocked/assign_if_was/assign_if_was_acquire.cpp
==============================================================================
--- sandbox/SOC/2006/concurrency/trunk/libs/act/test/interlocked/assign_if_was/assign_if_was_acquire.cpp (original)
+++ sandbox/SOC/2006/concurrency/trunk/libs/act/test/interlocked/assign_if_was/assign_if_was_acquire.cpp 2007-06-28 20:03:41 EDT (Thu, 28 Jun 2007)
@@ -10,6 +10,8 @@
 // forcing compound CAS operations to use their default implementation
 // (which is to internally use assign_if_was).
 
+#include <boost/test/minimal.hpp>
+
 #define BOOST_ACT_INTERLOCKED_FORCE_DEFAULTS
 
 #include "../add_assign/add_assign_acquire.cpp"

Modified: sandbox/SOC/2006/concurrency/trunk/libs/act/test/interlocked/assign_if_was/assign_if_was_release.cpp
==============================================================================
--- sandbox/SOC/2006/concurrency/trunk/libs/act/test/interlocked/assign_if_was/assign_if_was_release.cpp (original)
+++ sandbox/SOC/2006/concurrency/trunk/libs/act/test/interlocked/assign_if_was/assign_if_was_release.cpp 2007-06-28 20:03:41 EDT (Thu, 28 Jun 2007)
@@ -10,6 +10,8 @@
 // forcing compound CAS operations to use their default implementation
 // (which is to internally use assign_if_was).
 
+#include <boost/test/minimal.hpp>
+
 #define BOOST_ACT_INTERLOCKED_FORCE_DEFAULTS
 
 #include "../add_assign/add_assign_release.cpp"

Modified: sandbox/SOC/2006/concurrency/trunk/libs/act/test/interlocked/load/load.cpp
==============================================================================
--- sandbox/SOC/2006/concurrency/trunk/libs/act/test/interlocked/load/load.cpp (original)
+++ sandbox/SOC/2006/concurrency/trunk/libs/act/test/interlocked/load/load.cpp 2007-06-28 20:03:41 EDT (Thu, 28 Jun 2007)
@@ -6,11 +6,21 @@
     http://www.boost.org/LICENSE_1_0.txt)
 ==============================================================================*/
 
+#include <boost/test/minimal.hpp>
+
+#include <boost/act/config/interlocked/has.hpp>
+
+#if BOOST_ACT_CONFIG_INTERLOCKED_HAS( load, _ )
+
 #include "../store_load_helper.hpp"
 #include <boost/thread/barrier.hpp>
 
+#endif
+
 int test_main( int, char *[] )
 {
+#if BOOST_ACT_CONFIG_INTERLOCKED_HAS( load, _ )
+
   test_store_load_no_threads( interlocked_load_get()
                                  , single_thread_basic_set()
                                  );
@@ -27,6 +37,8 @@
                                 , interlocked_store_set()
                                 );
   }
-
+#else
+ BOOST_FAIL( "load< default_ > not implemented on this system." );
+#endif
   return 0;
 }

Modified: sandbox/SOC/2006/concurrency/trunk/libs/act/test/interlocked/load/load_acquire.cpp
==============================================================================
--- sandbox/SOC/2006/concurrency/trunk/libs/act/test/interlocked/load/load_acquire.cpp (original)
+++ sandbox/SOC/2006/concurrency/trunk/libs/act/test/interlocked/load/load_acquire.cpp 2007-06-28 20:03:41 EDT (Thu, 28 Jun 2007)
@@ -6,11 +6,20 @@
     http://www.boost.org/LICENSE_1_0.txt)
 ==============================================================================*/
 
+#include <boost/test/minimal.hpp>
+
+#include <boost/act/config/interlocked/has.hpp>
+
+#if BOOST_ACT_CONFIG_INTERLOCKED_HAS( load, acquire )
+
 #include "../store_load_helper.hpp"
 #include <boost/thread/barrier.hpp>
 
+#endif
+
 int test_main( int, char *[] )
 {
+#if BOOST_ACT_CONFIG_INTERLOCKED_HAS( load, _ )
   test_store_load_no_threads( interlocked_load_get()
                             , single_thread_basic_set()
                             );
@@ -27,6 +36,8 @@
                                 , interlocked_store_set()
                                 );
   }
-
+#else
+ BOOST_FAIL( "load< acquire > not implemented on this system." );
+#endif
   return 0;
 }

Modified: sandbox/SOC/2006/concurrency/trunk/libs/act/test/interlocked/load/load_unordered.cpp
==============================================================================
--- sandbox/SOC/2006/concurrency/trunk/libs/act/test/interlocked/load/load_unordered.cpp (original)
+++ sandbox/SOC/2006/concurrency/trunk/libs/act/test/interlocked/load/load_unordered.cpp 2007-06-28 20:03:41 EDT (Thu, 28 Jun 2007)
@@ -6,11 +6,20 @@
     http://www.boost.org/LICENSE_1_0.txt)
 ==============================================================================*/
 
+#include <boost/test/minimal.hpp>
+
+#include <boost/act/config/interlocked/has.hpp>
+
+#if BOOST_ACT_CONFIG_INTERLOCKED_HAS( load, unordered )
+
 #include "../store_load_helper.hpp"
 #include <boost/thread/barrier.hpp>
 
+#endif
+
 int test_main( int, char *[] )
 {
+#if BOOST_ACT_CONFIG_INTERLOCKED_HAS( load, _ )
   test_store_load_no_threads( interlocked_load_get()
                                  , single_thread_basic_set()
                                  );
@@ -27,6 +36,8 @@
                                 , interlocked_store_set()
                                 );
   }
-
+#else
+ BOOST_FAIL( "load< unordered > not implemented on this system." );
+#endif
   return 0;
 }

Modified: sandbox/SOC/2006/concurrency/trunk/libs/act/test/interlocked/subtract_assign/subtract_assign_helper.hpp
==============================================================================
--- sandbox/SOC/2006/concurrency/trunk/libs/act/test/interlocked/subtract_assign/subtract_assign_helper.hpp (original)
+++ sandbox/SOC/2006/concurrency/trunk/libs/act/test/interlocked/subtract_assign/subtract_assign_helper.hpp 2007-06-28 20:03:41 EDT (Thu, 28 Jun 2007)
@@ -9,6 +9,19 @@
 #ifndef BOOST_ACT_TEST_INTERLOCKED_SUBTRACT_ASSIGN_SUBTRACT_ASSIGN_HELPER
 #define BOOST_ACT_TEST_INTERLOCKED_SUBTRACT_ASSIGN_SUBTRACT_ASSIGN_HELPER
 
+#include <boost/test/minimal.hpp>
+
+#include <boost/act/config/interlocked/has.hpp>
+
+#define BOOST_ACT_TEST_DETAIL_HAS_OPERATION() \
+BOOST_ACT_CONFIG_INTERLOCKED_HAS( subtract_assign \
+ , BOOST_ACT_TEST_INTERLOCKED_SEMANTICS \
+ )
+
+#include <boost/preprocessor/cat.hpp>
+
+#if BOOST_ACT_TEST_DETAIL_HAS_OPERATION()
+
 #include "../integral_additive_helper.hpp"
 #include "../operation_result_checker.hpp"
 #include <boost/act/interlocked/subtract_assign.hpp>
@@ -29,8 +42,16 @@
   }
 };
 
+#else
+
+#include <boost/preprocessor/stringize.hpp>
+
+#endif
+
 int test_main( int, char *[] )
 {
+#if BOOST_ACT_TEST_DETAIL_HAS_OPERATION()
+
   brute_operation_result_checker( basic_subtract()
                                 , BOOST_PP_CAT
                                   ( interlocked_subtract_assign_
@@ -46,6 +67,18 @@
                                           ()
                             );
 
+#else
+
+ BOOST_FAIL( BOOST_PP_STRINGIZE
+ ( BOOST_PP_CAT( subtract_assign_
+ , BOOST_ACT_TEST_INTERLOCKED_SEMANTICS
+ )
+ )
+ " not implemented on this system."
+ );
+
+#endif
+
   return 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