mirror of
https://github.com/matrix-construct/construct
synced 2024-12-26 15:33:54 +01:00
ircd: Consolidate stdinc.h and ircd.h and fix precompiled headers.
This commit is contained in:
parent
383f97cdb7
commit
9601dac9cc
7 changed files with 239 additions and 257 deletions
2
include/ircd/.gitignore
vendored
2
include/ircd/.gitignore
vendored
|
@ -1,5 +1,5 @@
|
|||
setup.h*
|
||||
serno.h
|
||||
stdinc.pic*
|
||||
ircd.pic*
|
||||
config.h
|
||||
config.h.in
|
||||
|
|
|
@ -24,19 +24,19 @@ endif
|
|||
|
||||
if BUILD_PCH
|
||||
BUILT_SOURCES = \
|
||||
stdinc.h.gch \
|
||||
stdinc.pic.h.gch \
|
||||
ircd.h.gch \
|
||||
ircd.pic.h.gch \
|
||||
###
|
||||
endif
|
||||
|
||||
stdinc.h.gch:
|
||||
$(CXX) $(CXXFLAGS) $(AM_CXXFLAGS) -o stdinc.h.gch $(DEFS) $(CPPFLAGS) $(AM_CPPFLAGS) stdinc.h
|
||||
ircd.h.gch:
|
||||
$(CXX) $(CXXFLAGS) $(AM_CXXFLAGS) -o ircd.h.gch $(DEFS) $(CPPFLAGS) $(AM_CPPFLAGS) ircd.h
|
||||
|
||||
stdinc.pic.h.gch:
|
||||
cp stdinc.h stdinc.pic.h
|
||||
$(CXX) $(CXXFLAGS) $(AM_CXXFLAGS) -fPIC -o stdinc.pic.h.gch $(DEFS) $(CPPFLAGS) $(AM_CPPFLAGS) stdinc.pic.h
|
||||
ircd.pic.h.gch:
|
||||
cp ircd.h ircd.pic.h
|
||||
$(CXX) $(CXXFLAGS) $(AM_CXXFLAGS) -fPIC -o ircd.pic.h.gch $(DEFS) $(CPPFLAGS) $(AM_CPPFLAGS) ircd.pic.h
|
||||
|
||||
clean-local:
|
||||
rm -f stdinc.h.gch
|
||||
rm -f stdinc.pic.h
|
||||
rm -f stdinc.pic.h.gch
|
||||
rm -f ircd.h.gch
|
||||
rm -f ircd.pic.h
|
||||
rm -f ircd.pic.h.gch
|
||||
|
|
|
@ -27,10 +27,10 @@ involves the standard library and most of libircd. This is what an embedder
|
|||
will be working with. These headers will expose our own interfaces wrapping
|
||||
3rd party dependencies which are not included there.
|
||||
|
||||
There are actually two files in play here: `<ircd/stdinc.h>` and `<ircd/ircd.h>`.
|
||||
We have to offer two different pre-compilations: one with `-fPIC`
|
||||
and one without. Therefor the contents are in `<ircd/stdinc.h>` and the
|
||||
preprocessor determination for which is in `<ircd/ircd.h>`.
|
||||
There are actually two files in play here: `<ircd/ircd.h>` and
|
||||
`<ircd/ircd.pic.h>`. The latter is generated dynamically and will not
|
||||
exist until `make` creates it. We have to offer two different
|
||||
pre-compilations: one with `-fPIC` and one without.
|
||||
|
||||
- Boost ASIO include group `<ircd/asio.h>` is a header group exposing the
|
||||
boost::asio library. We only involve this header in compilation units working
|
||||
|
|
|
@ -8,15 +8,231 @@
|
|||
// copyright notice and this permission notice is present in all copies. The
|
||||
// full license for this software is available in the LICENSE file.
|
||||
|
||||
#pragma once
|
||||
#define HAVE_IRCD_H
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Standard includes
|
||||
//
|
||||
// This header includes almost everything we use out of the standard library.
|
||||
// This is a pre-compiled header. Project build time is significantly reduced
|
||||
// by doing things this way and C++ std headers have very little namespace
|
||||
// pollution and risk of conflicts.
|
||||
//
|
||||
// * If any project header file requires standard library symbols we try to
|
||||
// list it here, not in our header files.
|
||||
//
|
||||
// * Rare one-off's #includes isolated to a specific .cc file may not always be
|
||||
// listed here but can be.
|
||||
//
|
||||
// * Third party / dependency / non-std includes, are NEVER listed here.
|
||||
// Instead we include those in .cc files, and use forward declarations if
|
||||
// we require a symbol in our API to them.
|
||||
//
|
||||
|
||||
#if defined(PIC) && defined(PCH)
|
||||
#include "stdinc.pic.h"
|
||||
#else
|
||||
#include "stdinc.h"
|
||||
#define HAVE_IRCD_IRCD_H
|
||||
|
||||
// Generated by ./configure
|
||||
#include "config.h"
|
||||
|
||||
extern "C"
|
||||
{
|
||||
#include <RB_INC_ASSERT_H
|
||||
#include <RB_INC_STDARG_H
|
||||
#include <RB_INC_SYS_TIME_H
|
||||
#include <RB_INC_SYS_UTSNAME_H
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
#define WIN32_LEAN_AND_MEAN 1
|
||||
#include <RB_INC_WINDOWS_H
|
||||
#include <RB_INC_WINSOCK2_H
|
||||
#include <RB_INC_WS2TCPIP_H
|
||||
#include <RB_INC_IPHLPAPI_H
|
||||
#endif
|
||||
|
||||
#include <RB_INC_CSTDDEF
|
||||
#include <RB_INC_CSTDINT
|
||||
#include <RB_INC_LIMITS
|
||||
#include <RB_INC_TYPE_TRAITS
|
||||
#include <RB_INC_TYPEINDEX
|
||||
#include <RB_INC_VARIANT
|
||||
#include <RB_INC_CERRNO
|
||||
#include <RB_INC_UTILITY
|
||||
#include <RB_INC_FUNCTIONAL
|
||||
#include <RB_INC_ALGORITHM
|
||||
#include <RB_INC_NUMERIC
|
||||
#include <RB_INC_CMATH
|
||||
#include <RB_INC_MEMORY
|
||||
#include <RB_INC_EXCEPTION
|
||||
#include <RB_INC_SYSTEM_ERROR
|
||||
#include <RB_INC_ARRAY
|
||||
#include <RB_INC_VECTOR
|
||||
#include <RB_INC_STACK
|
||||
#include <RB_INC_STRING
|
||||
#include <RB_INC_CSTRING
|
||||
#include <RB_INC_STRING_VIEW
|
||||
#include <RB_INC_LOCALE
|
||||
#include <RB_INC_CODECVT
|
||||
#include <RB_INC_MAP
|
||||
#include <RB_INC_SET
|
||||
#include <RB_INC_LIST
|
||||
#include <RB_INC_FORWARD_LIST
|
||||
#include <RB_INC_UNORDERED_MAP
|
||||
#include <RB_INC_DEQUE
|
||||
#include <RB_INC_QUEUE
|
||||
#include <RB_INC_SSTREAM
|
||||
#include <RB_INC_FSTREAM
|
||||
#include <RB_INC_IOSTREAM
|
||||
#include <RB_INC_IOMANIP
|
||||
#include <RB_INC_CSTDIO
|
||||
#include <RB_INC_CHRONO
|
||||
#include <RB_INC_CTIME
|
||||
#include <RB_INC_ATOMIC
|
||||
#include <RB_INC_THREAD
|
||||
#include <RB_INC_MUTEX
|
||||
#include <RB_INC_SHARED_MUTEX
|
||||
#include <RB_INC_CONDITION_VARIABLE
|
||||
#include <RB_INC_RANDOM
|
||||
#include <RB_INC_BITSET
|
||||
#include <RB_INC_OPTIONAL
|
||||
#include <RB_INC_NEW
|
||||
|
||||
#include <RB_INC_EXPERIMENTAL_STRING_VIEW
|
||||
#include <RB_INC_EXPERIMENTAL_OPTIONAL
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////>
|
||||
//
|
||||
// Pollution
|
||||
//
|
||||
// This section lists all of the items introduced outside of our namespace
|
||||
// which may conflict with your project.
|
||||
//
|
||||
|
||||
// Common branch prediction macros
|
||||
#define likely(x) __builtin_expect(!!(x), 1)
|
||||
#define unlikely(x) __builtin_expect(!!(x), 0)
|
||||
|
||||
// Legacy attribute format printf macros
|
||||
#define AFP(a, b) __attribute__((format(printf, a, b)))
|
||||
#define AFGP(a, b) __attribute__((format(gnu_printf, a, b)))
|
||||
|
||||
// Experimental std::string_view
|
||||
#if !defined(__cpp_lib_string_view) && defined(__cpp_lib_experimental_string_view)
|
||||
namespace std
|
||||
{
|
||||
using experimental::string_view;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Experimental std::optional
|
||||
#if !defined(__cpp_lib_optional) && defined(__cpp_lib_experimental_optional)
|
||||
namespace std
|
||||
{
|
||||
using experimental::optional;
|
||||
}
|
||||
#endif
|
||||
|
||||
// OpenSSL
|
||||
// Additional forward declarations in the extern namespace are introduced
|
||||
// by ircd/openssl.h
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// libircd API
|
||||
//
|
||||
|
||||
// Some items imported into our namespace.
|
||||
namespace ircd
|
||||
{
|
||||
using int128_t = signed __int128;
|
||||
using uint128_t = unsigned __int128;
|
||||
|
||||
using std::get;
|
||||
using std::end;
|
||||
using std::begin;
|
||||
|
||||
using std::nullptr_t;
|
||||
using std::nothrow_t;
|
||||
|
||||
using std::const_pointer_cast;
|
||||
using std::static_pointer_cast;
|
||||
using std::dynamic_pointer_cast;
|
||||
|
||||
using std::chrono::hours;
|
||||
using std::chrono::seconds;
|
||||
using std::chrono::milliseconds;
|
||||
using std::chrono::microseconds;
|
||||
using std::chrono::nanoseconds;
|
||||
using std::chrono::duration_cast;
|
||||
using std::chrono::system_clock;
|
||||
using std::chrono::steady_clock;
|
||||
using std::chrono::high_resolution_clock;
|
||||
using std::chrono::time_point;
|
||||
|
||||
using namespace std::literals::chrono_literals;
|
||||
using namespace std::string_literals;
|
||||
|
||||
namespace ph = std::placeholders;
|
||||
|
||||
template<class... T> using ilist = std::initializer_list<T...>;
|
||||
}
|
||||
|
||||
namespace ircd
|
||||
{
|
||||
enum class runlevel :int;
|
||||
|
||||
constexpr size_t BUFSIZE { 512 };
|
||||
extern const enum runlevel &runlevel;
|
||||
extern const std::string &config;
|
||||
extern bool debugmode; ///< Toggle; available only ifdef RB_DEBUG
|
||||
extern bool nolisten; ///< Init option to not bind listener socks.
|
||||
extern bool noautomod; ///< Option to not load modules on init.
|
||||
extern bool checkdb; ///< Perform checks on database opens
|
||||
}
|
||||
|
||||
#include "string_view.h"
|
||||
#include "vector_view.h"
|
||||
#include "byte_view.h"
|
||||
#include "buffer/buffer.h"
|
||||
#include "allocator.h"
|
||||
#include "util/util.h"
|
||||
#include "exception.h"
|
||||
#include "demangle.h"
|
||||
#include "localee.h"
|
||||
#include "date.h"
|
||||
#include "logger.h"
|
||||
#include "info.h"
|
||||
#include "nacl.h"
|
||||
#include "rand.h"
|
||||
#include "hash.h"
|
||||
#include "ed25519.h"
|
||||
#include "color.h"
|
||||
#include "lex_cast.h"
|
||||
#include "base.h"
|
||||
#include "stringops.h"
|
||||
#include "tokens.h"
|
||||
#include "iov.h"
|
||||
#include "parse.h"
|
||||
#include "rfc1459.h"
|
||||
#include "json/json.h"
|
||||
#include "openssl.h"
|
||||
#include "http.h"
|
||||
#include "fmt.h"
|
||||
#include "magics.h"
|
||||
#include "conf.h"
|
||||
#include "fs/fs.h"
|
||||
#include "ios.h"
|
||||
#include "ctx/ctx.h"
|
||||
#include "db/db.h"
|
||||
#include "js.h"
|
||||
#include "mods/mods.h"
|
||||
#include "rfc3986.h"
|
||||
#include "rfc1035.h"
|
||||
#include "net/net.h"
|
||||
#include "server/server.h"
|
||||
#include "m/m.h"
|
||||
#include "resource.h"
|
||||
#include "client.h"
|
||||
|
||||
/// \brief Internet Relay Chat daemon. This is the principal namespace for IRCd.
|
||||
///
|
||||
///
|
||||
|
|
|
@ -1,234 +0,0 @@
|
|||
// Matrix Construct
|
||||
//
|
||||
// Copyright (C) Matrix Construct Developers, Authors & Contributors
|
||||
// Copyright (C) 2016-2018 Jason Volk <jason@zemos.net>
|
||||
//
|
||||
// Permission to use, copy, modify, and/or distribute this software for any
|
||||
// purpose with or without fee is hereby granted, provided that the above
|
||||
// copyright notice and this permission notice is present in all copies. The
|
||||
// full license for this software is available in the LICENSE file.
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Standard includes
|
||||
//
|
||||
// This header includes almost everything we use out of the standard library.
|
||||
// This is a pre-compiled header. Project build time is significantly reduced
|
||||
// by doing things this way and C++ std headers have very little namespace
|
||||
// pollution and risk of conflicts.
|
||||
//
|
||||
// * If any project header file requires standard library symbols we try to
|
||||
// list it here, not in our header files.
|
||||
//
|
||||
// * Rare one-off's #includes isolated to a specific .cc file may not always be
|
||||
// listed here but can be.
|
||||
//
|
||||
// * Third party / dependency / non-std includes, are NEVER listed here.
|
||||
// Instead we include those in .cc files, and use forward declarations if
|
||||
// we require a symbol in our API to them.
|
||||
//
|
||||
|
||||
#define HAVE_IRCD_STDINC_H
|
||||
|
||||
// Generated by ./configure
|
||||
#include "config.h"
|
||||
|
||||
extern "C"
|
||||
{
|
||||
#include <RB_INC_ASSERT_H
|
||||
#include <RB_INC_STDARG_H
|
||||
#include <RB_INC_SYS_TIME_H
|
||||
#include <RB_INC_SYS_UTSNAME_H
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
#define WIN32_LEAN_AND_MEAN 1
|
||||
#include <RB_INC_WINDOWS_H
|
||||
#include <RB_INC_WINSOCK2_H
|
||||
#include <RB_INC_WS2TCPIP_H
|
||||
#include <RB_INC_IPHLPAPI_H
|
||||
#endif
|
||||
|
||||
#include <RB_INC_CSTDDEF
|
||||
#include <RB_INC_CSTDINT
|
||||
#include <RB_INC_LIMITS
|
||||
#include <RB_INC_TYPE_TRAITS
|
||||
#include <RB_INC_TYPEINDEX
|
||||
#include <RB_INC_VARIANT
|
||||
#include <RB_INC_CERRNO
|
||||
#include <RB_INC_UTILITY
|
||||
#include <RB_INC_FUNCTIONAL
|
||||
#include <RB_INC_ALGORITHM
|
||||
#include <RB_INC_NUMERIC
|
||||
#include <RB_INC_CMATH
|
||||
#include <RB_INC_MEMORY
|
||||
#include <RB_INC_EXCEPTION
|
||||
#include <RB_INC_SYSTEM_ERROR
|
||||
#include <RB_INC_ARRAY
|
||||
#include <RB_INC_VECTOR
|
||||
#include <RB_INC_STACK
|
||||
#include <RB_INC_STRING
|
||||
#include <RB_INC_CSTRING
|
||||
#include <RB_INC_STRING_VIEW
|
||||
#include <RB_INC_LOCALE
|
||||
#include <RB_INC_CODECVT
|
||||
#include <RB_INC_MAP
|
||||
#include <RB_INC_SET
|
||||
#include <RB_INC_LIST
|
||||
#include <RB_INC_FORWARD_LIST
|
||||
#include <RB_INC_UNORDERED_MAP
|
||||
#include <RB_INC_DEQUE
|
||||
#include <RB_INC_QUEUE
|
||||
#include <RB_INC_SSTREAM
|
||||
#include <RB_INC_FSTREAM
|
||||
#include <RB_INC_IOSTREAM
|
||||
#include <RB_INC_IOMANIP
|
||||
#include <RB_INC_CSTDIO
|
||||
#include <RB_INC_CHRONO
|
||||
#include <RB_INC_CTIME
|
||||
#include <RB_INC_ATOMIC
|
||||
#include <RB_INC_THREAD
|
||||
#include <RB_INC_MUTEX
|
||||
#include <RB_INC_SHARED_MUTEX
|
||||
#include <RB_INC_CONDITION_VARIABLE
|
||||
#include <RB_INC_RANDOM
|
||||
#include <RB_INC_BITSET
|
||||
#include <RB_INC_OPTIONAL
|
||||
#include <RB_INC_NEW
|
||||
|
||||
#include <RB_INC_EXPERIMENTAL_STRING_VIEW
|
||||
#include <RB_INC_EXPERIMENTAL_OPTIONAL
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////>
|
||||
//
|
||||
// Pollution
|
||||
//
|
||||
// This section lists all of the items introduced outside of our namespace
|
||||
// which may conflict with your project.
|
||||
//
|
||||
|
||||
// Common branch prediction macros
|
||||
#define likely(x) __builtin_expect(!!(x), 1)
|
||||
#define unlikely(x) __builtin_expect(!!(x), 0)
|
||||
|
||||
// Legacy attribute format printf macros
|
||||
#define AFP(a, b) __attribute__((format(printf, a, b)))
|
||||
#define AFGP(a, b) __attribute__((format(gnu_printf, a, b)))
|
||||
|
||||
// Experimental std::string_view
|
||||
#if !defined(__cpp_lib_string_view) && defined(__cpp_lib_experimental_string_view)
|
||||
namespace std
|
||||
{
|
||||
using experimental::string_view;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Experimental std::optional
|
||||
#if !defined(__cpp_lib_optional) && defined(__cpp_lib_experimental_optional)
|
||||
namespace std
|
||||
{
|
||||
using experimental::optional;
|
||||
}
|
||||
#endif
|
||||
|
||||
// OpenSSL
|
||||
// Additional forward declarations in the extern namespace are introduced
|
||||
// by ircd/openssl.h
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// libircd API
|
||||
//
|
||||
|
||||
// Some items imported into our namespace.
|
||||
namespace ircd
|
||||
{
|
||||
using int128_t = signed __int128;
|
||||
using uint128_t = unsigned __int128;
|
||||
|
||||
using std::get;
|
||||
using std::end;
|
||||
using std::begin;
|
||||
|
||||
using std::nullptr_t;
|
||||
using std::nothrow_t;
|
||||
|
||||
using std::const_pointer_cast;
|
||||
using std::static_pointer_cast;
|
||||
using std::dynamic_pointer_cast;
|
||||
|
||||
using std::chrono::hours;
|
||||
using std::chrono::seconds;
|
||||
using std::chrono::milliseconds;
|
||||
using std::chrono::microseconds;
|
||||
using std::chrono::nanoseconds;
|
||||
using std::chrono::duration_cast;
|
||||
using std::chrono::system_clock;
|
||||
using std::chrono::steady_clock;
|
||||
using std::chrono::high_resolution_clock;
|
||||
using std::chrono::time_point;
|
||||
|
||||
using namespace std::literals::chrono_literals;
|
||||
using namespace std::string_literals;
|
||||
|
||||
namespace ph = std::placeholders;
|
||||
|
||||
template<class... T> using ilist = std::initializer_list<T...>;
|
||||
}
|
||||
|
||||
namespace ircd
|
||||
{
|
||||
enum class runlevel :int;
|
||||
|
||||
constexpr size_t BUFSIZE { 512 };
|
||||
extern const enum runlevel &runlevel;
|
||||
extern const std::string &config;
|
||||
extern bool debugmode; ///< Toggle; available only ifdef RB_DEBUG
|
||||
extern bool nolisten; ///< Init option to not bind listener socks.
|
||||
extern bool noautomod; ///< Option to not load modules on init.
|
||||
extern bool checkdb; ///< Perform checks on database opens
|
||||
}
|
||||
|
||||
#include "string_view.h"
|
||||
#include "vector_view.h"
|
||||
#include "byte_view.h"
|
||||
#include "buffer/buffer.h"
|
||||
#include "allocator.h"
|
||||
#include "util/util.h"
|
||||
#include "exception.h"
|
||||
#include "demangle.h"
|
||||
#include "localee.h"
|
||||
#include "date.h"
|
||||
#include "logger.h"
|
||||
#include "info.h"
|
||||
#include "nacl.h"
|
||||
#include "rand.h"
|
||||
#include "hash.h"
|
||||
#include "ed25519.h"
|
||||
#include "color.h"
|
||||
#include "lex_cast.h"
|
||||
#include "base.h"
|
||||
#include "stringops.h"
|
||||
#include "tokens.h"
|
||||
#include "iov.h"
|
||||
#include "parse.h"
|
||||
#include "rfc1459.h"
|
||||
#include "json/json.h"
|
||||
#include "openssl.h"
|
||||
#include "http.h"
|
||||
#include "fmt.h"
|
||||
#include "magics.h"
|
||||
#include "conf.h"
|
||||
#include "fs/fs.h"
|
||||
#include "ios.h"
|
||||
#include "ctx/ctx.h"
|
||||
#include "db/db.h"
|
||||
#include "js.h"
|
||||
#include "mods/mods.h"
|
||||
#include "rfc3986.h"
|
||||
#include "rfc1035.h"
|
||||
#include "net/net.h"
|
||||
#include "server/server.h"
|
||||
#include "m/m.h"
|
||||
#include "resource.h"
|
||||
#include "client.h"
|
|
@ -16,7 +16,7 @@ AM_CPPFLAGS = \
|
|||
@SNAPPY_CPPFLAGS@ \
|
||||
@LZ4_CPPFLAGS@ \
|
||||
@Z_CPPFLAGS@ \
|
||||
-include ircd/ircd.h \
|
||||
-include ircd/ircd.pic.h \
|
||||
###
|
||||
|
||||
if MINGW
|
||||
|
|
|
@ -10,7 +10,7 @@ AM_CPPFLAGS = \
|
|||
-I$(top_srcdir)/include \
|
||||
@JS_CPPFLAGS@ \
|
||||
@BOOST_CPPFLAGS@ \
|
||||
-include $(top_srcdir)/include/ircd/ircd.h \
|
||||
-include $(top_srcdir)/include/ircd/ircd.pic.h \
|
||||
-include $(top_srcdir)/include/ircd/mods/mapi.h \
|
||||
###
|
||||
|
||||
|
|
Loading…
Reference in a new issue