Plasma Engine  2.0
Loading...
Searching...
No Matches
Clang.h
1#pragma once
2
3#ifdef __clang__
4
5# undef PL_COMPILER_CLANG
6# define PL_COMPILER_CLANG PL_ON
7
8# define PL_ALWAYS_INLINE __attribute__((always_inline)) inline
9# if PL_ENABLED(PL_COMPILE_FOR_DEBUG)
10# define PL_FORCE_INLINE inline
11# else
12# define PL_FORCE_INLINE __attribute__((always_inline)) inline
13# endif
14
15# define PL_ALIGNMENT_OF(type) PL_COMPILE_TIME_MAX(__alignof(type), PL_ALIGNMENT_MINIMUM)
16
17# if __has_builtin(__builtin_debugtrap)
18# define PL_DEBUG_BREAK \
19 { \
20 __builtin_debugtrap(); \
21 }
22# elif __has_builtin(__debugbreak)
23# define PL_DEBUG_BREAK \
24 { \
25 __debugbreak(); \
26 }
27# else
28# include <signal.h>
29# if defined(SIGTRAP)
30# define PL_DEBUG_BREAK \
31 { \
32 raise(SIGTRAP); \
33 }
34# else
35# define PL_DEBUG_BREAK \
36 { \
37 raise(SIGABRT); \
38 }
39# endif
40# endif
41
42# define PL_SOURCE_FUNCTION __PRETTY_FUNCTION__
43# define PL_SOURCE_LINE __LINE__
44# define PL_SOURCE_FILE __FILE__
45
46# ifdef BUILDSYSTEM_BUILDTYPE_Debug
47# undef PL_COMPILE_FOR_DEBUG
48# define PL_COMPILE_FOR_DEBUG PL_ON
49# endif
50
51# define PL_WARNING_PUSH() _Pragma("clang diagnostic push")
52# define PL_WARNING_POP() _Pragma("clang diagnostic pop")
53# define PL_WARNING_DISABLE_CLANG(_x) _Pragma(PL_PP_STRINGIFY(clang diagnostic ignored _x))
54
55# define PL_DECL_EXPORT [[gnu::visibility("default")]]
56# define PL_DECL_IMPORT [[gnu::visibility("default")]]
57# define PL_DECL_EXPORT_FRIEND
58# define PL_DECL_IMPORT_FRIEND
59
60#else
61
62# define PL_WARNING_DISABLE_CLANG(_x)
63
64#endif