[Common] fix scope exit macro enable to use multiple in a scope.
authorpius.lee <pius.lee@samsung.com>
Tue, 10 Feb 2015 03:53:01 +0000 (12:53 +0900)
committerpius.lee <pius.lee@samsung.com>
Tue, 10 Feb 2015 03:58:10 +0000 (12:58 +0900)
Change-Id: Idd8dd5cb346c485c442211127ee1072b74a60aee
Signed-off-by: pius.lee <pius.lee@samsung.com>
src/common/scope_exit.h

index 62353c754f8c7ff8538df18ebbd43ef172d6a14c..fda1b455d95024ae2c53669cd52ab6532f9348fa 100644 (file)
@@ -106,8 +106,10 @@ operator+(__dummy, F&& f)
  *     // do 3rd operation with unit and possibly quit function
  *   }
  */
+#define _SYNTAX_CONCAT(A, B) A ## B
+#define SYNTAX_CONCAT(A, B) _SYNTAX_CONCAT(A, B)
 #define SCOPE_EXIT \
-    auto SCOPE_EXIT_##__LINE__ = ::common::__dummy{} + [&]() noexcept
+    auto SYNTAX_CONCAT(SCOPE_EXIT_, __LINE__) = ::common::__dummy{} + [&]()
 
 }  // namespace common