From f6230947f1032891f3013c093567d76db2ae2d7c Mon Sep 17 00:00:00 2001 From: Marshall Clow Date: Tue, 11 Dec 2012 14:54:55 +0000 Subject: [PATCH] Merge deprecated macro change for Boost.ScopeExit to release; no functionality change [SVN r81852] --- doc/scope_exit.qbk | 6 +++--- example/nova.hpp | 4 ++-- example/scope_guard.cpp | 2 +- example/try_catch.cpp | 2 +- example/world_cxx11_lambda.cpp | 2 +- include/boost/scope_exit.hpp | 24 ++++++++++++------------ test/native.cpp | 2 +- test/native_this.cpp | 2 +- test/native_this_tpl.cpp | 2 +- test/nova.hpp | 4 ++-- test/same_line.cpp | 4 ++-- test/same_line_seq.cpp | 2 +- test/world.cpp | 2 +- test/world_checkpoint.cpp | 2 +- test/world_checkpoint_all.cpp | 4 ++-- test/world_checkpoint_all_seq.cpp | 2 +- test/world_this.cpp | 2 +- test/world_tpl.cpp | 2 +- 18 files changed, 35 insertions(+), 35 deletions(-) diff --git a/doc/scope_exit.qbk b/doc/scope_exit.qbk index e242cdf..4ae8a91 100644 --- a/doc/scope_exit.qbk +++ b/doc/scope_exit.qbk @@ -213,8 +213,8 @@ For example, this can be useful when the __Boost_ScopeExit__ body only needs to On C++11 compliers, it is also possible to capture all the variables in scope without naming them one-by-one using the special macro [macroref BOOST_SCOPE_EXIT_ALL] instead of [macroref BOOST_SCOPE_EXIT]. [footnote *Rationale.* -The [macroref BOOST_SCOPE_EXIT_ALL] macro is only defined on C++11 compilers for which the __Boost_Config__ macro `BOOST_NO_LAMBDAS` is not defined. -Using [macroref BOOST_SCOPE_EXIT_ALL] on C++03 compilers for which `BOOST_NO_LAMBDAS` is defined will generate (possibly cryptic) compiler errors. +The [macroref BOOST_SCOPE_EXIT_ALL] macro is only defined on C++11 compilers for which the __Boost_Config__ macro `BOOST_NO_CXX11_LAMBDAS` is not defined. +Using [macroref BOOST_SCOPE_EXIT_ALL] on C++03 compilers for which `BOOST_NO_CXX11_LAMBDAS` is defined will generate (possibly cryptic) compiler errors. Note that a new macro [macroref BOOST_SCOPE_EXIT_ALL] needed to be introduced instead of reusing [macroref BOOST_SCOPE_EXIT] because `BOOST_SCOPE_EXIT(&)` and `BOOST_SCOPE_EXIT(=)` cannot be distinguished from `BOOST_SCOPE_EXIT(void)` or `BOOST_SCOPE_EXIT(this_)` using the C++ preprocessor given that the symbols `&` and `=` are neither prefxied nor postfixed by alphanumeric tokens (this is not an issue for [macroref BOOST_SCOPE_EXIT_ALL] which always has the non-alphanumeric `&` or `=` as the first capture so the first capture tokens are simply never compared with neither `void` nor `this_` for this macro). ] @@ -430,7 +430,7 @@ This section presents an alternative syntax for compilers without variadic macro Most modern compilers support variadic macros (notably, these include GCC, MSVC, and all C++11 compilers). [footnote -A C++ compiler does not support variadic macros if the __Boost_Config__ macro `BOOST_NO_VARIADIC_MACROS` is defined for that compiler. +A C++ compiler does not support variadic macros if the __Boost_Config__ macro `BOOST_NO_CXX11_VARIADIC_MACROS` is defined for that compiler. ] However, in the rare case that programmers need to use this library on a complier without variaidc macros, this library also allows to specify the capture list using a __Boost_Preprocessor__ sequence where tokens are separated by round parenthesis `()`: diff --git a/example/nova.hpp b/example/nova.hpp index 58984ac..ceef87e 100644 --- a/example/nova.hpp +++ b/example/nova.hpp @@ -13,8 +13,8 @@ // WARNING: This file must be included first in each compilation unit. // Force no variadic macros but avoiding macro redefinition warning/error. -#ifndef BOOST_NO_VARIADIC_MACROS -# define BOOST_NO_VARIADIC_MACROS +#ifndef BOOST_NO_CXX11_VARIADIC_MACROS +# define BOOST_NO_CXX11_VARIADIC_MACROS #endif #endif // #include guard diff --git a/example/scope_guard.cpp b/example/scope_guard.cpp index ad090ac..1371c5e 100644 --- a/example/scope_guard.cpp +++ b/example/scope_guard.cpp @@ -7,7 +7,7 @@ // Home at http://www.boost.org/libs/scope_exit #include -#ifdef BOOST_NO_VARIADIC_MACROS +#ifdef BOOST_NO_CXX11_VARIADIC_MACROS # error "variadic macros required" #else diff --git a/example/try_catch.cpp b/example/try_catch.cpp index 327a1c6..4d00232 100644 --- a/example/try_catch.cpp +++ b/example/try_catch.cpp @@ -7,7 +7,7 @@ // Home at http://www.boost.org/libs/scope_exit #include -#ifdef BOOST_NO_VARIADIC_MACROS +#ifdef BOOST_NO_CXX11_VARIADIC_MACROS # error "variadic macros required" #else diff --git a/example/world_cxx11_lambda.cpp b/example/world_cxx11_lambda.cpp index c3f659a..c8e23d5 100644 --- a/example/world_cxx11_lambda.cpp +++ b/example/world_cxx11_lambda.cpp @@ -7,7 +7,7 @@ // Home at http://www.boost.org/libs/scope_exit #include -#ifdef BOOST_NO_LAMBDAS +#ifdef BOOST_NO_CXX11_LAMBDAS # error "lambda functions required" #else diff --git a/include/boost/scope_exit.hpp b/include/boost/scope_exit.hpp index de502f4..961b29c 100644 --- a/include/boost/scope_exit.hpp +++ b/include/boost/scope_exit.hpp @@ -596,7 +596,7 @@ msvc_register_type typeof_register_type(const T&, #define BOOST_SCOPE_EXIT_AUX_TRAITS_HAS_THIS(traits) \ BOOST_PP_TUPLE_ELEM(2, 1, traits) -#ifndef BOOST_NO_LAMBDAS +#ifndef BOOST_NO_CXX11_LAMBDAS namespace boost { namespace scope_exit { namespace aux { @@ -677,7 +677,7 @@ private: #endif // Lambdas. #if defined(BOOST_SCOPE_EXIT_CONFIG_USE_LAMBDAS) && \ - !defined(BOOST_NO_LAMBDAS) // Use lambda for SCOPE_EXIT (not just _ALL). + !defined(BOOST_NO_CXX11_LAMBDAS) // Use lambda for SCOPE_EXIT (not just _ALL). #define BOOST_SCOPE_EXIT_AUX_IMPL(id, ty, traits) \ BOOST_SCOPE_EXIT_AUX_IMPL_LAMBDA(id, ty, traits) @@ -758,7 +758,7 @@ private: // PUBLIC // -#if defined(BOOST_NO_VARIADIC_MACROS) // No variadic macros (sequences only). +#if defined(BOOST_NO_CXX11_VARIADIC_MACROS) // No variadic macros (sequences only). # define BOOST_SCOPE_EXIT_ID(id, void_or_seq) \ BOOST_SCOPE_EXIT_AUX_IMPL(id, BOOST_PP_EMPTY(), \ BOOST_SCOPE_EXIT_AUX_TRAITS( \ @@ -773,7 +773,7 @@ private: # define BOOST_SCOPE_EXIT_TPL(void_or_seq) \ BOOST_SCOPE_EXIT_ID_TPL(BOOST_LOCAL_FUNCTION_DETAIL_PP_LINE_COUNTER, \ void_or_seq) -# if !defined(BOOST_NO_LAMBDAS) +# if !defined(BOOST_NO_CXX11_LAMBDAS) # define BOOST_SCOPE_EXIT_ALL_ID(id, seq) \ BOOST_SCOPE_EXIT_AUX_IMPL_LAMBDA(id, \ /* C++11 allows to use typename outside templates so */ \ @@ -802,7 +802,7 @@ private: # define BOOST_SCOPE_EXIT_TPL(...) \ BOOST_SCOPE_EXIT_ID_TPL(BOOST_LOCAL_FUNCTION_DETAIL_PP_LINE_COUNTER, \ __VA_ARGS__) -# if !defined(BOOST_NO_LAMBDAS) +# if !defined(BOOST_NO_CXX11_LAMBDAS) # define BOOST_SCOPE_EXIT_ALL_ID(id, ...) \ BOOST_SCOPE_EXIT_AUX_IMPL_LAMBDA(id, \ /* C++11 allows to use typename outside templates so */ \ @@ -820,7 +820,7 @@ private: #endif // Variadics. #if defined(BOOST_SCOPE_EXIT_CONFIG_USE_LAMBDAS) && \ - !defined(BOOST_NO_LAMBDAS) // Use lambdas for SCOPE_EXIT (not just ALL). + !defined(BOOST_NO_CXX11_LAMBDAS) // Use lambdas for SCOPE_EXIT (not just ALL). # define BOOST_SCOPE_EXIT_END_ID(id) \ ; /* lambdas ended with just `;` */ #else // Not using lambdas. @@ -864,7 +864,7 @@ Note how the end of the scope exit body must be marked by @Params @Param{capture_list, On compilers that support variadic macros (see also Boost.Config -BOOST_NO_VARIADIC_MACROS)\, the capture list syntax is defined by the +BOOST_NO_CXX11_VARIADIC_MACROS)\, the capture list syntax is defined by the following grammar: @code capture_list: @@ -883,7 +883,7 @@ be used: void | capture_sequence @endcode Furthermore\, if @RefMacro{BOOST_SCOPE_EXIT_CONFIG_USE_LAMBDAS} is defined on -C++11 compilers that support lambda functions (i.e.\, Boost.Config's BOOST_NO_LAMBDAS is not defined) then a semicolon ; can be used instead of +C++11 compilers that support lambda functions (i.e.\, Boost.Config's BOOST_NO_CXX11_LAMBDAS is not defined) then a semicolon ; can be used instead of @RefMacro{BOOST_SCOPE_EXIT_END} and this can be used instead of this_: @code @@ -1107,14 +1107,14 @@ Note how the end of the scope exit body declared by this macro must be marked by a semi-column ; (and not by @RefMacro{BOOST_SCOPE_EXIT_END}). @Warning This macro is only available on C++11 compilers (specifically, on -C++11 compilers that do not define the Boost.Config BOOST_NO_LAMBDAS +C++11 compilers that do not define the Boost.Config BOOST_NO_CXX11_LAMBDAS macro). It is not defined on non-C++11 compilers so its use on non-C++11 compilers will generate a compiler error. @Params @Param{capture_list, On compilers that support variadic macros (see also Boost.Config -BOOST_NO_VARIADIC_MACROS)\, the capture list syntax is defined by the +BOOST_NO_CXX11_VARIADIC_MACROS)\, the capture list syntax is defined by the following grammar: @code capture_list: @@ -1191,7 +1191,7 @@ provided for each expansion (see @RefMacro{BOOST_SCOPE_EXIT_ALL} for more information). As with @RefMacro{BOOST_SCOPE_EXIT_ALL}, this macro is only available on C++11 compilers (specifically, on C++11 compilers that do not define the -Boost.Config BOOST_NO_LAMBDAS macro). +Boost.Config BOOST_NO_CXX11_LAMBDAS macro). @Params @Param{id, @@ -1282,7 +1282,7 @@ portably use __LINE__ to internally generate unique identifiers). @brief Force to use C++11 lambda functions to implement scope exits. If programmers define this configuration macro on a C++11 compiler for which -the Boost.Config macro BOOST_NO_LAMBDAS is not defined, the +the Boost.Config macro BOOST_NO_CXX11_LAMBDAS is not defined, the @RefMacro{BOOST_SCOPE_EXIT} and @RefMacro{BOOST_SCOPE_EXIT_TPL} macros will use C++11 lambda functions to declare scope exits. By default this macro is not defined. diff --git a/test/native.cpp b/test/native.cpp index 133060e..682e112 100644 --- a/test/native.cpp +++ b/test/native.cpp @@ -150,7 +150,7 @@ void test_types(void) { } void test_capture_all(void) { -#ifndef BOOST_NO_LAMBDAS +#ifndef BOOST_NO_CXX11_LAMBDAS int i = 0, j = 1; { diff --git a/test/native_this.cpp b/test/native_this.cpp index ace3d76..e625478 100644 --- a/test/native_this.cpp +++ b/test/native_this.cpp @@ -23,7 +23,7 @@ struct this_tester { BOOST_TEST(this_->value_ == 0); } BOOST_SCOPE_EXIT_END -#ifndef BOOST_NO_LAMBDAS +#ifndef BOOST_NO_CXX11_LAMBDAS BOOST_SCOPE_EXIT_ALL(&, this) { BOOST_TEST(this->value_ == 0); }; diff --git a/test/native_this_tpl.cpp b/test/native_this_tpl.cpp index 91c9b5f..bf5e787 100644 --- a/test/native_this_tpl.cpp +++ b/test/native_this_tpl.cpp @@ -25,7 +25,7 @@ struct this_tester { BOOST_TEST(this_->value_ == 0); } BOOST_SCOPE_EXIT_END -#ifndef BOOST_NO_LAMBDAS +#ifndef BOOST_NO_CXX11_LAMBDAS BOOST_SCOPE_EXIT_ALL(&, this) { BOOST_TEST(this->value_ == 0); }; diff --git a/test/nova.hpp b/test/nova.hpp index 58984ac..ceef87e 100644 --- a/test/nova.hpp +++ b/test/nova.hpp @@ -13,8 +13,8 @@ // WARNING: This file must be included first in each compilation unit. // Force no variadic macros but avoiding macro redefinition warning/error. -#ifndef BOOST_NO_VARIADIC_MACROS -# define BOOST_NO_VARIADIC_MACROS +#ifndef BOOST_NO_CXX11_VARIADIC_MACROS +# define BOOST_NO_CXX11_VARIADIC_MACROS #endif #endif // #include guard diff --git a/test/same_line.cpp b/test/same_line.cpp index c252779..6a7ff1f 100644 --- a/test/same_line.cpp +++ b/test/same_line.cpp @@ -7,7 +7,7 @@ // Home at http://www.boost.org/libs/scope_exit #include -#ifdef BOOST_NO_VARIADIC_MACROS +#ifdef BOOST_NO_CXX11_VARIADIC_MACROS # error "variadic macros required" #else @@ -64,7 +64,7 @@ int main(void) { f(x, delta); -#ifndef BOOST_NO_LAMBDAS +#ifndef BOOST_NO_CXX11_LAMBDAS { SCOPE_EXIT_ALL_INC_DEC(x, delta) // Multiple scope exits on same line. } diff --git a/test/same_line_seq.cpp b/test/same_line_seq.cpp index b20a315..aa177f7 100644 --- a/test/same_line_seq.cpp +++ b/test/same_line_seq.cpp @@ -59,7 +59,7 @@ int main(void) { f(x, delta); -#ifndef BOOST_NO_LAMBDAS +#ifndef BOOST_NO_CXX11_LAMBDAS { SCOPE_EXIT_ALL_INC_DEC(x, delta) } diff --git a/test/world.cpp b/test/world.cpp index 7214756..2d6b1ca 100644 --- a/test/world.cpp +++ b/test/world.cpp @@ -7,7 +7,7 @@ // Home at http://www.boost.org/libs/scope_exit #include -#ifdef BOOST_NO_VARIADIC_MACROS +#ifdef BOOST_NO_CXX11_VARIADIC_MACROS # error "variadic macros required" #else diff --git a/test/world_checkpoint.cpp b/test/world_checkpoint.cpp index ce8bd5d..dd101e9 100644 --- a/test/world_checkpoint.cpp +++ b/test/world_checkpoint.cpp @@ -7,7 +7,7 @@ // Home at http://www.boost.org/libs/scope_exit #include -#ifdef BOOST_NO_VARIADIC_MACROS +#ifdef BOOST_NO_CXX11_VARIADIC_MACROS # error "variadic macros required" #else diff --git a/test/world_checkpoint_all.cpp b/test/world_checkpoint_all.cpp index 051b34c..c5e5472 100644 --- a/test/world_checkpoint_all.cpp +++ b/test/world_checkpoint_all.cpp @@ -7,9 +7,9 @@ // Home at http://www.boost.org/libs/scope_exit #include -#if defined(BOOST_NO_LAMBDAS) +#if defined(BOOST_NO_CXX11_LAMBDAS) # error "lambda functions required" -#elif defined(BOOST_NO_VARIADIC_MACROS) +#elif defined(BOOST_NO_CXX11_VARIADIC_MACROS) # error "variadic macros required" #else diff --git a/test/world_checkpoint_all_seq.cpp b/test/world_checkpoint_all_seq.cpp index eac1204..cd5ee57 100644 --- a/test/world_checkpoint_all_seq.cpp +++ b/test/world_checkpoint_all_seq.cpp @@ -7,7 +7,7 @@ // Home at http://www.boost.org/libs/scope_exit #include -#ifdef BOOST_NO_LAMBDAS +#ifdef BOOST_NO_CXX11_LAMBDAS # error "lambda functions required" #else diff --git a/test/world_this.cpp b/test/world_this.cpp index 3838d96..ddb88ac 100644 --- a/test/world_this.cpp +++ b/test/world_this.cpp @@ -7,7 +7,7 @@ // Home at http://www.boost.org/libs/scope_exit #include -#ifdef BOOST_NO_VARIADIC_MACROS +#ifdef BOOST_NO_CXX11_VARIADIC_MACROS # error "variadic macros required" #else diff --git a/test/world_tpl.cpp b/test/world_tpl.cpp index 47d0571..fe2a117 100644 --- a/test/world_tpl.cpp +++ b/test/world_tpl.cpp @@ -7,7 +7,7 @@ // Home at http://www.boost.org/libs/scope_exit #include -#ifdef BOOST_NO_VARIADIC_MACROS +#ifdef BOOST_NO_CXX11_VARIADIC_MACROS # error "variadic macro required" #else