Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r63568 - trunk/libs/asio/example/http/server4
From: chris_at_[hidden]
Date: 2010-07-04 02:49:20


Author: chris_kohlhoff
Date: 2010-07-04 02:49:18 EDT (Sun, 04 Jul 2010)
New Revision: 63568
URL: http://svn.boost.org/trac/boost/changeset/63568

Log:
Fix coroutine macros to work with MSVC's edit-and-continue debug settings.

Text files modified:
   trunk/libs/asio/example/http/server4/coroutine.hpp | 22 +++++++++++++++-------
   1 files changed, 15 insertions(+), 7 deletions(-)

Modified: trunk/libs/asio/example/http/server4/coroutine.hpp
==============================================================================
--- trunk/libs/asio/example/http/server4/coroutine.hpp (original)
+++ trunk/libs/asio/example/http/server4/coroutine.hpp 2010-07-04 02:49:18 EDT (Sun, 04 Jul 2010)
@@ -50,11 +50,11 @@
     } \
     else case 0:
 
-#define CORO_YIELD \
- for (_coro_value = __LINE__;;) \
+#define CORO_YIELD_IMPL(n) \
+ for (_coro_value = (n);;) \
     if (_coro_value == 0) \
     { \
- case __LINE__: ; \
+ case (n): ; \
       break; \
     } \
     else \
@@ -67,13 +67,21 @@
               goto bail_out_of_coroutine; \
             else case 0:
 
-#define CORO_FORK \
- for (_coro_value = -__LINE__;; _coro_value = __LINE__) \
- if (_coro_value == __LINE__) \
+#define CORO_FORK_IMPL(n) \
+ for (_coro_value = -(n);; _coro_value = (n)) \
+ if (_coro_value == (n)) \
     { \
- case -__LINE__: ; \
+ case -(n): ; \
       break; \
     } \
     else
 
+#if defined(_MSC_VER)
+# define CORO_YIELD CORO_YIELD_IMPL(__COUNTER__ + 1)
+# define CORO_FORK CORO_FORK_IMPL(__COUNTER__ + 1)
+#else // defined(_MSC_VER)
+# define CORO_YIELD CORO_YIELD_IMPL(__LINE__)
+# define CORO_FORK CORO_FORK_IMPL(__LINE__)
+#endif // defined(_MSC_VER)
+
 #endif // COROUTINE_HPP


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