qxLib
include
qx
macros
common.inl
Go to the documentation of this file.
1
/**
2
3
@file common.inl
4
@author Khrapov
5
@date 19.09.2025
6
@copyright © Nick Khrapov, 2025. All right reserved.
7
8
**/
9
10
namespace
qx::details
11
{
12
13
constexpr
const
char_type* last_slash(
const
char_type* str)
14
{
15
const
char_type* pszLastSlash = str;
16
while
(str && *str != QXT(
'\0'
))
17
{
18
if
(*str == QXT(
'\\'
) || *str == QXT(
'/'
))
19
pszLastSlash = str;
20
21
++str;
22
}
23
return
pszLastSlash + 1;
24
}
25
26
template
<
class
lambda_t>
27
class
call_before_main_invoker
28
{
29
public
:
30
constexpr
call_before_main_invoker
(lambda_t lambda) : m_Lambda(std::move(lambda))
31
{
32
m_Lambda();
33
}
34
35
private
:
36
lambda_t m_Lambda;
37
};
38
39
}
// namespace qx::details
40
41
#define _QX_DO_JOIN(symbol1, symbol2) symbol1##symbol2
42
43
#if !QX_RELEASE && QX_MSVC
44
#define _QX_DISABLE_OPTIMIZATIONS() __pragma(optimize(""
, off))
45
#define _QX_ENABLE_OPTIMIZATIONS() __pragma(optimize(""
, on))
46
#else
47
#define _QX_DISABLE_OPTIMIZATIONS()
48
#define _QX_ENABLE_OPTIMIZATIONS()
49
#endif
50
51
#if !QX_DEBUG && QX_MSVC
52
#define _QX_FORCE_INLINE __forceinline
53
#elif !QX_DEBUG && (QX_GNU || QX_CLANG || QX_APPLE_CLANG)
54
#define _QX_FORCE_INLINE inline __attribute__((always_inline))
55
#else
56
#define _QX_FORCE_INLINE inline
57
#endif
58
59
// clang-format off
60
#define _QX_PRIVATE_APPEND_VA_ARG_COUNT(prefix, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20, a21, a22, a23, a24, a25, a26, a27, a28, a29, a30, a31, a32, count, ...) prefix##count
61
62
#if !defined(_MSVC_TRADITIONAL) || !_MSVC_TRADITIONAL
63
#define _QX_APPEND_VA_ARG_COUNT(prefix, ...) _QX_PRIVATE_APPEND_VA_ARG_COUNT(prefix, ##__VA_ARGS__, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0)
64
#else
65
#define _QX_APPEND_VA_ARG_COUNT_INVOKE(macro, args_in_parens) QX_EXPAND(macro##args_in_parens)
66
#define _QX_APPEND_VA_ARG_COUNT(prefix, ...) _QX_APPEND_VA_ARG_COUNT_INVOKE(_QX_PRIVATE_APPEND_VA_ARG_COUNT, (prefix, ##__VA_ARGS__, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0))
67
#endif
68
// clang-format on
qx::details::call_before_main_invoker
Definition:
common.inl:28
Generated by
1.9.1