Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r77546 - in trunk: boost libs/scope_exit/doc libs/scope_exit/doc/html libs/scope_exit/doc/html/scope_exit libs/scope_exit/example libs/scope_exit/test
From: lorcaminiti_at_[hidden]
Date: 2012-03-25 16:05:42


Author: lcaminiti
Date: 2012-03-25 16:05:38 EDT (Sun, 25 Mar 2012)
New Revision: 77546
URL: http://svn.boost.org/trac/boost/changeset/77546

Log:
Added #error to tests and examples that require variadic macros and/or lambda functions for better error reporting.
Split all sequence syntax with forced no-variadic tests and examples (..._nova) in their own separate file (to avoid macro redefinition warning on compilers within variadic macros).
Updated docs.
Added:
   trunk/libs/scope_exit/example/nova.hpp (contents, props changed)
   trunk/libs/scope_exit/example/scope_guard_seq_nova.cpp (contents, props changed)
   trunk/libs/scope_exit/example/try_catch_seq_nova.cpp (contents, props changed)
   trunk/libs/scope_exit/example/world_lambda.cpp (contents, props changed)
   trunk/libs/scope_exit/test/nova.hpp (contents, props changed)
   trunk/libs/scope_exit/test/same_line_seq_nova.cpp (contents, props changed)
   trunk/libs/scope_exit/test/world_checkpoint_all_nova.cpp (contents, props changed)
   trunk/libs/scope_exit/test/world_checkpoint_all_seq_nova.cpp (contents, props changed)
   trunk/libs/scope_exit/test/world_checkpoint_seq_nova.cpp (contents, props changed)
   trunk/libs/scope_exit/test/world_seq_nova.cpp (contents, props changed)
   trunk/libs/scope_exit/test/world_this_seq_nova.cpp (contents, props changed)
   trunk/libs/scope_exit/test/world_tpl_seq_nova.cpp (contents, props changed)
Removed:
   trunk/libs/scope_exit/test/world_lambda.cpp
Text files modified:
   trunk/boost/scope_exit.hpp | 4
   trunk/libs/scope_exit/doc/html/BOOST_SCOPE_EXIT.html | 2
   trunk/libs/scope_exit/doc/html/BOOST_SCOPE_EXIT_ALL.html | 2
   trunk/libs/scope_exit/doc/html/BOOST_SCOPE_EXIT_ALL_ID.html | 2
   trunk/libs/scope_exit/doc/html/BOOST_SCOPE_EXIT_CONFIG_USE_LAMBDA_IMPL.html | 2
   trunk/libs/scope_exit/doc/html/BOOST_SCOPE_EXIT_END.html | 2
   trunk/libs/scope_exit/doc/html/BOOST_SCOPE_EXIT_END_ID.html | 2
   trunk/libs/scope_exit/doc/html/BOOST_SCOPE_EXIT_ID.html | 2
   trunk/libs/scope_exit/doc/html/BOOST_SCOPE_EXIT_TPL.html | 2
   trunk/libs/scope_exit/doc/html/index.html | 2
   trunk/libs/scope_exit/doc/html/scope_exit/Alternatives.html | 2
   trunk/libs/scope_exit/doc/html/scope_exit/Tutorial.html | 2
   trunk/libs/scope_exit/doc/scope_exit.qbk | 4
   trunk/libs/scope_exit/example/Jamfile.v2 | 18 +++----
   trunk/libs/scope_exit/example/scope_guard.cpp | 10 +--
   trunk/libs/scope_exit/example/try_catch.cpp | 10 +--
   trunk/libs/scope_exit/test/Jamfile.v2 | 36 ++++++++-------
   trunk/libs/scope_exit/test/native.cpp | 93 ++++++++++++++++++++-------------------
   trunk/libs/scope_exit/test/native_this.cpp | 5 +
   trunk/libs/scope_exit/test/native_this_tpl.cpp | 5 +
   trunk/libs/scope_exit/test/native_tpl.cpp | 16 +++---
   trunk/libs/scope_exit/test/native_tu_test.cpp | 4
   trunk/libs/scope_exit/test/same_line.cpp | 12 ++---
   trunk/libs/scope_exit/test/same_line_seq.cpp | 2
   trunk/libs/scope_exit/test/tu_test.hpp | 4 +
   trunk/libs/scope_exit/test/world.cpp | 10 +--
   trunk/libs/scope_exit/test/world_checkpoint.cpp | 10 +--
   trunk/libs/scope_exit/test/world_checkpoint_all.cpp | 12 ++--
   trunk/libs/scope_exit/test/world_checkpoint_all_seq.cpp | 10 +--
   trunk/libs/scope_exit/test/world_this.cpp | 10 +--
   trunk/libs/scope_exit/test/world_tpl.cpp | 10 +--
   trunk/libs/scope_exit/test/world_void.cpp | 2
   32 files changed, 149 insertions(+), 160 deletions(-)

Modified: trunk/boost/scope_exit.hpp
==============================================================================
--- trunk/boost/scope_exit.hpp (original)
+++ trunk/boost/scope_exit.hpp 2012-03-25 16:05:38 EDT (Sun, 25 Mar 2012)
@@ -41,11 +41,11 @@
 
 // PRIVATE/PROTECTED //
 
-// NOTE: AUX prefix and aux namespace mark private symbols that shall be used
+// NOTE: AUX prefix and aux namespace mark "private" symbols that shall be used
 // only within this library; DETAIL prefix and detail namespace mark "protected"
 // symbols that can be used by other Boost libraries but not outside Boost.
 
-// BOOST_SCOPE_EXIT_AUX_GCC also used in regression tests.
+// WARNING: BOOST_SCOPE_EXIT_AUX_GCC also used in regression tests.
 #if defined(__GNUC__) && !defined(BOOST_INTEL)
 # define BOOST_SCOPE_EXIT_AUX_GCC (__GNUC__ * 100 + __GNUC_MINOR__)
 #else

Modified: trunk/libs/scope_exit/doc/html/BOOST_SCOPE_EXIT.html
==============================================================================
--- trunk/libs/scope_exit/doc/html/BOOST_SCOPE_EXIT.html (original)
+++ trunk/libs/scope_exit/doc/html/BOOST_SCOPE_EXIT.html 2012-03-25 16:05:38 EDT (Sun, 25 Mar 2012)
@@ -33,7 +33,7 @@
 
 </span>BOOST_SCOPE_EXIT(capture_list)</pre></div>
 <div class="refsect1">
