mirror of
https://git.h3cjp.net/H3cJP/citra.git
synced 2024-11-27 14:33:00 +00:00
Common: Fix SCOPE_EXIT to actually create unique identifiers.
This commit is contained in:
parent
afc416c607
commit
fc11aff955
|
@ -31,6 +31,10 @@ template<> struct CompileTimeAssert<true> {};
|
||||||
|
|
||||||
#define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0]))
|
#define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0]))
|
||||||
|
|
||||||
|
/// Textually concatenates two tokens. The double-expansion is required by the C preprocessor.
|
||||||
|
#define CONCAT2(x, y) DO_CONCAT2(x, y)
|
||||||
|
#define DO_CONCAT2(x, y) x ## y
|
||||||
|
|
||||||
#ifndef _MSC_VER
|
#ifndef _MSC_VER
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
|
@ -4,6 +4,8 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "common/common_funcs.h"
|
||||||
|
|
||||||
namespace detail {
|
namespace detail {
|
||||||
template <typename Func>
|
template <typename Func>
|
||||||
struct ScopeExitHelper {
|
struct ScopeExitHelper {
|
||||||
|
@ -34,4 +36,4 @@ namespace detail {
|
||||||
* }
|
* }
|
||||||
* \endcode
|
* \endcode
|
||||||
*/
|
*/
|
||||||
#define SCOPE_EXIT(body) auto scope_exit_helper_##__LINE__ = detail::ScopeExit([&]() body)
|
#define SCOPE_EXIT(body) auto CONCAT2(scope_exit_helper_, __LINE__) = detail::ScopeExit([&]() body)
|
||||||
|
|
Loading…
Reference in a new issue