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