-<a name="id884643"></a><h2>Description</h2>
+<a name="id852211"></a><h2>Description</h2>
 <p>The scope exit declaration schedules the execution of the scope exit body at the exit of the enclosing scope:</p>
 <pre class="programlisting"> <span class="special">{</span> <span class="comment">// Some local scope.</span>
         <span class="special">...</span>

Modified: trunk/libs/scope_exit/doc/html/BOOST_SCOPE_EXIT_ALL.html
==============================================================================
--- trunk/libs/scope_exit/doc/html/BOOST_SCOPE_EXIT_ALL.html (original)
+++ trunk/libs/scope_exit/doc/html/BOOST_SCOPE_EXIT_ALL.html 2012-03-25 16:05:38 EDT (Sun, 25 Mar 2012)
@@ -33,7 +33,7 @@
 
 </span>BOOST_SCOPE_EXIT_ALL(capture_list)</pre></div>
 <div class="refsect1">
-<a name="id887021"></a><h2>Description</h2>
+<a name="id853508"></a><h2>Description</h2>
 <p>This macro accepts a capture list starting with either <code class="computeroutput">&amp;</code> or <code class="computeroutput">=</code> to capture all variables in scope by reference or value respectively (following the same syntax of C++11 lambdas). A part from that, this macro works like <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT.html" title="Macro BOOST_SCOPE_EXIT">BOOST_SCOPE_EXIT</a></code> (see <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT.html" title="Macro BOOST_SCOPE_EXIT">BOOST_SCOPE_EXIT</a></code> for more information).</p>
 <pre class="programlisting"> <span class="special">{</span> <span class="comment">// Some local scope.</span>
         <span class="special">...</span>

Modified: trunk/libs/scope_exit/doc/html/BOOST_SCOPE_EXIT_ALL_ID.html
==============================================================================
--- trunk/libs/scope_exit/doc/html/BOOST_SCOPE_EXIT_ALL_ID.html (original)
+++ trunk/libs/scope_exit/doc/html/BOOST_SCOPE_EXIT_ALL_ID.html 2012-03-25 16:05:38 EDT (Sun, 25 Mar 2012)
@@ -33,7 +33,7 @@
 
 </span>BOOST_SCOPE_EXIT_ALL_ID(id, capture_list)</pre></div>
 <div class="refsect1">
-<a name="id887559"></a><h2>Description</h2>
+<a name="id854045"></a><h2>Description</h2>
 <p>This macro is equivalent to <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT_ALL.html" title="Macro BOOST_SCOPE_EXIT_ALL">BOOST_SCOPE_EXIT_ALL</a></code> but it can be expanded multiple times on the same line if different identifiers <code class="computeroutput">id</code> are provided for each expansion (see <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT_ALL.html" title="Macro BOOST_SCOPE_EXIT_ALL">BOOST_SCOPE_EXIT_ALL</a></code> for more detail).</p>
 <p><span class="bold"><strong>Parameters:</strong></span> </p>
 <div class="informaltable"><table class="table">

Modified: trunk/libs/scope_exit/doc/html/BOOST_SCOPE_EXIT_CONFIG_USE_LAMBDA_IMPL.html
==============================================================================
--- trunk/libs/scope_exit/doc/html/BOOST_SCOPE_EXIT_CONFIG_USE_LAMBDA_IMPL.html (original)
+++ trunk/libs/scope_exit/doc/html/BOOST_SCOPE_EXIT_CONFIG_USE_LAMBDA_IMPL.html 2012-03-25 16:05:38 EDT (Sun, 25 Mar 2012)
@@ -33,7 +33,7 @@
 
 </span>BOOST_SCOPE_EXIT_CONFIG_USE_LAMBDA_IMPL</pre></div>
 <div class="refsect1">
-<a name="id888058"></a><h2>Description</h2>
+<a name="id854544"></a><h2>Description</h2>
 <p>If programmers define this configuration macro on a C++11 compiler, lambda functions will be used to implement the <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT.html" title="Macro BOOST_SCOPE_EXIT">BOOST_SCOPE_EXIT</a></code> macro. By default this macro is not defined.</p>
 <p><span class="bold"><strong>Note:</strong></span> When <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT.html" title="Macro BOOST_SCOPE_EXIT">BOOST_SCOPE_EXIT</a></code> is implemented using lambda, the semantics of its variable captures follow the semantics of C++11 lambda captures which are in general different from the legacy capture semantics of this library (e.g., C++11 lambdas require to capture data members via capturing the object <code class="computeroutput">this</code> while this library always allowed to capture data members directly). Therefore, when this configuration macro is defined, <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT.html" title="Macro BOOST_SCOPE_EXIT">BOOST_SCOPE_EXIT</a></code> is no longer backward compatible.</p>
 <p>A semicolon <code class="computeroutput">;</code> can simply be used instead of <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT_END.html" title="Macro BOOST_SCOPE_EXIT_END">BOOST_SCOPE_EXIT_END</a></code> when this configuration macro is defined.</p>

Modified: trunk/libs/scope_exit/doc/html/BOOST_SCOPE_EXIT_END.html
==============================================================================
--- trunk/libs/scope_exit/doc/html/BOOST_SCOPE_EXIT_END.html (original)
+++ trunk/libs/scope_exit/doc/html/BOOST_SCOPE_EXIT_END.html 2012-03-25 16:05:38 EDT (Sun, 25 Mar 2012)
@@ -33,7 +33,7 @@
 
 </span>BOOST_SCOPE_EXIT_END</pre></div>
 <div class="refsect1">
-<a name="id887708"></a><h2>Description</h2>
+<a name="id854194"></a><h2>Description</h2>
 <p>This macro must follow the closing curly bracket <code class="computeroutput">}</code> that ends the scope exit body:</p>
 <pre class="programlisting"> <span class="special">{</span> <span class="comment">// Some local scope.</span>
         <span class="special">...</span>

Modified: trunk/libs/scope_exit/doc/html/BOOST_SCOPE_EXIT_END_ID.html
==============================================================================
--- trunk/libs/scope_exit/doc/html/BOOST_SCOPE_EXIT_END_ID.html (original)
+++ trunk/libs/scope_exit/doc/html/BOOST_SCOPE_EXIT_END_ID.html 2012-03-25 16:05:38 EDT (Sun, 25 Mar 2012)
@@ -33,7 +33,7 @@
 
 </span>BOOST_SCOPE_EXIT_END_ID(id)</pre></div>
 <div class="refsect1">
-<a name="id887933"></a><h2>Description</h2>
+<a name="id854420"></a><h2>Description</h2>
 <p>This macro is equivalent to <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT_END.html" title="Macro BOOST_SCOPE_EXIT_END">BOOST_SCOPE_EXIT_END</a></code> but it can be expanded multiple times on the same line if different identifiers <code class="computeroutput">id</code> are provided for each expansion (see <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT_END.html" title="Macro BOOST_SCOPE_EXIT_END">BOOST_SCOPE_EXIT_END</a></code> for more detail).</p>
 <p><span class="bold"><strong>Parameters:</strong></span> </p>
 <div class="informaltable"><table class="table">

Modified: trunk/libs/scope_exit/doc/html/BOOST_SCOPE_EXIT_ID.html
==============================================================================
--- trunk/libs/scope_exit/doc/html/BOOST_SCOPE_EXIT_ID.html (original)
+++ trunk/libs/scope_exit/doc/html/BOOST_SCOPE_EXIT_ID.html 2012-03-25 16:05:38 EDT (Sun, 25 Mar 2012)
@@ -33,7 +33,7 @@
 
 </span>BOOST_SCOPE_EXIT_ID(id, within_template, capture_list)</pre></div>
 <div class="refsect1">
