diff options
author | rtk0c <[email protected]> | 2022-05-24 21:47:55 -0700 |
---|---|---|
committer | rtk0c <[email protected]> | 2022-05-24 21:47:55 -0700 |
commit | d18a28a9659092952aef70a30a47726e7c16d31a (patch) | |
tree | b1d6304e631961a797225912ed1ef7ee55864f86 /source-common/Macros.hpp | |
parent | 123f741e3f5374b93ac39887b62bfa0d66762ae2 (diff) |
Changeset: 38 Branch comment: [] Add infrastructure for codegen
Diffstat (limited to 'source-common/Macros.hpp')
-rw-r--r-- | source-common/Macros.hpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/source-common/Macros.hpp b/source-common/Macros.hpp new file mode 100644 index 0000000..b5d05fa --- /dev/null +++ b/source-common/Macros.hpp @@ -0,0 +1,29 @@ +#pragma once + +#define STRINGIFY_IMPL(text) #text +#define STRINGIFY(text) STRINGIFY_IMPL(text) + +#define CONCAT_IMPL(a, b) a##b +#define CONCAT(a, b) CONCAT_IMPL(a, b) +#define CONCAT_3(a, b, c) CONCAT(a, CONCAT(b, c)) +#define CONCAT_4(a, b, c, d) CONCAT(CONCAT(a, b), CONCAT(c, d)) + +#define UNIQUE_NAME(prefix) CONCAT(prefix, __COUNTER__) +#define UNIQUE_NAME_LINE(prefix) CONCAT(prefix, __LINE__) +#define DISCARD UNIQUE_NAME(_discard) + +#define UNUSED(x) (void)x; + +#if defined(_MSC_VER) +# define UNREACHABLE __assume(0) +#elif defined(__GNUC__) || defined(__clang__) +# define UNREACHABLE __builtin_unreachable() +#else +# define UNREACHABLE +#endif + +#if _WIN32 +# define PLATFORM_PATH_STR "%ls" +#else +# define PLATFORM_PATH_STR "%s" +#endif |