From 96d30479a9104052a8f633ca0b5ce1596118d98a Mon Sep 17 00:00:00 2001 From: Lorenzo Caminiti Date: Thu, 22 Mar 2012 20:54:20 +0000 Subject: [PATCH] Split Utility/IdentityType and Functional/OverloadedFunction tests into smaller tests. Updated docs for ScopeExit, LocalFunction, Utility/IdentityType, and Functional/OverloadedFunction. [SVN r77484] --- doc/advanced_topics.qbk | 1 + doc/examples.qbk | 4 +- doc/getting_started.qbk | 8 +- doc/html/BOOST_LOCAL_FUNCTION.html | 2 +- ...BOOST_LOCAL_FUNCTION_CONFIG_ARITY_MAX.html | 2 +- .../BOOST_LOCAL_FUNCTION_CONFIG_BIND_MAX.html | 2 +- doc/html/BOOST_LOCAL_FUNCTION_ID.html | 5 +- doc/html/BOOST_LOCAL_FUNCTION_NAME.html | 2 +- doc/html/BOOST_LOCAL_FUNCTION_TPL.html | 2 +- doc/html/BOOST_LOCAL_FUNCTION_TYPEOF.html | 2 +- .../boost_localfunction/Advanced_Topics.html | 8 +- .../boost_localfunction/Alternatives.html | 4 +- doc/html/boost_localfunction/Examples.html | 2 +- .../boost_localfunction/Getting_Started.html | 12 +- .../No_Variadic_Macros.html | 136 +++++++++++++++++- doc/html/index.html | 4 +- doc/local_function.qbk | 2 +- doc/no_variadic_macros.qbk | 31 +++- example/gcc_lambda_cxx11.cpp | 6 +- include/boost/local_function.hpp | 8 +- test/add_lambda.cpp | 2 +- 21 files changed, 201 insertions(+), 44 deletions(-) diff --git a/doc/advanced_topics.qbk b/doc/advanced_topics.qbk index 34b6744..5e078e2 100644 --- a/doc/advanced_topics.qbk +++ b/doc/advanced_topics.qbk @@ -368,6 +368,7 @@ In general, it is not possible to expand the [macroref BOOST_LOCAL_FUNCTION], [m The [macroref BOOST_LOCAL_FUNCTION] and [macroref BOOST_LOCAL_FUNCTION_TPL] macros internally use `__LINE__` to generate unique identifiers. Therefore, if the same macro is expanded more than on time on the same line, the generated identifiers will no longer be unique and the code will not compile. (This restriction does not apply to MSVC and other compilers that provide the non-standard `__COUNTER__` macro.) +Note that the [macroref BOOST_LOCAL_FUNCTION_NAME] macro can always be expanded multiple times on the same line because a unique local function name must be provided for each different expansion (so the is no need for a `BOOST_LOCAL_FUNCTION_NAME_ID` macro). ] Therefore, this library provides the additional macro [macroref BOOST_LOCAL_FUNCTION_ID] which can be expanded multiple times on the same line as long as programmers specify a unique identifier as the macro's first parameter. diff --git a/doc/examples.qbk b/doc/examples.qbk index 5df2ab8..4d212dc 100644 --- a/doc/examples.qbk +++ b/doc/examples.qbk @@ -17,11 +17,11 @@ Combing local functions with the [@http://gcc.gnu.org/onlinedocs/gcc/Statement-E This code only works on compilers that support the statement expression GCC extension or that support __CPP11_lambda__ functions. ] -For example (see also [@../../example/gcc_lambda.cpp =gcc_lambda.cpp=] and [@../../example/gcc_lambda_cpp11.cpp =gcc_lambda_cpp11.cpp=]): +For example (see also [@../../example/gcc_lambda.cpp =gcc_lambda.cpp=] and [@../../example/gcc_lambda_cxx11.cpp =gcc_lambda_cxx11.cpp=]): [table [ [With Local Functions (GCC only)] [C++11 Lambdas] ] - [ [[gcc_lambda]] [[gcc_lambda_cpp11]] ] + [ [[gcc_lambda]] [[gcc_lambda_cxx11]] ] ] Where the macros are defined in [@../../example/gcc_lambda.hpp =gcc_lambda.hpp=]. diff --git a/doc/getting_started.qbk b/doc/getting_started.qbk index 65a5269..f7f50e0 100644 --- a/doc/getting_started.qbk +++ b/doc/getting_started.qbk @@ -30,13 +30,13 @@ Using __Boost_Test__ allows to add the documentation examples to the library reg The implementation of this library uses preprocessor and template meta-programming (as supported by __Boost_Preprocessor__ and __Boost_MPL__), templates with partial specializations and function pointers (similarly to __Boost_Function__). As a consequence, this library is fairly demanding on compilers' compliance with the __CPP03__ standard. -At present, this library has been successfully compiled and tested on the following compilers and platforms: +The authors originally developed and tested the library on: -# GNU Compiler Collection (GCC) 4.5.1 on Ubuntu Linux 10. +# GNU Compiler Collection (GCC) C++ 4.5.1 on Ubuntu Linux 10. # GCC 4.3.4 and 4.5.3 (with and without __CPP11__ features enabled `-std=c++0x`) on Cygwin. -# Miscrosoft Visual Studio Compiler (MSVC) 8.0 on Windows XP and Windows 7. +# Miscrosoft Visual C++ (MSVC) 8.0 on Windows XP and Windows 7. -This library has not yet been tested on any other compiler and platform. +See the library [@http://www.boost.org/development/tests/release/developer/local_function.html regressions test results] for detailed information on supported compilers and platforms. [endsect] diff --git a/doc/html/BOOST_LOCAL_FUNCTION.html b/doc/html/BOOST_LOCAL_FUNCTION.html index f661d0c..a29effa 100644 --- a/doc/html/BOOST_LOCAL_FUNCTION.html +++ b/doc/html/BOOST_LOCAL_FUNCTION.html @@ -33,7 +33,7 @@ BOOST_LOCAL_FUNCTION(declarations)
-