-<a name="id886827"></a><h2>Description</h2>
+<a name="id853313"></a><h2>Description</h2>
 <p>This macro is equivalent to <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT.html" title="Macro BOOST_SCOPE_EXIT">BOOST_SCOPE_EXIT</a></code> but it can be expanded multiple times on the same line if different identifiers <code class="computeroutput">id</code> are provided for each expansion (see <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT.html" title="Macro BOOST_SCOPE_EXIT">BOOST_SCOPE_EXIT</a></code> for more detail).</p>
 <p><span class="bold"><strong>Parameters:</strong></span> </p>
 <div class="informaltable"><table class="table">

Modified: trunk/libs/scope_exit/doc/html/BOOST_SCOPE_EXIT_TPL.html
==============================================================================
--- trunk/libs/scope_exit/doc/html/BOOST_SCOPE_EXIT_TPL.html (original)
+++ trunk/libs/scope_exit/doc/html/BOOST_SCOPE_EXIT_TPL.html 2012-03-25 16:05:38 EDT (Sun, 25 Mar 2012)
@@ -33,7 +33,7 @@
 
 </span>BOOST_SCOPE_EXIT_TPL(capture_list)</pre></div>
 <div class="refsect1">
-<a name="id886294"></a><h2>Description</h2>
+<a name="id852780"></a><h2>Description</h2>
 <p>Various versions of the GCC compiler do not compile <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT.html" title="Macro BOOST_SCOPE_EXIT">BOOST_SCOPE_EXIT</a></code> inside function templates. As a workaround, <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT_TPL.html" title="Macro BOOST_SCOPE_EXIT_TPL">BOOST_SCOPE_EXIT_TPL</a></code> should be used instead of <code class="computeroutput"><a class="link" href="BOOST_SCOPE_EXIT.html" title="Macro BOOST_SCOPE_EXIT">BOOST_SCOPE_EXIT</a></code> in these cases:</p>
 <pre class="programlisting"> <span class="special">{</span> <span class="comment">// Some local scope.</span>
         <span class="special">...</span>

Modified: trunk/libs/scope_exit/doc/html/index.html
==============================================================================
--- trunk/libs/scope_exit/doc/html/index.html (original)
+++ trunk/libs/scope_exit/doc/html/index.html 2012-03-25 16:05:38 EDT (Sun, 25 Mar 2012)
@@ -124,7 +124,7 @@
 </div>
 </div>
 <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
-<td align="left"><p><small>Last revised: March 22, 2012 at 20:40:16 GMT</small></p></td>
+<td align="left"><p><small>Last revised: March 25, 2012 at 20:01:40 GMT</small></p></td>
 <td align="right"><div class="copyright-footer"></div></td>
 </tr></table>
 <hr>

Modified: trunk/libs/scope_exit/doc/html/scope_exit/Alternatives.html
==============================================================================
--- trunk/libs/scope_exit/doc/html/scope_exit/Alternatives.html (original)
+++ trunk/libs/scope_exit/doc/html/scope_exit/Alternatives.html 2012-03-25 16:05:38 EDT (Sun, 25 Mar 2012)
@@ -269,7 +269,7 @@
     </h6>
 <p>
       Using C++11 lambdas, it is relatively easy to implement the <a class="link" href="../index.html" title="Chapter&#160;1.&#160;Boost.ScopeExit 1.1.0">Boost.ScopeExit</a>
- construct. For example (see also world_lambda.cpp):
+ construct. For example (see also world_lambda.cpp):
     </p>
 <p>
 </p>

Modified: trunk/libs/scope_exit/doc/html/scope_exit/Tutorial.html
==============================================================================
--- trunk/libs/scope_exit/doc/html/scope_exit/Tutorial.html (original)
+++ trunk/libs/scope_exit/doc/html/scope_exit/Tutorial.html 2012-03-25 16:05:38 EDT (Sun, 25 Mar 2012)
@@ -436,7 +436,7 @@
         <span class="identifier">SCOPE_EXIT_ALL_INC_DEC</span><span class="special">(</span><span class="identifier">x</span><span class="special">,</span> <span class="identifier">delta</span><span class="special">)</span> <span class="comment">// Multiple scope exits on same line.</span>
     <span class="special">}</span>
     <span class="identifier">BOOST_CHECK</span><span class="special">(</span><span class="identifier">x</span> <span class="special">==</span> <span class="number">0</span><span class="special">);</span>
-<span class="preprocessor">#endif</span>
+<span class="preprocessor">#endif</span> <span class="comment">// lambdas</span>
 <span class="special">}</span>
 </pre>
 <p>

Modified: trunk/libs/scope_exit/doc/scope_exit.qbk
==============================================================================
--- trunk/libs/scope_exit/doc/scope_exit.qbk (original)
+++ trunk/libs/scope_exit/doc/scope_exit.qbk 2012-03-25 16:05:38 EDT (Sun, 25 Mar 2012)
@@ -51,10 +51,10 @@
 [import ../test/world_void.cpp]
 [import ../test/world_checkpoint_all.cpp]
 [import ../test/world_tpl.cpp]
-[import ../test/world_lambda.cpp]
 [import ../test/same_line.cpp]
 [import ../example/try_catch.cpp]
 [import ../example/scope_guard.cpp]
+[import ../example/world_lambda.cpp]
 
 This library allows to execute arbitrary code when the enclosing scope exits.
 
@@ -391,7 +391,7 @@
 [h5 C++11 Lambdas]
 
 Using C++11 lambdas, it is relatively easy to implement the __Boost_ScopeExit__ construct.
-For example (see also [@../../test/world_lambda.cpp =world_lambda.cpp=]):
+For example (see also [@../../example/world_lambda.cpp =world_lambda.cpp=]):
 
 [world_lambda]
 

Modified: trunk/libs/scope_exit/example/Jamfile.v2
==============================================================================
--- trunk/libs/scope_exit/example/Jamfile.v2 (original)
+++ trunk/libs/scope_exit/example/Jamfile.v2 2012-03-25 16:05:38 EDT (Sun, 25 Mar 2012)
@@ -8,15 +8,13 @@
 
 import testing ;
 
-# Run variadic and sequence syntax (also forcing no variadic macros).
-rule run-vaseq ( file_name )
-{
- run $(file_name).cpp ;
- run $(file_name)_seq.cpp ;
- run $(file_name)_seq.cpp : : : <define>BOOST_NO_VARIADIC_MACROS :
- $(file_name)_seq_nova : ;
-}
+run try_catch.cpp ;
+run try_catch_seq.cpp ;
+run try_catch_seq_nova.cpp ;
 
-run-vaseq try_catch ;
-run-vaseq scope_guard ;
+run scope_guard.cpp ;
+run scope_guard_seq.cpp ;
+run scope_guard_seq_nova.cpp ;
+
+run world_lambda.cpp ;
 

