MCRO
C++23 utilities for Unreal Engine.
Loading...
Searching...
No Matches
Start.h
Go to the documentation of this file.
1/** @noop License Comment
2 * @file
3 * @copyright
4 * This Source Code is subject to the terms of the Mozilla Public License, v2.0.
5 * If a copy of the MPL was not distributed with this file You can obtain one at
6 * https://mozilla.org/MPL/2.0/
7 *
8 * @author David Mórász
9 * @date 2025
10 */
11
12#include "Mcro/Macros.h"
13
14#ifdef NON_UNREAL_INCLUDE_REGION
15#error Third-party library or non-unreal include regions cannot be nested, one region is already opened before
16#endif
17#define NON_UNREAL_INCLUDE_REGION 1
18
19#if PLATFORM_WINDOWS
20#include "Windows/AllowWindowsPlatformTypes.h"
21#include "Windows/AllowWindowsPlatformAtomics.h"
22#endif
23
24#pragma warning( push )
25#pragma warning( disable : 4005 5205 4265 4268 4946 4103 )
26
27// temporarily undefine simplistic Unreal macros third-party libraries might also use
28
29#pragma push_macro("TEXT")
30#pragma push_macro("TRUE")
31#pragma push_macro("FALSE")
32#pragma push_macro("MAX_uint8")
33#pragma push_macro("MAX_uint16")
34#pragma push_macro("MAX_uint32")
35#pragma push_macro("MAX_int32")
36#pragma push_macro("CONSTEXPR")
37#pragma push_macro("PI")
38#pragma push_macro("dynamic_cast")
39#pragma push_macro("VARARGS")
40#pragma push_macro("CDECL")
41#pragma push_macro("STDCALL")
42#pragma push_macro("FORCEINLINE")
43#pragma push_macro("FORCENOINLINE")
44#pragma push_macro("ABSTRACT")
45#pragma push_macro("LINE_TERMINATOR")
46#pragma push_macro("LINE_TERMINATOR_ANSI")
47#pragma push_macro("DLLEXPORT")
48#pragma push_macro("DLLIMPORT")
49#pragma push_macro("LIKELY")
50#pragma push_macro("UNLIKELY")
51#pragma push_macro("RESTRICT")
52#pragma push_macro("MOBILE")
53#pragma push_macro("CONSOLE")
54#pragma push_macro("PLATFORM_WINDOWS")
55#pragma push_macro("PLATFORM_COMPILER_CLANG")
56#pragma push_macro("PLATFORM_APPLE")
57#pragma push_macro("PLATFORM_MAC")
58#pragma push_macro("PLATFORM_LINUX")
59#pragma push_macro("PLATFORM_FREEBSD")
60#pragma push_macro("PLATFORM_UNIX")
61#pragma push_macro("DEFAULTS")
62
63#undef TEXT
64#undef CONSTEXPR
65#undef PI
66#undef dynamic_cast
67#undef VARARGS
68#undef CDECL
69#undef STDCALL
70#undef FORCEINLINE
71#undef FORCENOINLINE
72#undef ABSTRACT
73#undef LINE_TERMINATOR
74#undef LINE_TERMINATOR_ANSI
75#undef DLLEXPORT
76#undef DLLIMPORT
77#undef LIKELY
78#undef UNLIKELY
79#undef RESTRICT
80#undef MOBILE
81#undef CONSOLE
82#undef PLATFORM_WINDOWS
83#undef PLATFORM_COMPILER_CLANG
84#undef PLATFORM_APPLE
85#undef PLATFORM_MAC
86#undef PLATFORM_LINUX
87#undef PLATFORM_FREEBSD
88#undef PLATFORM_UNIX
89#undef DEFAULTS
90
91#if DO_CHECK
92#define NUIR_DO_CHECK 1
93
94#pragma push_macro("DO_CHECK")
95#pragma push_macro("checkCode")
96#pragma push_macro("check")
97#pragma push_macro("checkf")
98#pragma push_macro("verify")
99#pragma push_macro("verifyf")
100#pragma push_macro("unimplemented")
101#pragma push_macro("ensure")
102
103#undef DO_CHECK
104#undef checkCode
105#undef check
106#undef checkf
107#undef verify
108#undef verifyf
109#undef unimplemented
110#undef ensure
111
112#endif
113
114// Unreal might use combination of compiler specific macros, which third-party libraries might not
115// tolerate well. Sanitizing such macros here:
116
117// prefer MSVC compiler macros over GCC if they're both present for some god forsaken reason
118#if defined(_MSC_VER) && defined(__GNUC__)
119
120#if _MSC_VER > 0
121#pragma message ("Non-Unreal include region: _MSC_VER - __GNUC__ macro collision detected, temporarily undefining __GNUC__ (GCC: " MCRO_STRIFY(__GNUC__) ", MSVC: " MCRO_STRIFY(_MSC_VER) ")")
122#define NUIR_MSVC_GNUC_AVOIDANCE __GNUC__
123#pragma push_macro("__GNUC__")
124#undef __GNUC__
125#endif
126
127#endif
128
129THIRD_PARTY_INCLUDES_START
130PRAGMA_PUSH_PLATFORM_DEFAULT_PACKING