Description

+

Description

This macro must be used within a declarative context, it must follow the local function result type, it must be followed by the local function body code, and then by the BOOST_LOCAL_FUNCTION_NAME macro (see the Tutorial and Advanced Topics sections):

{ // Some declarative context.
     ...
diff --git a/doc/html/BOOST_LOCAL_FUNCTION_CONFIG_ARITY_MAX.html b/doc/html/BOOST_LOCAL_FUNCTION_CONFIG_ARITY_MAX.html
index 55f06a6..9fffe6d 100644
--- a/doc/html/BOOST_LOCAL_FUNCTION_CONFIG_ARITY_MAX.html
+++ b/doc/html/BOOST_LOCAL_FUNCTION_CONFIG_ARITY_MAX.html
@@ -33,7 +33,7 @@
 
 BOOST_LOCAL_FUNCTION_CONFIG_ARITY_MAX
-

Description

+

Description

If programmers leave this configuration macro undefined, its default value is 5 (increasing this number might increase compilation time). When defined by programmers, this macro must be a non-negative integer number.

Note: This macro specifies the maximum number of local function parameters excluding bound variables (which are instead specified by BOOST_LOCAL_FUNCTION_CONFIG_BIND_MAX).

See: Tutorial section, Getting Started section, BOOST_LOCAL_FUNCTION_CONFIG_BIND_MAX.

diff --git a/doc/html/BOOST_LOCAL_FUNCTION_CONFIG_BIND_MAX.html b/doc/html/BOOST_LOCAL_FUNCTION_CONFIG_BIND_MAX.html index de9b464..d175ffc 100644 --- a/doc/html/BOOST_LOCAL_FUNCTION_CONFIG_BIND_MAX.html +++ b/doc/html/BOOST_LOCAL_FUNCTION_CONFIG_BIND_MAX.html @@ -33,7 +33,7 @@ BOOST_LOCAL_FUNCTION_CONFIG_BIND_MAX
-

Description

+

Description

If programmers leave this configuration macro undefined, its default value is 10 (increasing this number might increase compilation time). When defined by programmers, this macro must be a non-negative integer number.

Note: This macro specifies the maximum number of bound variables excluding local function parameters (which are instead specified by BOOST_LOCAL_FUNCTION_CONFIG_ARITY_MAX).

See: Tutorial section, Getting Started section, BOOST_LOCAL_FUNCTION_CONFIG_ARITY_MAX.

diff --git a/doc/html/BOOST_LOCAL_FUNCTION_ID.html b/doc/html/BOOST_LOCAL_FUNCTION_ID.html index 6acf484..ebf75f1 100644 --- a/doc/html/BOOST_LOCAL_FUNCTION_ID.html +++ b/doc/html/BOOST_LOCAL_FUNCTION_ID.html @@ -33,7 +33,7 @@ BOOST_LOCAL_FUNCTION_ID(id, within_template, declarations)
-

Description

+

Description

This macro is equivalent to BOOST_LOCAL_FUNCTION but it can be expanded multiple times on the same line if different identifiers id are provided for each expansion (see BOOST_LOCAL_FUNCTION for more detail).

Parameters:

@@ -59,7 +59,8 @@

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 __COUNTER__ 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 __LINE__ to internally generate unique identifiers).