Added: trunk/libs/scope_exit/example/nova.hpp
==============================================================================
--- (empty file)
+++ trunk/libs/scope_exit/example/nova.hpp 2012-03-25 16:05:38 EDT (Sun, 25 Mar 2012)
@@ -0,0 +1,21 @@
+
+// Copyright (C) 2012 Lorenzo Caminiti
+// Distributed under the Boost Software License, Version 1.0
+// (see accompanying file LICENSE_1_0.txt or a copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// Home at http://www.boost.org/libs/scope_exit
+
+#ifndef NOVA_HPP_
+#define NOVA_HPP_
+
+#include <boost/config.hpp>
+
+// 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
+#endif
+
+#endif // #include guard
+

Modified: trunk/libs/scope_exit/example/scope_guard.cpp
==============================================================================
--- trunk/libs/scope_exit/example/scope_guard.cpp (original)
+++ trunk/libs/scope_exit/example/scope_guard.cpp 2012-03-25 16:05:38 EDT (Sun, 25 Mar 2012)
@@ -7,7 +7,9 @@
 // Home at http://www.boost.org/libs/scope_exit
 
 #include <boost/config.hpp>
-#ifndef BOOST_NO_VARIADIC_MACROS
+#ifdef BOOST_NO_VARIADIC_MACROS
+# error "variadic macros required"
+#else
 
 #include <boost/scope_exit.hpp>
 #include <map>
@@ -38,9 +40,5 @@
     return 0;
 }
 
-#else
-
-int main(void) { return 0; } // Trivial program.
-
-#endif
+#endif // variadic macros
 

Added: trunk/libs/scope_exit/example/scope_guard_seq_nova.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/scope_exit/example/scope_guard_seq_nova.cpp 2012-03-25 16:05:38 EDT (Sun, 25 Mar 2012)
@@ -0,0 +1,10 @@
+
+// Copyright (C) 2012 Lorenzo Caminiti
+// Distributed under the Boost Software License, Version 1.0
+// (see accompanying file LICENSE_1_0.txt or a copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// Home at http://www.boost.org/libs/scope_exit
+
+#include "nova.hpp"
+#include "scope_guard_seq.cpp"
+

Modified: trunk/libs/scope_exit/example/try_catch.cpp
==============================================================================
--- trunk/libs/scope_exit/example/try_catch.cpp (original)
+++ trunk/libs/scope_exit/example/try_catch.cpp 2012-03-25 16:05:38 EDT (Sun, 25 Mar 2012)
@@ -7,7 +7,9 @@
 // Home at http://www.boost.org/libs/scope_exit
 
 #include <boost/config.hpp>
-#ifndef BOOST_NO_VARIADIC_MACROS
+#ifdef BOOST_NO_VARIADIC_MACROS
+# error "variadic macros required"
+#else
 
 #include <boost/scope_exit.hpp>
 #include <iostream>
@@ -59,9 +61,5 @@
     return 0;
 }
 
-#else
-
-int main(void) { return 0; } // Trivial program.
-
-#endif
+#endif // variadic macros
 

Added: trunk/libs/scope_exit/example/try_catch_seq_nova.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/scope_exit/example/try_catch_seq_nova.cpp 2012-03-25 16:05:38 EDT (Sun, 25 Mar 2012)
@@ -0,0 +1,10 @@
+
+// Copyright (C) 2012 Lorenzo Caminiti
+// Distributed under the Boost Software License, Version 1.0
+// (see accompanying file LICENSE_1_0.txt or a copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// Home at http://www.boost.org/libs/scope_exit
+
+#include "nova.hpp"
+#include "try_catch_seq.cpp"
+

Added: trunk/libs/scope_exit/example/world_lambda.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/scope_exit/example/world_lambda.cpp 2012-03-25 16:05:38 EDT (Sun, 25 Mar 2012)
@@ -0,0 +1,57 @@
+
+// Copyright (C) 2006-2009, 2012 Alexander Nasonov
+// Copyright (C) 2012 Lorenzo Caminiti
+// Distributed under the Boost Software License, Version 1.0
+// (see accompanying file LICENSE_1_0.txt or a copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// Home at http://www.boost.org/libs/scope_exit
+
+#include <boost/config.hpp>
+#ifdef BOOST_NO_LAMBDAS
+# error "lambda functions required"
+#else
+
+#define BOOST_TEST_MODULE TestWorldLambda
+#include <boost/test/unit_test.hpp>
+#include <vector>
+
+struct person {};
+
+struct world {
+ void add_person(person const& a_person);
+ std::vector<person> persons_;
+};
+
+//[world_lambda
+#include <functional>
+
+struct scope_exit {
+ scope_exit(std::function<void (void)> f) : f_(f) {}
+ ~scope_exit(void) { f_(); }
+private:
+ std::function<void (void)> f_;
+};
+
+void world::add_person(person const& a_person) {
+ bool commit = false;
+
+ persons_.push_back(a_person);
+ scope_exit on_exit1([&commit, this](void) { // Use C++11 lambda.
+ if(!commit) persons_.pop_back(); // `persons_` via captured `this`.
+ });
+
+ // ...
+
+ commit = true;
+}
+//]
+
+BOOST_AUTO_TEST_CASE(test_world_lambda) {
+ world w;
+ person p;
+ w.add_person(p);
+ BOOST_CHECK(w.persons_.size() == 1);
+}
+
+#endif // lambdas
+

Modified: trunk/libs/scope_exit/test/Jamfile.v2
==============================================================================
--- trunk/libs/scope_exit/test/Jamfile.v2 (original)
+++ trunk/libs/scope_exit/test/Jamfile.v2 2012-03-25 16:05:38 EDT (Sun, 25 Mar 2012)
@@ -15,24 +15,26 @@
         <link>static
     ;
 
-# Run variadic and sequence syntax (also forcing no variadic macros).
-rule run-vaseq ( file_name )
-{
- run $(file_name).cpp ;
- run $(file_name)_seq.cpp ;
- run $(file_name)_seq.cpp : : : <define>BOOST_NO_VARIADIC_MACROS :
- $(file_name)_seq_nova : ;
-}
-
-test-suite world_tests
- : [ run-vaseq world ]
- [ run-vaseq world_checkpoint ]
- [ run-vaseq world_checkpoint_all ]
- [ run world_lambda.cpp ]
- [ run-vaseq world_this ]
- [ run-vaseq world_tpl ]
+test-suite doc_tests
+ : [ run same_line.cpp ]
+ [ run same_line_seq.cpp ]
+ [ run same_line_seq_nova.cpp ]
+ [ run world.cpp ]
+ [ run world_seq.cpp ]
+ [ run world_seq_nova.cpp ]
+ [ run world_checkpoint.cpp ]
+ [ run world_checkpoint_seq.cpp ]
+ [ run world_checkpoint_seq_nova.cpp ]
+ [ run world_checkpoint_all.cpp ]
+ [ run world_checkpoint_all_seq.cpp ]
+ [ run world_checkpoint_all_seq_nova.cpp ]
+ [ run world_this.cpp ]
+ [ run world_this_seq.cpp ]
+ [ run world_this_seq_nova.cpp ]
+ [ run world_tpl.cpp ]
+ [ run world_tpl_seq.cpp ]
+ [ run world_tpl_seq_nova.cpp ]
         [ run world_void.cpp ]
