scope_exit: Add SCOPE_SUCCESS and SCOPE_EXIT

This commit is contained in:
MerryMage
2018-01-28 17:57:02 +00:00
parent bafb39ebc5
commit 64761dbc72
4 changed files with 89 additions and 34 deletions

16
src/common/macro_util.h Normal file
View File

@@ -0,0 +1,16 @@
/* This file is part of the dynarmic project.
* Copyright (c) 2018 MerryMage
* This software may be used and distributed according to the terms of the GNU
* General Public License version 2 or any later version.
*/
#pragma once
#define CONCATENATE_TOKENS(x, y) CONCATENATE_TOKENS_IMPL(x, y)
#define CONCATENATE_TOKENS_IMPL(x, y) x ## y
#ifdef __COUNTER__
#define ANONYMOUS_VARIABLE(str) CONCATENATE_TOKENS(str, __COUNTER__)
#else
#define ANONYMOUS_VARIABLE(str) CONCATENATE_TOKENS(str, __LINE__)
#endif