Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r78214 - in trunk/boost: . local_function/aux_/macro/code_
From: lorcaminiti_at_[hidden]
Date: 2012-04-26 21:46:23


Author: lcaminiti
Date: 2012-04-26 21:46:22 EDT (Thu, 26 Apr 2012)
New Revision: 78214
URL: http://svn.boost.org/trac/boost/changeset/78214

Log:
Hopefully worked around an Intel compiler bug (internal error) when deducing local function result type (used same Intel workaround that ScopeExit uses to deduced capture types).
Text files modified:
   trunk/boost/local_function/aux_/macro/code_/result.hpp | 57 ++++++++++++++++-----------------------
   trunk/boost/scope_exit.hpp | 5 ++
   2 files changed, 27 insertions(+), 35 deletions(-)

Modified: trunk/boost/local_function/aux_/macro/code_/result.hpp
==============================================================================
--- trunk/boost/local_function/aux_/macro/code_/result.hpp (original)
+++ trunk/boost/local_function/aux_/macro/code_/result.hpp 2012-04-26 21:46:22 EDT (Thu, 26 Apr 2012)
@@ -21,62 +21,50 @@
 
 // PRIVATE //
 
-#define BOOST_LOCAL_FUNCTION_AUX_CODE_RESULT_TAG_(id) \
- BOOST_LOCAL_FUNCTION_AUX_SYMBOL( (deduce_result_tag)(id) )
-
 #define BOOST_LOCAL_FUNCTION_AUX_CODE_RESULT_FUNC_(id) \
     /* symbol (not internal) also gives error if missing result type */ \
     BOOST_PP_CAT( \
   ERROR_missing_result_type_before_the_local_function_parameter_macro_id, \
             id)
 
-#define BOOST_LOCAL_FUNCTION_AUX_CODE_RESULT_WRAP_(id) \
- BOOST_LOCAL_FUNCTION_AUX_SYMBOL( (deduce_result_wrap)(id) )
-
-#define BOOST_LOCAL_FUNCTION_AUX_CODE_RESULT_CAPTURE_(id) \
- BOOST_LOCAL_FUNCTION_AUX_SYMBOL( (deduce_result_capture)(id) )
-
 #define BOOST_LOCAL_FUNCTION_AUX_CODE_RESULT_PARAMS_(id) \
     BOOST_LOCAL_FUNCTION_AUX_SYMBOL( (deduce_result_params)(id) )
 
 #define BOOST_LOCAL_FUNCTION_AUX_CODE_RESULT_TYPE_(id) \
     BOOST_LOCAL_FUNCTION_AUX_SYMBOL( (result_type)(id) )
 
+#define BOOST_LOCAL_FUNCTION_AUX_CODE_RESULT_INDEX_ \
+ /* this does not have to be an integral index because ScopeExit uses */ \
+ /* just as a symbol to concatenate go generate unique symbols (but */ \
+ /* if it'd ever needed to became integral, the number of function */ \
+ /* params + 1 as in the macro CONFIG_ARITY_MAX could be used) */ \
+ result
+
 // User did not explicitly specified result type, deduce it (using Typeof).
 #define BOOST_LOCAL_FUNCTION_AUX_CODE_RESULT_DEDUCE_( \
         id, typename01, decl_traits) \
+ /* user specified result type here */ \
     BOOST_LOCAL_FUNCTION_AUX_CODE_RESULT_DECL(id) \