- [ run-vaseq same_line ]
     ;
 
 test-suite native_tests

Modified: trunk/libs/scope_exit/test/native.cpp
==============================================================================
--- trunk/libs/scope_exit/test/native.cpp (original)
+++ trunk/libs/scope_exit/test/native.cpp 2012-03-25 16:05:38 EDT (Sun, 25 Mar 2012)
@@ -7,6 +7,7 @@
 // Home at http://www.boost.org/libs/scope_exit
 
 #include <boost/scope_exit.hpp>
+#include <boost/config.hpp>
 #include <boost/typeof/typeof.hpp>
 #include <boost/typeof/std/string.hpp>
 #include <boost/test/unit_test.hpp>
@@ -30,19 +31,19 @@
     int i = 0;
 
     BOOST_SCOPE_EXIT(void) {
- BOOST_CHECK( Holder<>::g_long == 3 );
+ BOOST_CHECK(Holder<>::g_long == 3);
     } BOOST_SCOPE_EXIT_END
 
     BOOST_SCOPE_EXIT( (i) ) {
- BOOST_CHECK( i == 0 );
- BOOST_CHECK( Holder<>::g_long == 3 );
- BOOST_CHECK( g_str == "try: g_str" );
+ BOOST_CHECK(i == 0);
+ BOOST_CHECK(Holder<>::g_long == 3);
+ BOOST_CHECK(g_str == "try: g_str");
     } BOOST_SCOPE_EXIT_END
 
     BOOST_SCOPE_EXIT( (&i) ) {
- BOOST_CHECK( i == 3 );
- BOOST_CHECK( Holder<>::g_long == 3 );
- BOOST_CHECK( g_str == "try: g_str" );
+ BOOST_CHECK(i == 3);
+ BOOST_CHECK(Holder<>::g_long == 3);
+ BOOST_CHECK(g_str == "try: g_str");
     } BOOST_SCOPE_EXIT_END
 
     {
@@ -62,25 +63,25 @@
             } catch(...) {}
         } BOOST_SCOPE_EXIT_END
 
- BOOST_CHECK( i == 0 );
- BOOST_CHECK( g_str == "" );
- BOOST_CHECK( Holder<>::g_long == 1 );
+ BOOST_CHECK(i == 0);
+ BOOST_CHECK(g_str == "");
+ BOOST_CHECK(Holder<>::g_long == 1);
     }
 
- BOOST_CHECK( Holder<>::g_long == 2 );
- BOOST_CHECK( g_str == "g_str" );
- BOOST_CHECK( i == 1 ); // Check that first declared is executed last.
+ BOOST_CHECK(Holder<>::g_long == 2);
+ BOOST_CHECK(g_str == "g_str");
+ BOOST_CHECK(i == 1); // Check that first declared is executed last.
 
     BOOST_SCOPE_EXIT( (&i) ) {
- BOOST_CHECK( i == 3 );
- BOOST_CHECK( Holder<>::g_long == 3 );
- BOOST_CHECK( g_str == "try: g_str" );
+ BOOST_CHECK(i == 3);
+ BOOST_CHECK(Holder<>::g_long == 3);
+ BOOST_CHECK(g_str == "try: g_str");
     } BOOST_SCOPE_EXIT_END
 
     BOOST_SCOPE_EXIT( (i) ) {
- BOOST_CHECK( i == 1 );
- BOOST_CHECK( Holder<>::g_long == 3 );
- BOOST_CHECK( g_str == "try: g_str" );
+ BOOST_CHECK(i == 1);
+ BOOST_CHECK(Holder<>::g_long == 3);
+ BOOST_CHECK(g_str == "try: g_str");
     } BOOST_SCOPE_EXIT_END
 
     try {
@@ -94,15 +95,15 @@
             Holder<>::g_long = 3;
         } BOOST_SCOPE_EXIT_END
 
- BOOST_CHECK( i == 1 );
- BOOST_CHECK( g_str == "g_str" );
- BOOST_CHECK( Holder<>::g_long == 2 );
+ BOOST_CHECK(i == 1);
+ BOOST_CHECK(g_str == "g_str");
+ BOOST_CHECK(Holder<>::g_long == 2);
 
         throw 0;
     } catch(int) {
- BOOST_CHECK( Holder<>::g_long == 3 );
- BOOST_CHECK( g_str == "try: g_str" );
- BOOST_CHECK( i == 3 ); // Check that first declared is executed last.
+ BOOST_CHECK(Holder<>::g_long == 3);
+ BOOST_CHECK(g_str == "try: g_str");
+ BOOST_CHECK(i == 3); // Check that first declared is executed last.
     }
 }
 
@@ -124,12 +125,12 @@
 
         pf = &foo;
 
- BOOST_CHECK( results[0] == false );
- BOOST_CHECK( results[1] == false );
+ BOOST_CHECK(results[0] == false);
+ BOOST_CHECK(results[1] == false);
     }
 
- BOOST_CHECK( results[0] == true );
- BOOST_CHECK( results[1] == true );
+ BOOST_CHECK(results[0] == true);
+ BOOST_CHECK(results[1] == true);
 
     {
         BOOST_SCOPE_EXIT( (&results) (pf) ) {
@@ -141,17 +142,17 @@
 
         pf = 0;
 
- BOOST_CHECK( results[0] == true );
- BOOST_CHECK( results[1] == true );
+ BOOST_CHECK(results[0] == true);
+ BOOST_CHECK(results[1] == true);
     }
 
- BOOST_CHECK( pf == 0 );
- BOOST_CHECK( results[0] == false );
- BOOST_CHECK( results[1] == false );
+ BOOST_CHECK(pf == 0);
+ BOOST_CHECK(results[0] == false);
+ BOOST_CHECK(results[1] == false);
 }
 
 void test_cpp11(void) {
-#if !defined(BOOST_NO_LAMBDAS) && !defined(BOOST_SCOPE_EXIT_CONFIG_NO_CPP11)
+#ifndef BOOST_NO_LAMBDAS
     int i = 0, j = 1;
 
     {
@@ -159,31 +160,31 @@
             i = j = 1; // modify copies
         };
     }
- BOOST_CHECK( i == 0 );
- BOOST_CHECK( j == 1 );
+ BOOST_CHECK(i == 0);
+ BOOST_CHECK(j == 1);
 
     {
         BOOST_SCOPE_EXIT_ALL(&) {
             i = 1;
             j = 2;
         };
- BOOST_CHECK( i == 0 );
- BOOST_CHECK( j == 1 );
+ BOOST_CHECK(i == 0);
+ BOOST_CHECK(j == 1);
     }
