blob: 16f8ab346c4622ecde0df062177c87c34f3c1756 (
about) (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
/*
* InspIRCd -- Internet Relay Chat Daemon
*
* Copyright (C) 2013, 2022-2023 Sadie Powell <sadie@witchery.services>
* Copyright (C) 2013 Attila Molnar <attilamolnar@hush.com>
*
* This file is part of InspIRCd. InspIRCd is free software: you can
* redistribute it and/or modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation, version 2.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
/**
* @def ATTR_NOT_NULL(...)
* Enables the compile-time checking of arguments that must never be be null. If
* a function is marked with this attribute then the compiler will warnif a null
* pointer is passed to any of the specified arguments.
*/
#if defined __GNUC__
# define ATTR_NOT_NULL(...) __attribute__((nonnull(__VA_ARGS__)))
#else
# define ATTR_NOT_NULL(...)
#endif
/** Allows using C++20 format on compatible compilers and falling back to {fmt}
* if a C++20 implementation is not available.
*/
#if defined __cpp_lib_format && __cpp_lib_format >= 202106L
# include <format>
# define FMT std
# define FMT_PTR(PTR) static_cast<void*>(PTR)
template<typename T> concept fmt_formattable = std::default_initializable<std::formatter<std::remove_cvref_t<T>>>;
#else
# include <fmt/format.h>
# define FMT fmt
# define FMT_PTR(PTR) fmt::ptr(PTR)
template<typename T> concept fmt_formattable = fmt::formattable<T>;
#endif
/**
* Windows is very different to UNIX so we have to wrap certain features in
* order to build on Windows correctly.
*/
#ifdef _WIN32
# include "win32wrapper.h"
# ifdef INSPIRCD_CORE
# define CoreExport __declspec(dllexport)
# define DllExport __declspec(dllimport)
# else
# define CoreExport __declspec(dllimport)
# define DllExport __declspec(dllexport)
# endif
#else
# define DllExport __attribute__ ((visibility ("default")))
# define CoreExport __attribute__ ((visibility ("default")))
#endif
|