-

See: BOOST_SCOPE_EXIT_END_ID, BOOST_SCOPE_EXIT_ALL_ID, BOOST_SCOPE_EXIT, BOOST_SCOPE_EXIT_TPL.

+

Note: The BOOST_LOCAL_FUNCTION_NAME macro can always be expanded multiple times on the same line because a unique local function name must be provided for each different expansion (so the is no need for a BOOST_LOCAL_FUNCTION_NAME_ID macro).

+

See: BOOST_LOCAL_FUNCTION, BOOST_LOCAL_FUNCTION_TPL.

diff --git a/doc/html/BOOST_LOCAL_FUNCTION_NAME.html b/doc/html/BOOST_LOCAL_FUNCTION_NAME.html index 1b3449b..42cfd8f 100644 --- a/doc/html/BOOST_LOCAL_FUNCTION_NAME.html +++ b/doc/html/BOOST_LOCAL_FUNCTION_NAME.html @@ -33,7 +33,7 @@ BOOST_LOCAL_FUNCTION_NAME(qualified_function_name)
-

Description

+

Description

This macro must follow the local function body code block { ... }:

{ // Some declarative context.
     ...
diff --git a/doc/html/BOOST_LOCAL_FUNCTION_TPL.html b/doc/html/BOOST_LOCAL_FUNCTION_TPL.html
index 2d336c2..6e1c3b0 100644
--- a/doc/html/BOOST_LOCAL_FUNCTION_TPL.html
+++ b/doc/html/BOOST_LOCAL_FUNCTION_TPL.html
@@ -33,7 +33,7 @@
 
 BOOST_LOCAL_FUNCTION_TPL(declarations)
-

Description

+

Description

This macro must be used instead of BOOST_LOCAL_FUNCTION when declaring a local function within a template. A part from that, this macro has the exact same syntax as BOOST_LOCAL_FUNCTION (see BOOST_LOCAL_FUNCTION for more information):

{ // Some declarative context with a template.
     ...
diff --git a/doc/html/BOOST_LOCAL_FUNCTION_TYPEOF.html b/doc/html/BOOST_LOCAL_FUNCTION_TYPEOF.html
index be058dd..5a21aa2 100644
--- a/doc/html/BOOST_LOCAL_FUNCTION_TYPEOF.html
+++ b/doc/html/BOOST_LOCAL_FUNCTION_TYPEOF.html
@@ -33,7 +33,7 @@
 
 BOOST_LOCAL_FUNCTION_TYPEOF(bound_variable_name)
-

Description

+

Description

This macro can be used within the local functions body to refer to the bound variable types so to declare local variables, check concepts (using Boost.ConceptCheck), etc (see the Advanced Topics section). This way the local function can be programmed entirely without explicitly specifying the bound variable types thus facilitating maintenance (e.g., if the type of a bound variable changes in the enclosing scope, the local function code does not have to change).

Parameters:

diff --git a/doc/html/boost_localfunction/Advanced_Topics.html b/doc/html/boost_localfunction/Advanced_Topics.html index 7400bcd..b397026 100644 --- a/doc/html/boost_localfunction/Advanced_Topics.html +++ b/doc/html/boost_localfunction/Advanced_Topics.html @@ -909,7 +909,7 @@ BOOST_AUTO_TEST_CASE(test_same_line){intdelta=10; - LOCAL_INC_DEC(delta)// Declare local functions on same line using `_ID`. + LOCAL_INC_DEC(delta)// Multiple local functions on same line.BOOST_CHECK(dec(inc(123))==123);} @@ -1346,7 +1346,11 @@ to generate unique identifiers. Therefore, if the same macro is expanded more than on time on the same line, the generated identifiers will no longer be unique and the code will not compile. (This restriction does not apply - to MSVC and other compilers that provide the non-standard __COUNTER__ macro.) + to MSVC and other compilers that provide the non-standard __COUNTER__ macro.) Note that the BOOST_LOCAL_FUNCTION_NAME macro + can always be expanded multiple times on the same line because a unique + local function name must be provided for each different expansion (so the + is no need for a BOOST_LOCAL_FUNCTION_NAME_ID + macro).

[27] Rationale. This is the because a local diff --git a/doc/html/boost_localfunction/Alternatives.html b/doc/html/boost_localfunction/Alternatives.html index 0dba535..c0c808d 100644 --- a/doc/html/boost_localfunction/Alternatives.html +++ b/doc/html/boost_localfunction/Alternatives.html @@ -966,14 +966,14 @@

Compiled with bjam release ... for maximum optimization (-O3 -finline-functions) - profile_gcc_cpp11_release + profile_gcc_cxx11_release

diff --git a/doc/html/boost_localfunction/Examples.html b/doc/html/boost_localfunction/Examples.html index 399853f..e3d7faa 100644 --- a/doc/html/boost_localfunction/Examples.html +++ b/doc/html/boost_localfunction/Examples.html @@ -66,7 +66,7 @@

Compiled with bjam debug ... for no optimization (-O0 -fno-inline) - profile_gcc_cpp11_debug + profile_gcc_cxx11_debug

For example (see also gcc_lambda.cpp - and gcc_lambda_cpp11.cpp): + and gcc_lambda_cxx11.cpp):

diff --git a/doc/html/boost_localfunction/Getting_Started.html b/doc/html/boost_localfunction/Getting_Started.html index 9226dfb..7f95c96 100644 --- a/doc/html/boost_localfunction/Getting_Started.html +++ b/doc/html/boost_localfunction/Getting_Started.html @@ -78,12 +78,11 @@ with partial specializations and function pointers (similarly to Boost.Function). As a consequence, this library is fairly demanding on compilers' compliance with the C++03 - standard. At present, this library has been successfully compiled and tested - on the following compilers and platforms: + standard. The authors originally developed and tested the library on:

  1. - GNU Compiler Collection (GCC) 4.5.1 on Ubuntu Linux 10. + GNU Compiler Collection (GCC) C++ 4.5.1 on Ubuntu Linux 10.
  2. GCC 4.3.4 and 4.5.3 (with and without C++11 @@ -91,12 +90,13 @@ on Cygwin.
  3. - Miscrosoft Visual Studio Compiler (MSVC) 8.0 on Windows XP and Windows - 7. + Miscrosoft Visual C++ (MSVC) 8.0 on Windows XP and Windows 7.

- This library has not yet been tested on any other compiler and platform. + See the library regressions + test results for detailed information on supported compilers and + platforms.

diff --git a/doc/html/boost_localfunction/No_Variadic_Macros.html b/doc/html/boost_localfunction/No_Variadic_Macros.html index 012c5fc..101884d 100644 --- a/doc/html/boost_localfunction/No_Variadic_Macros.html +++ b/doc/html/boost_localfunction/No_Variadic_Macros.html @@ -113,16 +113,138 @@

- An - Example + Examples

- The following example shows a bit of all the different macro parameter combinations - using the sequence syntax (see also seq.cpp): -

-

- [seq] + For reference, the following is a list of most of the examples presented in + this documentation reprogrammed using the sequence syntax instead of the comma-separated + syntax (in alphabetic order):

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

+ Files +

+
+

+ add_classifiers_seq.cpp +

+
+

+ add_default_seq.cpp +

+
+

+ add_except_seq.cpp +

+
+

+ add_inline_seq.cpp +

+
+

+ add_params_only_seq.cpp +

+
+

+ add_template_seq.cpp +

+
+

+ add_this_seq.cpp +

+
+

+ add_typed_seq.cpp +

+
+

+ add_with_default_seq.cpp +

+
+

+ all_decl_seq.cpp +

+
+

+ factorial_seq.cpp +

+
+

+ macro_commas_seq.cpp +

+
+

+ nesting_seq.cpp +

+
+

+ overload_seq.cpp +

+
+

+ return_assign_seq.cpp +

+
+

+ return_derivative_seq.cpp +

+
+

+ return_inc_seq.cpp +

+
+

+ return_setget_seq.cpp +

+
+

+ return_this_seq.cpp +

+
+

+ same_line_seq.cpp +

+
+

+ transform_seq.cpp +

+
+

+ typeof_seq.cpp +

+
+

+ typeof_template_seq.cpp +

+
diff --git a/doc/html/index.html b/doc/html/index.html index 48d0be3..c602095 100644 --- a/doc/html/index.html +++ b/doc/html/index.html @@ -145,7 +145,7 @@ intnums[]={2,3};std::for_each(nums,nums+2,add);// Pass it to an algorithm. - BOOST_CHECK(sum==60);// Assert final summation value. + BOOST_CHECK(sum==60);// Assert final summation value.}

@@ -224,7 +224,7 @@

- +

Last revised: March 19, 2012 at 22:33:31 GMT

Last revised: March 22, 2012 at 20:50:10 GMT


diff --git a/doc/local_function.qbk b/doc/local_function.qbk index 3f3374f..75983c9 100644 --- a/doc/local_function.qbk +++ b/doc/local_function.qbk @@ -88,7 +88,7 @@ [import ../test/same_line.cpp] [import ../example/gcc_lambda.cpp] -[import ../example/gcc_lambda_cpp11.cpp] +[import ../example/gcc_lambda_cxx11.cpp] [import ../example/const_block_error.cpp] [import ../example/scope_exit.cpp] [import ../example/scope_exit.hpp] diff --git a/doc/no_variadic_macros.qbk b/doc/no_variadic_macros.qbk index babd1ac..4c2d11b 100644 --- a/doc/no_variadic_macros.qbk +++ b/doc/no_variadic_macros.qbk @@ -33,11 +33,36 @@ Finally, an parameter list is always specified using `void` on compilers with an [ten_void] -[h5 An Example] +[h5 Examples] -The following example shows a bit of all the different macro parameter combinations using the sequence syntax (see also [@../../test/seq.cpp =seq.cpp=]): +For reference, the following is a list of most of the examples presented in this documentation reprogrammed using the sequence syntax instead of the comma-separated syntax (in alphabetic order): -[seq] +[table + [ [Files] ] + [ [[@../../test/add_classifiers_seq.cpp =add_classifiers_seq.cpp=]] ] + [ [[@../../test/add_default_seq.cpp =add_default_seq.cpp=]] ] + [ [[@../../test/add_except_seq.cpp =add_except_seq.cpp=]] ] + [ [[@../../test/add_inline_seq.cpp =add_inline_seq.cpp=]] ] + [ [[@../../test/add_params_only_seq.cpp =add_params_only_seq.cpp=]] ] + [ [[@../../test/add_template_seq.cpp =add_template_seq.cpp=]] ] + [ [[@../../test/add_this_seq.cpp =add_this_seq.cpp=]] ] + [ [[@../../test/add_typed_seq.cpp =add_typed_seq.cpp=]] ] + [ [[@../../test/add_with_default_seq.cpp =add_with_default_seq.cpp=]] ] + [ [[@../../test/all_decl_seq.cpp =all_decl_seq.cpp=]] ] + [ [[@../../test/factorial_seq.cpp =factorial_seq.cpp=]] ] + [ [[@../../test/macro_commas_seq.cpp =macro_commas_seq.cpp=]] ] + [ [[@../../test/nesting_seq.cpp =nesting_seq.cpp=]] ] + [ [[@../../test/overload_seq.cpp =overload_seq.cpp=]] ] + [ [[@../../test/return_assign_seq.cpp =return_assign_seq.cpp=]] ] + [ [[@../../test/return_derivative_seq.cpp =return_derivative_seq.cpp=]] ] + [ [[@../../test/return_inc_seq.cpp =return_inc_seq.cpp=]] ] + [ [[@../../test/return_setget_seq.cpp =return_setget_seq.cpp=]] ] + [ [[@../../test/return_this_seq.cpp =return_this_seq.cpp=]] ] + [ [[@../../test/same_line_seq.cpp =same_line_seq.cpp=]] ] + [ [[@../../test/transform_seq.cpp =transform_seq.cpp=]] ] + [ [[@../../test/typeof_seq.cpp =typeof_seq.cpp=]] ] + [ [[@../../test/typeof_template_seq.cpp =typeof_template_seq.cpp=]] ] +] [endsect] diff --git a/example/gcc_lambda_cxx11.cpp b/example/gcc_lambda_cxx11.cpp index 58ca62c..d5a76e1 100644 --- a/example/gcc_lambda_cxx11.cpp +++ b/example/gcc_lambda_cxx11.cpp @@ -8,12 +8,12 @@ #include #ifndef BOOST_NO_LAMBDAS -#define BOOST_TEST_MODULE TestGccLambdaCpp11 +#define BOOST_TEST_MODULE TestGccLambdaCxx11 #include #include -BOOST_AUTO_TEST_CASE(test_gcc_lambda_cpp11) { - //[gcc_lambda_cpp11 +BOOST_AUTO_TEST_CASE(test_gcc_lambda_cxx11) { + //[gcc_lambda_cxx11 int val = 2; int nums[] = {1, 2, 3}; int* end = nums + 3; diff --git a/include/boost/local_function.hpp b/include/boost/local_function.hpp index d64f7e1..f860872 100644 --- a/include/boost/local_function.hpp +++ b/include/boost/local_function.hpp @@ -222,8 +222,12 @@ line is always necessary to ensure portability (this is because this library can only portably use __LINE__ 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}. +@Note The @RefMacro{BOOST_LOCAL_FUNCTION_NAME} macro can always be expanded +multiple times on the same line because a unique local function name must be +provided for each different expansion (so the is no need for a +BOOST_LOCAL_FUNCTION_NAME_ID macro). + +@See @RefMacro{BOOST_LOCAL_FUNCTION}, @RefMacro{BOOST_LOCAL_FUNCTION_TPL}. */ #define BOOST_LOCAL_FUNCTION_ID(id, within_template, declarations) diff --git a/test/add_lambda.cpp b/test/add_lambda.cpp index 6e80155..8ff2070 100644 --- a/test/add_lambda.cpp +++ b/test/add_lambda.cpp @@ -25,7 +25,7 @@ BOOST_AUTO_TEST_CASE( test_add_lambda ) int nums[] = {2, 3}; std::for_each(nums, nums + 2, add); // Pass it to an algorithm. - BOOST_CHECK( sum == 60 ); // Assert final summation value. + BOOST_CHECK(sum == 60); // Assert final summation value. } //]