// Matrix Construct // // Copyright (C) Matrix Construct Developers, Authors & Contributors // Copyright (C) 2016-2018 Jason Volk // // 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. #define HAVE_IRCD_STDINC_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. // // It is advised that all standard library symbols are declared with default // visibility. This pragma overrides any -fvisibility option on any unit. #pragma GCC visibility push(default) extern "C" { #include (0)) #else #define assert(expr) \ (static_cast(expr)? void(0): __assert_fail(#expr, __FILE__, __LINE__, __FUNCTION__)) #endif #endif //////////////////////////////////////////////////////////////////////////////> // // 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) // 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 // Forward declare the existence of these in std:: to allow their immediate // use throughout the project as a developer convenience. is not // included here because it generates naive initialization code in every unit, // whereas we conduct it once for libircd in the right place. namespace std { extern istream cin; extern ostream cout; extern ostream cerr; } /////////////////////////////////////////////////////////////////////////////// // // libircd API // // Some items imported into our namespace. // // 128 bit integer support #if !defined(HAVE_INT128_T) || !defined(HAVE_UINT128_T) namespace ircd { #if defined(HAVE___INT128_T) && defined(HAVE__UINT128_T) using int128_t = __int128_t; using uint128_t = __uint128_t; #elif defined(HAVE___INT128) using int128_t = signed __int128; using uint128_t = unsigned __int128; #else #error "Missing 128 bit integer types on this platform." #endif } #endif namespace ircd { 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::minutes; using std::chrono::seconds; using std::chrono::milliseconds; using std::chrono::microseconds; using std::chrono::nanoseconds; using std::chrono::duration; 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::string_literals; using namespace std::chrono_literals; using namespace std::literals::chrono_literals; using std::string_literals::operator""s; using std::chrono_literals::operator""s; namespace ph = std::placeholders; template using ilist = std::initializer_list; using std::error_code; } #pragma GCC visibility pop // default