- /* the many tagging, wrapping, etc that follow are taken from ScopeExit */ \
- /* type deduction mechanism and they are necessary within templates */ \
- /* (at least on GCC) to work around an compiler internal error */ \
- typedef \
- void (*BOOST_LOCAL_FUNCTION_AUX_CODE_RESULT_TAG_(id))( \
- int BOOST_LOCAL_FUNCTION_AUX_CODE_RESULT_FUNC_(id) \
- ) \
- ; \
- typedef \
- BOOST_PP_IIF(typename01, BOOST_TYPEOF_TPL, BOOST_TYPEOF)( \
- ::boost::scope_exit::detail::wrap( \
- ::boost::scope_exit::detail::deref( \
- BOOST_LOCAL_FUNCTION_AUX_CODE_RESULT_FUNC_(id), \
- (BOOST_LOCAL_FUNCTION_AUX_CODE_RESULT_TAG_(id))0 \
- ) \
- ) \
- ) \
- BOOST_LOCAL_FUNCTION_AUX_CODE_RESULT_WRAP_(id) \
- ; \
- typedef BOOST_PP_EXPR_IIF(typename01, typename) \
- BOOST_LOCAL_FUNCTION_AUX_CODE_RESULT_WRAP_(id)::type \
- BOOST_LOCAL_FUNCTION_AUX_CODE_RESULT_CAPTURE_(id) \
- ; \
+ /* tagging, wrapping, etc as from ScopeExit type deduction are */ \
+ /* necessary within templates (at least on GCC) to work around an */ \
+ /* compiler internal errors) */ \
+ BOOST_SCOPE_EXIT_DETAIL_TAG_DECL(0, /* no recursive step r */ \
+ id, BOOST_LOCAL_FUNCTION_AUX_CODE_RESULT_INDEX_, \
+ BOOST_LOCAL_FUNCTION_AUX_CODE_RESULT_FUNC_(id)) \
+ BOOST_SCOPE_EXIT_DETAIL_CAPTURE_DECL(0, /* no recursive step r */ \
+ ( id, BOOST_PP_EXPR_IIF(typename01, typename) ), \
+ BOOST_LOCAL_FUNCTION_AUX_CODE_RESULT_INDEX_, \
+ BOOST_LOCAL_FUNCTION_AUX_CODE_RESULT_FUNC_(id)) \
+ /* extra struct to workaround GCC and other compiler's issues */ \
     struct BOOST_LOCAL_FUNCTION_AUX_CODE_RESULT_PARAMS_(id) { \
- /* internal to struct to workaround GCC and other compiler's issues */ \
         typedef \
             BOOST_PP_EXPR_IIF(typename01, typename) \
             ::boost::function_traits< \
                 BOOST_PP_EXPR_IIF(typename01, typename) \
                 ::boost::remove_pointer< \
- BOOST_LOCAL_FUNCTION_AUX_CODE_RESULT_CAPTURE_(id) \
+ BOOST_SCOPE_EXIT_DETAIL_CAPTURE_T(id, \
+ BOOST_LOCAL_FUNCTION_AUX_CODE_RESULT_INDEX_, \
+ BOOST_LOCAL_FUNCTION_AUX_CODE_RESULT_FUNC_(id)) \
>::type \
>::result_type \
             BOOST_LOCAL_FUNCTION_AUX_CODE_RESULT_TYPE_(id) \
@@ -87,6 +75,7 @@
 // Precondition: RETURNS(decl_traits) != NIL
 #define BOOST_LOCAL_FUNCTION_AUX_CODE_RESULT_TYPED_( \
         id, typename01, decl_traits) \
+ /* user specified result type here */ \
     struct BOOST_LOCAL_FUNCTION_AUX_CODE_RESULT_PARAMS_(id) { \
         typedef \
             BOOST_PP_LIST_FIRST( \

Modified: trunk/boost/scope_exit.hpp
==============================================================================
--- trunk/boost/scope_exit.hpp (original)
+++ trunk/boost/scope_exit.hpp 2012-04-26 21:46:22 EDT (Thu, 26 Apr 2012)
@@ -508,11 +508,12 @@
 
 #define BOOST_SCOPE_EXIT_DETAIL_CAPTURE_DECL(r, id_ty, i, var) \
     struct BOOST_SCOPE_EXIT_AUX_WRAPPED(BOOST_PP_TUPLE_ELEM(2, 0, id_ty), i) \
+ /* no need to use TYPEOF_TPL here because it's within inheritance */ \
         : BOOST_TYPEOF(::boost::scope_exit::detail::wrap( \
                 BOOST_SCOPE_EXIT_AUX_DEREF(BOOST_PP_TUPLE_ELEM(2, 0, id_ty), \
                         i, var))) \
     {}; \
- typedef BOOST_PP_TUPLE_ELEM(2, 1,id_ty) \
+ typedef BOOST_PP_TUPLE_ELEM(2, 1, id_ty) \
         BOOST_SCOPE_EXIT_AUX_WRAPPED(BOOST_PP_TUPLE_ELEM(2, 0, id_ty), i)::type\
         BOOST_SCOPE_EXIT_DETAIL_CAPTURE_T(BOOST_PP_TUPLE_ELEM(2, 0, id_ty), \
                 i, var) \
@@ -522,6 +523,7 @@
 
 #define BOOST_SCOPE_EXIT_DETAIL_CAPTURE_DECL(r, id_ty, i, var) \
     typedef \
+ /* no TYPEOF_TPL here because uses TYPEOF_KEYWORD directly */ \
         BOOST_TYPEOF_KEYWORD(BOOST_SCOPE_EXIT_AUX_DEREF( \
                 BOOST_PP_TUPLE_ELEM(2, 0, id_ty), i, var)) \
         BOOST_SCOPE_EXIT_DETAIL_CAPTURE_T(BOOST_PP_TUPLE_ELEM(2, 0, id_ty), \
@@ -532,6 +534,7 @@
 
 #define BOOST_SCOPE_EXIT_DETAIL_CAPTURE_DECL(r, id_ty, i, var) \
     typedef \
+ /* no need to use TYPEOF_TPL here because it's a typedef */ \
         BOOST_TYPEOF(::boost::scope_exit::detail::wrap( \
                 BOOST_SCOPE_EXIT_AUX_DEREF(BOOST_PP_TUPLE_ELEM(2, 0, id_ty), \
                         i, var))) \


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