- BOOST_CHECK( i == 1 );
- BOOST_CHECK( j == 2 );
+ BOOST_CHECK(i == 1);
+ BOOST_CHECK(j == 2);
 
     {
         BOOST_SCOPE_EXIT_ALL(=, &j) {
             i = 2; // modify a copy
             j = 3;
         };
- BOOST_CHECK( i == 1 );
- BOOST_CHECK( j == 2 );
+ BOOST_CHECK(i == 1);
+ BOOST_CHECK(j == 2);
     }
- BOOST_CHECK( i == 1 );
- BOOST_CHECK( j == 3 );
-#endif
+ BOOST_CHECK(i == 1);
+ BOOST_CHECK(j == 3);
+#endif // lambdas
 }
 
 test_suite* init_unit_test_suite(int, char* []) {

Modified: trunk/libs/scope_exit/test/native_this.cpp
==============================================================================
--- trunk/libs/scope_exit/test/native_this.cpp (original)
+++ trunk/libs/scope_exit/test/native_this.cpp 2012-03-25 16:05:38 EDT (Sun, 25 Mar 2012)
@@ -7,6 +7,7 @@
 // Home at http://www.boost.org/libs/scope_exit
 
 #include <boost/scope_exit.hpp>
+#include <boost/config.hpp>
 #include <boost/typeof/typeof.hpp>
 #include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
 #include <boost/test/unit_test.hpp>
@@ -24,11 +25,11 @@
             BOOST_CHECK(this_->value_ == 0);
         } BOOST_SCOPE_EXIT_END
 
-#if !defined(BOOST_NO_LAMBDAS) && !defined(BOOST_SCOPE_EXIT_CONFIG_NO_CPP11)
+#ifndef BOOST_NO_LAMBDAS
         BOOST_SCOPE_EXIT_ALL(&, this) {
             BOOST_CHECK(this->value_ == 0);
         };
-#endif
+#endif // lambdas
 
         value_ = 0;
     }

Modified: trunk/libs/scope_exit/test/native_this_tpl.cpp
==============================================================================
--- trunk/libs/scope_exit/test/native_this_tpl.cpp (original)
+++ trunk/libs/scope_exit/test/native_this_tpl.cpp 2012-03-25 16:05:38 EDT (Sun, 25 Mar 2012)
@@ -7,6 +7,7 @@
 // Home at http://www.boost.org/libs/scope_exit
 
 #include <boost/scope_exit.hpp>
+#include <boost/config.hpp>
 #include <boost/typeof/typeof.hpp>
 #include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
 #include <boost/test/unit_test.hpp>
@@ -26,11 +27,11 @@
             BOOST_CHECK(this_->value_ == 0);
         } BOOST_SCOPE_EXIT_END
 
-#if !defined(BOOST_NO_LAMBDAS) && !defined(BOOST_SCOPE_EXIT_CONFIG_NO_CPP11)
+#ifndef BOOST_NO_LAMBDAS
         BOOST_SCOPE_EXIT_ALL(&, this) {
             BOOST_CHECK(this->value_ == 0);
         };
-#endif
+#endif // lambdas
 
         value_ = 0;
     }

Modified: trunk/libs/scope_exit/test/native_tpl.cpp
==============================================================================
--- trunk/libs/scope_exit/test/native_tpl.cpp (original)
+++ trunk/libs/scope_exit/test/native_tpl.cpp 2012-03-25 16:05:38 EDT (Sun, 25 Mar 2012)
@@ -35,12 +35,12 @@
             ++tv;
         } BOOST_SCOPE_EXIT_END
 
- BOOST_CHECK( t == remember );
- BOOST_CHECK( tval == remember );
+ BOOST_CHECK(t == remember);
+ BOOST_CHECK(tval == remember);
     }
 
- BOOST_CHECK( tval == 1 );
- BOOST_CHECK( t == remember + 2 );
+ BOOST_CHECK(tval == 1);
+ BOOST_CHECK(t == remember + 2);
 }
 
 template<class Vector, int Value>
@@ -57,12 +57,12 @@
             vval.push_back(Value);
         } BOOST_SCOPE_EXIT_END
 
- BOOST_CHECK( v.size() == remember.size() );
- BOOST_CHECK( vval.size() == remember.size() );
+ BOOST_CHECK(v.size() == remember.size());
+ BOOST_CHECK(vval.size() == remember.size());
     }
 
- BOOST_CHECK( v.size() == 1 + remember.size() );
- BOOST_CHECK( vval.size() == 1 + remember.size() );
+ BOOST_CHECK(v.size() == 1 + remember.size());
+ BOOST_CHECK(vval.size() == 1 + remember.size());
 }
 
 void test_tpl(void) {

Modified: trunk/libs/scope_exit/test/native_tu_test.cpp
==============================================================================
--- trunk/libs/scope_exit/test/native_tu_test.cpp (original)
+++ trunk/libs/scope_exit/test/native_tu_test.cpp 2012-03-25 16:05:38 EDT (Sun, 25 Mar 2012)
@@ -12,8 +12,8 @@
 using namespace boost::unit_test;
 
 void test(void) {
- BOOST_CHECK( tu1() == 1 );
- BOOST_CHECK( tu2() == 2 );
+ BOOST_CHECK(tu1() == 1);
+ BOOST_CHECK(tu2() == 2);
 }
 
 test_suite* init_unit_test_suite(int, char* []) {

Added: trunk/libs/scope_exit/test/nova.hpp
==============================================================================
--- (empty file)
+++ trunk/libs/scope_exit/test/nova.hpp 2012-03-25 16:05:38 EDT (Sun, 25 Mar 2012)
@@ -0,0 +1,21 @@
+
+// Copyright (C) 2012 Lorenzo Caminiti
+// Distributed under the Boost Software License, Version 1.0
+// (see accompanying file LICENSE_1_0.txt or a copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// Home at http://www.boost.org/libs/scope_exit
+
+#ifndef NOVA_HPP_
+#define NOVA_HPP_
+
+#include <boost/config.hpp>
+
+// 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
+#endif
+
+#endif // #include guard
+

Modified: trunk/libs/scope_exit/test/same_line.cpp
==============================================================================
--- trunk/libs/scope_exit/test/same_line.cpp (original)
+++ trunk/libs/scope_exit/test/same_line.cpp 2012-03-25 16:05:38 EDT (Sun, 25 Mar 2012)
@@ -7,7 +7,9 @@
 // Home at http://www.boost.org/libs/scope_exit
 
 #include <boost/config.hpp>
-#ifndef BOOST_NO_VARIADIC_MACROS
+#ifdef BOOST_NO_VARIADIC_MACROS
+# error "variadic macros required"
+#else
 
 #include <boost/scope_exit.hpp>
 #include <boost/preprocessor/cat.hpp>
@@ -51,13 +53,9 @@
         SCOPE_EXIT_ALL_INC_DEC(x, delta) // Multiple scope exits on same line.
     }
     BOOST_CHECK(x == 0);
-#endif
+#endif // lambdas
 }
 //]
 
