diff --git a/include/fc/exception/exception.hpp b/include/fc/exception/exception.hpp index 894f575..4b1a12a 100644 --- a/include/fc/exception/exception.hpp +++ b/include/fc/exception/exception.hpp @@ -297,10 +297,12 @@ namespace fc do { throw EXCEPTION_TYPE( FC_LOG_MESSAGE( error, "", FC_FORMAT_ARG_PARAMS(__VA_ARGS__) ) ); } while(false); //#define FC_THROW( FORMAT, ... ) - +// FC_INDIRECT_EXPAND workas around a bug in Visual C++ variadic macro processing that prevents it +// from separating __VA_ARGS__ into separate tokens +#define FC_INDIRECT_EXPAND(MACRO, ARGS) MACRO ARGS #define FC_THROW( ... ) \ do { \ - throw fc::exception( FC_LOG_MESSAGE( error, __VA_ARGS__ ) ); \ + throw fc::exception( FC_INDIRECT_EXPAND(FC_LOG_MESSAGE, ( error, __VA_ARGS__ )) ); \ } while(0) #define FC_EXCEPTION( EXCEPTION_TYPE, FORMAT, ... ) \ diff --git a/include/fc/log/logger.hpp b/include/fc/log/logger.hpp index 221e709..a885cfd 100644 --- a/include/fc/log/logger.hpp +++ b/include/fc/log/logger.hpp @@ -131,8 +131,10 @@ namespace fc #define FC_FORMAT( SEQ )\ BOOST_PP_SEQ_FOR_EACH( FC_FORMAT_ARG, v, SEQ ) -#define FC_FORMAT_ARG_PARAMS( SEQ )\ - BOOST_PP_SEQ_FOR_EACH( FC_FORMAT_ARGS, v, SEQ ) +// takes a ... instead of a SEQ arg because it can be called with an empty SEQ +// from FC_CAPTURE_AND_THROW() +#define FC_FORMAT_ARG_PARAMS( ... )\ + BOOST_PP_SEQ_FOR_EACH( FC_FORMAT_ARGS, v, __VA_ARGS__ ) #define idump( SEQ ) \ ilog( FC_FORMAT(SEQ), FC_FORMAT_ARG_PARAMS(SEQ) )