AsmGrader 0.0.0
Loading...
Searching...
No Matches
macros.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <asmgrader/exceptions.hpp> // IWYU pragma: export
4
5#define CONCAT_IMPL(a, b) a##b
6#define CONCAT(a, b) CONCAT_IMPL(a, b)
7
8#define STRINGIFY_IMPL(a) #a
9#define STRINGIFY(a) STRINGIFY_IMPL(a)
10
11#define TRY_OR_THROW(expr, ...) \
12 __extension__({ \
13 const auto& res__ref = (expr); \
14 if (!res__ref) { \
15 throw ContextInternalError{res__ref.error() __VA_OPT__(, ) __VA_ARGS__}; \
16 } \
17 res__ref.value(); \
18 });