summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorYuri Kunde Schlesner <yuriks@yuriks.net>2015-01-11 16:32:31 +0100
committerYuri Kunde Schlesner <yuriks@yuriks.net>2015-01-30 14:47:03 +0100
commitfc11aff9559da4725037c21f7a4732f5f009d975 (patch)
treef1034c4fd029f4e4867fe2b5b15352f87dbbd9b7 /src
parentAdditions to ResultVal to make it more convenient to use. (diff)
downloadyuzu-fc11aff9559da4725037c21f7a4732f5f009d975.tar
yuzu-fc11aff9559da4725037c21f7a4732f5f009d975.tar.gz
yuzu-fc11aff9559da4725037c21f7a4732f5f009d975.tar.bz2
yuzu-fc11aff9559da4725037c21f7a4732f5f009d975.tar.lz
yuzu-fc11aff9559da4725037c21f7a4732f5f009d975.tar.xz
yuzu-fc11aff9559da4725037c21f7a4732f5f009d975.tar.zst
yuzu-fc11aff9559da4725037c21f7a4732f5f009d975.zip
Diffstat (limited to 'src')
-rw-r--r--src/common/common_funcs.h4
-rw-r--r--src/common/scope_exit.h4
2 files changed, 7 insertions, 1 deletions
diff --git a/src/common/common_funcs.h b/src/common/common_funcs.h
index c2750a63c..229eb74c9 100644
--- a/src/common/common_funcs.h
+++ b/src/common/common_funcs.h
@@ -31,6 +31,10 @@ template<> struct CompileTimeAssert<true> {};
#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
#include <errno.h>
diff --git a/src/common/scope_exit.h b/src/common/scope_exit.h
index 263beaf0e..77dcbaa22 100644
--- a/src/common/scope_exit.h
+++ b/src/common/scope_exit.h
@@ -4,6 +4,8 @@
#pragma once
+#include "common/common_funcs.h"
+
namespace detail {
template <typename Func>
struct ScopeExitHelper {
@@ -34,4 +36,4 @@ namespace detail {
* }
* \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)