UraniumCompute 0.1.0
A GPU accelerated parallel task scheduler
CompilerTraits.h
1#pragma once
2#include <csignal>
3#include <stdexcept>
4
5#if defined NDEBUG
6# define UN_RELEASE 1
7#else
8# define UN_DEBUG 1
9#endif
10
11#define UN_MAKE_STR(txt) #txt
12
14#define UN_UNUSED(expr) (void)(expr)
15
16#if defined __clang__
17# define UN_COMPILER_CLANG 1
18
19# if defined _MSC_VER
20# define UN_COMPILER_MS_CLANG 1
21# endif
22
23# define UN_PUSH_MSVC_WARNING(...)
24# define UN_POP_MSVC_WARNING
25
26# define UN_PUSH_CLANG_WARNING(warn) _Pragma("clang diagnostic push") _Pragma(UN_MAKE_STR(clang diagnostic ignored warn))
27# define UN_POP_CLANG_WARNING _Pragma("clang diagnostic pop")
28
29# define UN_FUNCSIG __PRETTY_FUNCTION__
30
31# ifndef UN_FINLINE
32# define UN_FINLINE inline
33# endif
34#elif defined _MSC_VER || defined DOXYGEN
35# define UN_COMPILER_MSVC 1
36
37# define UN_PUSH_MSVC_WARNING(warn) __pragma(warning(push)) __pragma(warning(disable : warn))
38# define UN_POP_MSVC_WARNING __pragma(warning(pop))
39
40# define UN_PUSH_CLANG_WARNING(...)
41# define UN_POP_CLANG_WARNING
42
44# define UN_FUNCSIG __FUNCSIG__
45
46# ifndef UN_FINLINE
47# define UN_FINLINE __forceinline
48# endif
49#endif
50
51#if UN_COMPILER_MSVC || UN_COMPILER_MS_CLANG || defined DOXYGEN
53# define UN_DebugBreak() __debugbreak()
54#else
55# define UN_DebugBreak() raise(SIGABRT)
56#endif