-#else
-
-int main(void) { return 0; } // Trivial test.
-
-#endif
+#endif // variadic macros
 

Modified: trunk/libs/scope_exit/test/same_line_seq.cpp
==============================================================================
--- trunk/libs/scope_exit/test/same_line_seq.cpp (original)
+++ trunk/libs/scope_exit/test/same_line_seq.cpp 2012-03-25 16:05:38 EDT (Sun, 25 Mar 2012)
@@ -48,6 +48,6 @@
         SCOPE_EXIT_ALL_INC_DEC(x, delta)
     }
     BOOST_CHECK(x == 0);
-#endif
+#endif // lambdas
 }
 

Added: trunk/libs/scope_exit/test/same_line_seq_nova.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/scope_exit/test/same_line_seq_nova.cpp 2012-03-25 16:05:38 EDT (Sun, 25 Mar 2012)
@@ -0,0 +1,10 @@
+
+// Copyright (C) 2012 Lorenzo Caminiti
+// Distributed under the Boost Software License, Version 1.0
+// (see accompanying file LICENSE_1_0.txt or a copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// Home at http://www.boost.org/libs/scope_exit
+
+#include "nova.hpp"
+#include "same_line_seq.cpp"
+

Modified: trunk/libs/scope_exit/test/tu_test.hpp
==============================================================================
--- trunk/libs/scope_exit/test/tu_test.hpp (original)
+++ trunk/libs/scope_exit/test/tu_test.hpp 2012-03-25 16:05:38 EDT (Sun, 25 Mar 2012)
@@ -7,6 +7,7 @@
 // Home at http://www.boost.org/libs/scope_exit
 
 #include <boost/scope_exit.hpp>
+#include <boost/config.hpp>
 
 int tu1(void);
 int tu2(void);
@@ -21,7 +22,8 @@
     return i;
 }
 
-#if !defined(BOOST_SCOPE_EXIT_AUX_GCC) || BOOST_SCOPE_EXIT_AUX_GCC >= 304
+#if !defined(BOOST_INTEL) && defined(__GNUC__) && \
+ (__GNUC__ * 100 + __GNUC_MINOR__) >= 304
 template<class Int>
 Int template_f(Int i) {
     {

Modified: trunk/libs/scope_exit/test/world.cpp
==============================================================================
--- trunk/libs/scope_exit/test/world.cpp (original)
+++ trunk/libs/scope_exit/test/world.cpp 2012-03-25 16:05:38 EDT (Sun, 25 Mar 2012)
@@ -7,7 +7,9 @@
 // Home at http://www.boost.org/libs/scope_exit
 
 #include <boost/config.hpp>
-#ifndef BOOST_NO_VARIADIC_MACROS
+#ifdef BOOST_NO_VARIADIC_MACROS
+# error "variadic macros required"
+#else
 
 #include <boost/scope_exit.hpp>
 #include <boost/typeof/typeof.hpp>
@@ -52,9 +54,5 @@
     BOOST_CHECK(w.population() == 1);
 }
 
-#else
-
-int main(void) { return 0; } // Trivial test.
-
-#endif
+#endif // variadic macros
 

Modified: trunk/libs/scope_exit/test/world_checkpoint.cpp
==============================================================================
--- trunk/libs/scope_exit/test/world_checkpoint.cpp (original)
+++ trunk/libs/scope_exit/test/world_checkpoint.cpp 2012-03-25 16:05:38 EDT (Sun, 25 Mar 2012)
@@ -7,7 +7,9 @@
 // Home at http://www.boost.org/libs/scope_exit
 
 #include <boost/config.hpp>
-#ifndef BOOST_NO_VARIADIC_MACROS
+#ifdef BOOST_NO_VARIADIC_MACROS
+# error "variadic macros required"
+#else
 
 #include <boost/scope_exit.hpp>
 #include <boost/foreach.hpp>
@@ -105,9 +107,5 @@
     BOOST_CHECK(oss.str() == "world(3, { person(1, 2), person(2, 2), })");
 }
 
-#else
-
-int main(void) { return 0; } // Trivial test.
-
-#endif
+#endif // variadic macros
 

Modified: trunk/libs/scope_exit/test/world_checkpoint_all.cpp
==============================================================================
--- trunk/libs/scope_exit/test/world_checkpoint_all.cpp (original)
+++ trunk/libs/scope_exit/test/world_checkpoint_all.cpp 2012-03-25 16:05:38 EDT (Sun, 25 Mar 2012)
@@ -7,7 +7,11 @@
 // Home at http://www.boost.org/libs/scope_exit
 
 #include <boost/config.hpp>
-#if !defined(BOOST_NO_LAMBDAS) && !defined(BOOST_NO_VARIADIC_MACROS)
+#if defined(BOOST_NO_LAMBDAS)
+# error "lambda functions required"
+#elif defined(BOOST_NO_VARIADIC_MACROS)
+# error "variadic macros required"
+#else
 
 #include <boost/scope_exit.hpp>
 #include <boost/foreach.hpp>
@@ -105,9 +109,5 @@
     BOOST_CHECK(oss.str() == "world(3, { person(1, 2), person(2, 2), })");
 }
 
-#else
-
-int main(void) { return 0; } // Trivial test.
-
-#endif
+#endif // lambda functions and variadic macros
 

Added: trunk/libs/scope_exit/test/world_checkpoint_all_nova.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/scope_exit/test/world_checkpoint_all_nova.cpp 2012-03-25 16:05:38 EDT (Sun, 25 Mar 2012)
@@ -0,0 +1,10 @@
+
+// Copyright (C) 2012 Lorenzo Caminiti
+// Distributed under the Boost Software License, Version 1.0
+// (see accompanying file LICENSE_1_0.txt or a copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// Home at http://www.boost.org/libs/scope_exit
+
+#include "nova.hpp"
+#include "world_checkpoint_all_seq.cpp"
+

Modified: trunk/libs/scope_exit/test/world_checkpoint_all_seq.cpp
==============================================================================
--- trunk/libs/scope_exit/test/world_checkpoint_all_seq.cpp (original)
+++ trunk/libs/scope_exit/test/world_checkpoint_all_seq.cpp 2012-03-25 16:05:38 EDT (Sun, 25 Mar 2012)
@@ -7,7 +7,9 @@
 // Home at http://www.boost.org/libs/scope_exit
 
 #include <boost/config.hpp>
-#ifndef BOOST_NO_LAMBDAS
+#ifdef BOOST_NO_LAMBDAS
+# error "lambda functions required"
+#else
 
 #include <boost/scope_exit.hpp>
 #include <boost/foreach.hpp>
@@ -103,9 +105,5 @@
     BOOST_CHECK(oss.str() == "world(3, { person(1, 2), person(2, 2), })");
 }
 
-#else
-
-int main(void) { return 0; } // Trivial test.
-
-#endif
+#endif // variadic macros
 

