From f43972d665c95b2148636c86a5b648e719901101 Mon Sep 17 00:00:00 2001 From: B Stack Date: Sun, 12 May 2019 16:34:13 -0400 Subject: 10.12 --- zen/scope_guard.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'zen/scope_guard.h') diff --git a/zen/scope_guard.h b/zen/scope_guard.h index 9eff6c1f..3a79d841 100644 --- a/zen/scope_guard.h +++ b/zen/scope_guard.h @@ -38,7 +38,7 @@ enum class ScopeGuardRunMode //partially specialize scope guard destructor code and get rid of those pesky MSVC "4127 conditional expression is constant" template inline -void runScopeGuardDestructor(F& fun, int /*exeptionCountOld*/, std::integral_constant) +void runScopeGuardDestructor(F& fun, int /*exeptionCountOld*/, std::integral_constant) noexcept { try { fun(); } catch (...) { assert(false); } //consistency: don't expect exceptions for ON_EXIT even if "!failed"! @@ -55,7 +55,7 @@ void runScopeGuardDestructor(F& fun, int exeptionCountOld, std::integral_constan template inline -void runScopeGuardDestructor(F& fun, int exeptionCountOld, std::integral_constant) +void runScopeGuardDestructor(F& fun, int exeptionCountOld, std::integral_constant) noexcept { const bool failed = std::uncaught_exceptions() > exeptionCountOld; if (failed) @@ -104,8 +104,8 @@ auto makeGuard(F&& fun) { return ScopeGuard>(std::forwa #define ZEN_CHECK_CASE_FOR_CONSTANT_IMPL(X) L ## X -#define ZEN_ON_SCOPE_EXIT(X) auto ZEN_CONCAT(scopeGuard, __LINE__) = zen::makeGuard([&]{ X; }); (void)ZEN_CONCAT(scopeGuard, __LINE__); -#define ZEN_ON_SCOPE_FAIL(X) auto ZEN_CONCAT(scopeGuard, __LINE__) = zen::makeGuard([&]{ X; }); (void)ZEN_CONCAT(scopeGuard, __LINE__); -#define ZEN_ON_SCOPE_SUCCESS(X) auto ZEN_CONCAT(scopeGuard, __LINE__) = zen::makeGuard([&]{ X; }); (void)ZEN_CONCAT(scopeGuard, __LINE__); +#define ZEN_ON_SCOPE_EXIT(X) [[maybe_unused]] auto ZEN_CONCAT(scopeGuard, __LINE__) = zen::makeGuard([&]{ X; }); +#define ZEN_ON_SCOPE_FAIL(X) [[maybe_unused]] auto ZEN_CONCAT(scopeGuard, __LINE__) = zen::makeGuard([&]{ X; }); +#define ZEN_ON_SCOPE_SUCCESS(X) [[maybe_unused]] auto ZEN_CONCAT(scopeGuard, __LINE__) = zen::makeGuard([&]{ X; }); #endif //SCOPE_GUARD_H_8971632487321434 -- cgit