|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r77406 - trunk/boost
From: lorcaminiti_at_[hidden]
Date: 2012-03-19 13:09:36
Author: lcaminiti
Date: 2012-03-19 13:09:34 EDT (Mon, 19 Mar 2012)
New Revision: 77406
URL: http://svn.boost.org/trac/boost/changeset/77406
Log:
Added _ID macro to LocalFunction and corrected code doc typo in ScopeExit.
Text files modified:
trunk/boost/local_function.hpp | 80 ++++++++++++++++++++++++++++------------
trunk/boost/scope_exit.hpp | 49 +++++++++++++++++-------
2 files changed, 91 insertions(+), 38 deletions(-)
Modified: trunk/boost/local_function.hpp
==============================================================================
--- trunk/boost/local_function.hpp (original)
+++ trunk/boost/local_function.hpp 2012-03-19 13:09:34 EDT (Mon, 19 Mar 2012)
@@ -21,35 +21,28 @@
// PUBLIC //
#ifdef BOOST_NO_VARIADIC_MACROS
+# define BOOST_LOCAL_FUNCTION_ID(id, within_template, declarations) \
+ BOOST_LOCAL_FUNCTION_AUX_DECL(id, within_template, \
+ BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS( \
+ BOOST_LOCAL_FUNCTION_DETAIL_PP_VOID_LIST( \
+ declarations)))
# define BOOST_LOCAL_FUNCTION(declarations) \
- BOOST_LOCAL_FUNCTION_AUX_DECL( \
- BOOST_LOCAL_FUNCTION_DETAIL_PP_LINE_COUNTER \
- , 0 /* not within template */ \
- , BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS( \
- BOOST_LOCAL_FUNCTION_DETAIL_PP_VOID_LIST(declarations)) \
- )
+ BOOST_LOCAL_FUNCTION_ID(BOOST_LOCAL_FUNCTION_DETAIL_PP_LINE_COUNTER, \
+ 0, declarations)
# define BOOST_LOCAL_FUNCTION_TPL(declarations) \
- BOOST_LOCAL_FUNCTION_AUX_DECL( \
- BOOST_LOCAL_FUNCTION_DETAIL_PP_LINE_COUNTER \
- , 1 /* within template */ \
- , BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS( \
- BOOST_LOCAL_FUNCTION_DETAIL_PP_VOID_LIST(declarations)) \
- )
+ BOOST_LOCAL_FUNCTION_ID(BOOST_LOCAL_FUNCTION_DETAIL_PP_LINE_COUNTER, \
+ 1, declarations)
#else // VARIADIC
+# define BOOST_LOCAL_FUNCTION_ID(id, within_template, ...) \
+ BOOST_LOCAL_FUNCTION_AUX_DECL(id, within_template, \
+ BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS( \
+ BOOST_LOCAL_FUNCTION_DETAIL_PP_VOID_LIST(__VA_ARGS__)))
# define BOOST_LOCAL_FUNCTION(...) \
- BOOST_LOCAL_FUNCTION_AUX_DECL( \
- BOOST_LOCAL_FUNCTION_DETAIL_PP_LINE_COUNTER \
- , 0 /* not within template */ \
- , BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS( \
- BOOST_LOCAL_FUNCTION_DETAIL_PP_VOID_LIST(__VA_ARGS__)) \
- )
+ BOOST_LOCAL_FUNCTION_ID( \
+ BOOST_LOCAL_FUNCTION_DETAIL_PP_LINE_COUNTER, 0, __VA_ARGS__)
# define BOOST_LOCAL_FUNCTION_TPL(...) \
- BOOST_LOCAL_FUNCTION_AUX_DECL( \
- BOOST_LOCAL_FUNCTION_DETAIL_PP_LINE_COUNTER \
- , 1 /* within template */ \
- , BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS( \
- BOOST_LOCAL_FUNCTION_DETAIL_PP_VOID_LIST(__VA_ARGS__)) \
- )
+ BOOST_LOCAL_FUNCTION_ID( \
+ BOOST_LOCAL_FUNCTION_DETAIL_PP_LINE_COUNTER, 1, __VA_ARGS__)
#endif // VARIADIC
#define BOOST_LOCAL_FUNCTION_NAME(qualified_function_name) \
@@ -196,6 +189,45 @@
#define BOOST_LOCAL_FUNCTION_TPL(declarations)
/**
+@brief This macro allows to expand multiple local function macros on the same
+line.
+
+This macro is equivalent to @RefMacro{BOOST_LOCAL_FUNCTION} but it can be
+expanded multiple times on the same line if different identifiers <c>id</c> are
+provided for each expansion (see @RefMacro{BOOST_LOCAL_FUNCTION} for more
+detail).
+
+@Params
+@Param{id,
+ A unique identifier token which can be catted by the preprocessor (for
+ example <c>__LINE__</c> or <c>local_function_number_1_on_line_123</c>).
+}
+@Param{within_template,
+ Specify <c>1</c> when this macro is used in a type-dependant context\,
+ <c>0</c> otherwise (this is equivalent to using
+ @RefMacro{BOOST_LOCAL_FUNCTION_TPL} on separate lines).
+}
+@Param{declarations,
+ Same as the <c>declarations</c> parameter of the
+ @RefMacro{BOOST_LOCAL_FUNCTION} macro.
+}
+@EndParams
+
+@Note This macro can be useful when the local function macros are expanded
+within user-defined macros (because macros all expand on the same line).
+On some compilers (e.g., MSVC which supports the non standard
+<c>__COUNTER__</c> macro) it might not be necessary to use this macro but
+the use of this macro when expanding multiple local function macros on the same
+line is always necessary to ensure portability (this is because this library
+can only portably use <c>__LINE__</c> to internally generate unique
+identifiers).
+
+@See @RefMacro{BOOST_SCOPE_EXIT_END_ID}, @RefMacro{BOOST_SCOPE_EXIT_ALL_ID},
+ @RefMacro{BOOST_SCOPE_EXIT}, @RefMacro{BOOST_SCOPE_EXIT_TPL}.
+*/
+#define BOOST_LOCAL_FUNCTION_ID(id, within_template, declarations)
+
+/**
@brief This macro is used to end a local function declaration specifying its
name.
Modified: trunk/boost/scope_exit.hpp
==============================================================================
--- trunk/boost/scope_exit.hpp (original)
+++ trunk/boost/scope_exit.hpp 2012-03-19 13:09:34 EDT (Mon, 19 Mar 2012)
@@ -794,7 +794,7 @@
#define BOOST_SCOPE_EXIT_TPL(capture_list)
/**
-_at_brief This macro allows to expand multiple scope-exits on the same line.
+@brief This macro allows to expand multiple scope exit macros on the same line.
This macro is equivalent to @RefMacro{BOOST_SCOPE_EXIT} but it can be expanded
multiple times on the same line if different identifiers <c>id</c> are provided
@@ -806,16 +806,23 @@
example <c>__LINE__</c> or <c>scope_exit_number_1_on_line_123</c>).
}
@Param{within_template,
- If this macro is used in a type-dependant context on GCC then <c>1</c>
- (equivalently to @RefMacro{BOOST_SCOPE_EXIT_TPL}), <c>0</c> otherwise.
+ Specify <c>1</c> when this macro is used in a type-dependant context
+ on GCC\, <c>1</c> otherwise (this is equivalent to using
+ @RefMacro{BOOST_SCOPE_EXIT_TPL} on separate lines).
}
@Param{capture_list,
Same as the <c>capture_list</c> parameter of the
- @RefMacro{BOOST_SCOPE_EXIT} macro: <c>void</c>\, or a comma separated
- list\, or a preprocessor sequence (if no variadic macros) of variables in
- scope to capture.
+ @RefMacro{BOOST_SCOPE_EXIT} macro.
}
-_at_endParams
+@EndParams
+
+@Note This macro can be useful when the scope exit macros are expanded
+within user-defined macros (because macros all expand on the same line).
+On some compilers (e.g., MSVC which supports the non standard
+<c>__COUNTER__</c> macro) it might not be necessary to use this macro but
+the use of this macro is always necessary to ensure portability when expanding
+multiple scope exit macros on the same line (because this library can only
+portably use <c>__LINE__</c> to internally generate unique identifiers).
@See @RefMacro{BOOST_SCOPE_EXIT_END_ID}, @RefMacro{BOOST_SCOPE_EXIT_ALL_ID},
@RefMacro{BOOST_SCOPE_EXIT}, @RefMacro{BOOST_SCOPE_EXIT_TPL}.
@@ -877,7 +884,7 @@
#define BOOST_SCOPE_EXIT_ALL(capture_list)
/**
-_at_brief This macro allows to expand multiple scope-exits on the same line.
+@brief This macro allows to expand multiple scope exit macros on the same line.
This macro is equivalent to @RefMacro{BOOST_SCOPE_EXIT_ALL} but it can be
expanded multiple times on the same line if different identifiers <c>id</c> are
@@ -891,11 +898,17 @@
}
@Param{capture_list,
Same as the <c>capture_list</c> parameter of the
- @RefMacro{BOOST_SCOPE_EXIT} macro: <c>void</c>\, or a comma separated
- list\, or a preprocessor sequence (if no variadic macros) of variables in
- scope to capture.
+ @RefMacro{BOOST_SCOPE_EXIT} macro.
}
-_at_endParams
+@EndParams
+
+@Note This macro can be useful when the scope exit macros are expanded
+within user-defined macros (because macros all expand on the same line).
+On some compilers (e.g., MSVC which supports the non standard
+<c>__COUNTER__</c> macro) it might not be necessary to use this macro but
+the use of this macro is always necessary to ensure portability when expanding
+multiple scope exit macros on the same line (because this library can only
+portably use <c>__LINE__</c> to internally generate unique identifiers).
@See @RefMacro{BOOST_SCOPE_EXIT_ID}, @RefMacro{BOOST_SCOPE_EXIT_ALL}.
*/
@@ -933,7 +946,7 @@
#define BOOST_SCOPE_EXIT_END
/**
-_at_brief This macro allows to expand multiple scope-exits on the same line.
+@brief This macro allows to expand multiple scope exit macros on the same line.
This macro is equivalent to @RefMacro{BOOST_SCOPE_EXIT_END} but it can be
expanded multiple times on the same line if different identifiers <c>id</c> are
@@ -945,7 +958,15 @@
A unique identifier token which can be catted by the preprocessor (for
example <c>__LINE__</c> or <c>scope_exit_number_1_on_line_123</c>).
}
-_at_endParams
+@EndParams
+
+@Note This macro can be useful when the scope exit macros are expanded
+within user-defined macros (because macros all expand on the same line).
+On some compilers (e.g., MSVC which supports the non standard
+<c>__COUNTER__</c> macro) it might not be necessary to use this macro but
+the use of this macro is always necessary to ensure portability when expanding
+multiple scope exit macros on the same line (because this library can only
+portably use <c>__LINE__</c> to internally generate unique identifiers).
@See @RefMacro{BOOST_SCOPE_EXIT_ID}, @RefMacro{BOOST_SCOPE_EXIT_END}.
*/
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