Added: trunk/libs/scope_exit/test/world_checkpoint_all_seq_nova.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/scope_exit/test/world_checkpoint_all_seq_nova.cpp 2012-03-25 16:05:38 EDT (Sun, 25 Mar 2012)
@@ -0,0 +1,10 @@
+
+// Copyright (C) 2012 Lorenzo Caminiti
+// Distributed under the Boost Software License, Version 1.0
+// (see accompanying file LICENSE_1_0.txt or a copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// Home at http://www.boost.org/libs/scope_exit
+
+#include "nova.hpp"
+#include "world_seq.cpp"
+

Added: trunk/libs/scope_exit/test/world_checkpoint_seq_nova.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/scope_exit/test/world_checkpoint_seq_nova.cpp 2012-03-25 16:05:38 EDT (Sun, 25 Mar 2012)
@@ -0,0 +1,10 @@
+
+// Copyright (C) 2012 Lorenzo Caminiti
+// Distributed under the Boost Software License, Version 1.0
+// (see accompanying file LICENSE_1_0.txt or a copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// Home at http://www.boost.org/libs/scope_exit
+
+#include "nova.hpp"
+#include "world_checkpoint_seq.cpp"
+

Deleted: trunk/libs/scope_exit/test/world_lambda.cpp
==============================================================================
--- trunk/libs/scope_exit/test/world_lambda.cpp 2012-03-25 16:05:38 EDT (Sun, 25 Mar 2012)
+++ (empty file)
@@ -1,59 +0,0 @@
-
-// Copyright (C) 2006-2009, 2012 Alexander Nasonov
-// Copyright (C) 2012 Lorenzo Caminiti
-// Distributed under the Boost Software License, Version 1.0
-// (see accompanying file LICENSE_1_0.txt or a copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-// Home at http://www.boost.org/libs/scope_exit
-
-#include <boost/config.hpp>
-#ifndef BOOST_NO_LAMBDAS
-
-#define BOOST_TEST_MODULE TestWorldLambda
-#include <boost/test/unit_test.hpp>
-#include <vector>
-
-struct person {};
-
-struct world {
- void add_person(person const& a_person);
- std::vector<person> persons_;
-};
-
-//[world_lambda
-#include <functional>
-
-struct scope_exit {
- scope_exit(std::function<void (void)> f) : f_(f) {}
- ~scope_exit(void) { f_(); }
-private:
- std::function<void (void)> f_;
-};
-
-void world::add_person(person const& a_person) {
- bool commit = false;
-
- persons_.push_back(a_person);
- scope_exit on_exit1([&commit, this](void) { // Use C++11 lambda.
- if(!commit) persons_.pop_back(); // `persons_` via captured `this`.
- });
-
- // ...
-
- commit = true;
-}
-//]
-
-BOOST_AUTO_TEST_CASE( test_world_lambda ) {
- world w;
- person p;
- w.add_person(p);
- BOOST_CHECK( w.persons_.size() == 1 );
-}
-
-#else
-
-int main(void) { return 0; } // Trivial test.
-
-#endif
-

Added: trunk/libs/scope_exit/test/world_seq_nova.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/scope_exit/test/world_seq_nova.cpp 2012-03-25 16:05:38 EDT (Sun, 25 Mar 2012)
@@ -0,0 +1,10 @@
+
+// Copyright (C) 2012 Lorenzo Caminiti
+// Distributed under the Boost Software License, Version 1.0
+// (see accompanying file LICENSE_1_0.txt or a copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// Home at http://www.boost.org/libs/scope_exit
+
+#include "nova.hpp"
+#include "world_seq.cpp"
+

Modified: trunk/libs/scope_exit/test/world_this.cpp
==============================================================================
--- trunk/libs/scope_exit/test/world_this.cpp (original)
+++ trunk/libs/scope_exit/test/world_this.cpp 2012-03-25 16:05:38 EDT (Sun, 25 Mar 2012)
@@ -7,7 +7,9 @@
 // Home at http://www.boost.org/libs/scope_exit
 
 #include <boost/config.hpp>
-#ifndef BOOST_NO_VARIADIC_MACROS
+#ifdef BOOST_NO_VARIADIC_MACROS
+# error "variadic macros required"
+#else
 
 #include <boost/scope_exit.hpp>
 #include <boost/typeof/typeof.hpp>
@@ -52,9 +54,5 @@
     BOOST_CHECK(w.population() == 1);
 }
 
-#else
-
-int main(void) { return 0; } // Trivial test.
-
-#endif
+#endif // variadic macros
 

Added: trunk/libs/scope_exit/test/world_this_seq_nova.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/scope_exit/test/world_this_seq_nova.cpp 2012-03-25 16:05:38 EDT (Sun, 25 Mar 2012)
@@ -0,0 +1,10 @@
+
+// Copyright (C) 2012 Lorenzo Caminiti
+// Distributed under the Boost Software License, Version 1.0
+// (see accompanying file LICENSE_1_0.txt or a copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// Home at http://www.boost.org/libs/scope_exit
+
+#include "nova.hpp"
+#include "world_this_seq.cpp"
+

Modified: trunk/libs/scope_exit/test/world_tpl.cpp
==============================================================================
--- trunk/libs/scope_exit/test/world_tpl.cpp (original)
+++ trunk/libs/scope_exit/test/world_tpl.cpp 2012-03-25 16:05:38 EDT (Sun, 25 Mar 2012)
@@ -7,7 +7,9 @@
 // Home at http://www.boost.org/libs/scope_exit
 
 #include <boost/config.hpp>
-#ifndef BOOST_NO_VARIADIC_MACROS
+#ifdef BOOST_NO_VARIADIC_MACROS
+# error "variadic macro required"
+#else
 
 #include <boost/scope_exit.hpp>
 #include <boost/typeof/typeof.hpp>
@@ -53,9 +55,5 @@
     BOOST_CHECK(w.population() == 1);
 }
 
-#else
-
-int main(void) { return 0; } // Trivial test.
-
-#endif
+#endif // variadic macros
 

Added: trunk/libs/scope_exit/test/world_tpl_seq_nova.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/scope_exit/test/world_tpl_seq_nova.cpp 2012-03-25 16:05:38 EDT (Sun, 25 Mar 2012)
@@ -0,0 +1,10 @@
+
+// Copyright (C) 2012 Lorenzo Caminiti
+// Distributed under the Boost Software License, Version 1.0
+// (see accompanying file LICENSE_1_0.txt or a copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// Home at http://www.boost.org/libs/scope_exit
+
+#include "nova.hpp"
+#include "world_tpl_seq.cpp"
+

Modified: trunk/libs/scope_exit/test/world_void.cpp
==============================================================================
--- trunk/libs/scope_exit/test/world_void.cpp (original)
+++ trunk/libs/scope_exit/test/world_void.cpp 2012-03-25 16:05:38 EDT (Sun, 25 Mar 2012)
@@ -41,6 +41,6 @@
 BOOST_AUTO_TEST_CASE( test_world_void ) {
     person p;
     add_person(p);
- BOOST_CHECK( world.persons.size() == 1 );
+ BOOST_CHECK(world.persons.size() == 1);
 }
 


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