From: pius.lee Date: Tue, 10 Feb 2015 03:53:01 +0000 (+0900) Subject: [Common] fix scope exit macro enable to use multiple in a scope. X-Git-Tag: submit/tizen_tv/20150603.064601~1^2~475 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=770afcd2fe07c7588e11dd4549e59670dac9afda;p=platform%2Fcore%2Fapi%2Fwebapi-plugins.git [Common] fix scope exit macro enable to use multiple in a scope. Change-Id: Idd8dd5cb346c485c442211127ee1072b74a60aee Signed-off-by: pius.lee --- diff --git a/src/common/scope_exit.h b/src/common/scope_exit.h index 62353c75..fda1b455 100644 --- a/src/common/scope_exit.h +++ b/src/common/scope_exit.h @@ -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