mirror of
https://github.com/matrix-construct/construct
synced 2024-11-25 16:22:35 +01:00
ircd::util: Fix inline namespace reopening for clang.
This commit is contained in:
parent
ab32ef76d7
commit
fa7b708e03
34 changed files with 89 additions and 61 deletions
|
@ -11,7 +11,8 @@
|
|||
#pragma once
|
||||
#define HAVE_IRCD_DEMANGLE_H
|
||||
|
||||
namespace ircd::util
|
||||
namespace ircd {
|
||||
inline namespace util
|
||||
{
|
||||
IRCD_EXCEPTION(ircd::error, demangle_error)
|
||||
IRCD_EXCEPTION(demangle_error, not_mangled)
|
||||
|
@ -22,7 +23,7 @@ namespace ircd::util
|
|||
std::string demangle(const char *const &symbol);
|
||||
template<class T> string_view demangle(const mutable_buffer &out);
|
||||
template<class T> std::string demangle();
|
||||
}
|
||||
}}
|
||||
|
||||
template<class T>
|
||||
std::string
|
||||
|
|
|
@ -11,7 +11,8 @@
|
|||
#pragma once
|
||||
#define HAVE_IRCD_UTIL_BSWAP_H
|
||||
|
||||
namespace ircd::util
|
||||
namespace ircd {
|
||||
inline namespace util
|
||||
{
|
||||
template<class T> T &bswap(T *const &);
|
||||
template<class T> T bswap(T);
|
||||
|
@ -33,7 +34,7 @@ namespace ircd::util
|
|||
uint16_t ntohs(const uint16_t &);
|
||||
double ntohd(const double &);
|
||||
float ntohf(const float &);
|
||||
}
|
||||
}}
|
||||
|
||||
inline float
|
||||
ircd::util::ntohf(const float &a)
|
||||
|
|
|
@ -11,7 +11,8 @@
|
|||
#pragma once
|
||||
#define HAVE_IRCD_UTIL_CALLBACKS_H
|
||||
|
||||
namespace ircd::util
|
||||
namespace ircd {
|
||||
inline namespace util
|
||||
{
|
||||
/// The purpose of callbacks is simply explained with an analogy out of
|
||||
/// browser-javascript land: it is window.onload.addEventListener() in lieu
|
||||
|
@ -22,7 +23,7 @@ namespace ircd::util
|
|||
/// The template provides an option for whether exceptions should propagate
|
||||
/// to the caller. If they propagate, all listeners after the exception won't
|
||||
/// be invoked.
|
||||
///
|
||||
///
|
||||
template<class prototype,
|
||||
bool exceptions = true>
|
||||
struct callbacks;
|
||||
|
@ -32,7 +33,7 @@ namespace ircd::util
|
|||
|
||||
template<class prototype>
|
||||
struct callbacks<prototype, false>;
|
||||
}
|
||||
}}
|
||||
|
||||
template<class prototype>
|
||||
struct ircd::util::callbacks<prototype, true>
|
||||
|
|
|
@ -11,10 +11,11 @@
|
|||
#pragma once
|
||||
#define HAVE_IRCD_UTIL_CLOSURE_H
|
||||
|
||||
namespace ircd::util
|
||||
namespace ircd {
|
||||
inline namespace util
|
||||
{
|
||||
template<class function> struct closure;
|
||||
}
|
||||
}}
|
||||
|
||||
///TODO: This is a WIP that is meant to replace the pattern of having two
|
||||
///TODO: for_each() overloads in every interface where one takes a closure
|
||||
|
|
|
@ -11,10 +11,11 @@
|
|||
#pragma once
|
||||
#define HAVE_IRCD_UTIL_CUSTOM_PTR_H
|
||||
|
||||
namespace ircd::util
|
||||
namespace ircd {
|
||||
inline namespace util
|
||||
{
|
||||
template<class T> struct custom_ptr;
|
||||
}
|
||||
}}
|
||||
|
||||
template<class T>
|
||||
struct ircd::util::custom_ptr
|
||||
|
|
|
@ -11,7 +11,8 @@
|
|||
#pragma once
|
||||
#define HAVE_IRCD_UTIL_ENUM_H
|
||||
|
||||
namespace ircd::util {
|
||||
namespace ircd {
|
||||
inline namespace util {
|
||||
|
||||
// For conforming enums include a _NUM_ as the last element,
|
||||
// then num_of<my_enum>() works
|
||||
|
@ -144,4 +145,5 @@ combine_flags(const std::initializer_list<Enum> &list)
|
|||
return combine_flags<Enum>(begin(list), end(list));
|
||||
}
|
||||
|
||||
} // namespace ircd::util
|
||||
} // namespace util
|
||||
} // namespace ircd
|
||||
|
|
|
@ -11,7 +11,8 @@
|
|||
#pragma once
|
||||
#define HAVE_IRCD_UTIL_ENV_H
|
||||
|
||||
namespace ircd::util
|
||||
namespace ircd {
|
||||
inline namespace util
|
||||
{
|
||||
string_view getenv(const string_view &);
|
||||
}
|
||||
}}
|
||||
|
|
|
@ -11,7 +11,9 @@
|
|||
#pragma once
|
||||
#define HAVE_IRCD_UTIL_FPE_H
|
||||
|
||||
namespace ircd::util::fpe
|
||||
namespace ircd {
|
||||
inline namespace util {
|
||||
namespace fpe
|
||||
{
|
||||
struct errors_handle;
|
||||
|
||||
|
@ -21,7 +23,7 @@ namespace ircd::util::fpe
|
|||
|
||||
void throw_errors(const ushort &flags);
|
||||
std::fexcept_t set(const ushort &flag);
|
||||
}
|
||||
}}}
|
||||
|
||||
/// Perform a single floating point operation at a time within the scope
|
||||
/// of fpe::errors_handle. After each operation check the floating point
|
||||
|
|
|
@ -11,7 +11,8 @@
|
|||
#pragma once
|
||||
#define HAVE_IRCD_UTIL_HASH_H
|
||||
|
||||
namespace ircd::util
|
||||
namespace ircd {
|
||||
inline namespace util
|
||||
{
|
||||
// constexpr bernstein string hasher suite; these functions will hash the
|
||||
// string at compile time leaving an integer residue at runtime. Decent
|
||||
|
@ -22,7 +23,7 @@ namespace ircd::util
|
|||
// Note that at runtime this hash uses multiplication on every character
|
||||
// which can consume many cycles...
|
||||
template<size_t PRIME = 7681> size_t hash(const std::u16string &str, const size_t i = 0);
|
||||
}
|
||||
}}
|
||||
|
||||
/// Runtime hashing of a std::u16string (for js). Non-cryptographic.
|
||||
template<size_t PRIME>
|
||||
|
|
|
@ -11,10 +11,11 @@
|
|||
#pragma once
|
||||
#define HAVE_IRCD_UTIL_INSTANCE_LIST_H
|
||||
|
||||
namespace ircd::util
|
||||
namespace ircd {
|
||||
inline namespace util
|
||||
{
|
||||
template<class T> struct instance_list;
|
||||
}
|
||||
}}
|
||||
|
||||
/// The instance_list pattern is where every instance of a class registers
|
||||
/// itself in a static list of all instances and removes itself on dtor.
|
||||
|
|
|
@ -11,10 +11,11 @@
|
|||
#pragma once
|
||||
#define HAVE_IRCD_UTIL_INSTANCE_MULTIMAP_H
|
||||
|
||||
namespace ircd::util
|
||||
namespace ircd {
|
||||
inline namespace util
|
||||
{
|
||||
template<class K, class T, class C = std::less<K>> struct instance_multimap;
|
||||
}
|
||||
}}
|
||||
|
||||
/// See instance_list for purpose and overview.
|
||||
template<class K,
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
#define HAVE_IRCD_UTIL_ITERATOR_H
|
||||
|
||||
namespace ircd {
|
||||
namespace util {
|
||||
inline namespace util {
|
||||
|
||||
//
|
||||
// To collapse pairs of iterators down to a single type
|
||||
|
|
|
@ -11,7 +11,8 @@
|
|||
#pragma once
|
||||
#define HAVE_IRCD_UTIL_LIFE_GUARD_H
|
||||
|
||||
namespace ircd::util
|
||||
namespace ircd {
|
||||
inline namespace util
|
||||
{
|
||||
// Convenience functions for types shared_from_this
|
||||
template<class T> std::shared_ptr<const T> shared_from(const T &t);
|
||||
|
@ -20,7 +21,7 @@ namespace ircd::util
|
|||
template<class T> std::weak_ptr<T> weak_from(T &t);
|
||||
|
||||
template<class T> struct life_guard;
|
||||
}
|
||||
}}
|
||||
|
||||
/// life_guard is a convenience which takes advantage of std::enable_shared_from_this<T>.
|
||||
/// The life_guard glorifies the constructor of an std::shared_ptr<T> by accepting
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
//
|
||||
|
||||
namespace ircd {
|
||||
namespace util {
|
||||
inline namespace util {
|
||||
|
||||
/// Test for template geworfenheit
|
||||
///
|
||||
|
|
|
@ -14,10 +14,11 @@
|
|||
// This file is not part of the standard include stack. It is included
|
||||
// manually as needed.
|
||||
|
||||
namespace ircd::util
|
||||
namespace ircd {
|
||||
inline namespace util
|
||||
{
|
||||
struct params;
|
||||
}
|
||||
}}
|
||||
|
||||
struct ircd::util::params
|
||||
{
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
//
|
||||
|
||||
namespace ircd {
|
||||
namespace util {
|
||||
inline namespace util {
|
||||
|
||||
/// Transform input sequence values to pointers in the output sequence
|
||||
/// using two input iterators [begin, end] and one output iterator [begin]
|
||||
|
|
|
@ -11,7 +11,8 @@
|
|||
#pragma once
|
||||
#define HAVE_IRCD_UTIL_PRETTY_H
|
||||
|
||||
namespace ircd::util
|
||||
namespace ircd {
|
||||
inline namespace util
|
||||
{
|
||||
// Human readable space suite
|
||||
using human_readable_size = std::tuple<uint64_t, long double, const string_view &>;
|
||||
|
@ -40,7 +41,7 @@ namespace ircd::util
|
|||
string_view pretty_nanoseconds(const mutable_buffer &out, const long double &, const uint &fmt = 0);
|
||||
template<class r, class p> string_view pretty(const mutable_buffer &out, const duration<r, p> &, const uint &fmt = 0);
|
||||
template<class r, class p> std::string pretty(const duration<r, p> &, const uint &fmt = 0);
|
||||
}
|
||||
}}
|
||||
|
||||
template<class rep,
|
||||
class period>
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
//
|
||||
|
||||
namespace ircd {
|
||||
namespace util {
|
||||
inline namespace util {
|
||||
|
||||
template<class stringstream>
|
||||
stringstream &
|
||||
|
|
|
@ -11,10 +11,11 @@
|
|||
#pragma once
|
||||
#define HAVE_IRCD_UTIL_REENTRANCE_H
|
||||
|
||||
namespace ircd::util
|
||||
namespace ircd {
|
||||
inline namespace util
|
||||
{
|
||||
template<bool &entered> struct reentrance_assertion;
|
||||
}
|
||||
}}
|
||||
|
||||
/// Simple assert for reentrancy; useful when static variables are in play.
|
||||
/// You have to place `entered` and give it the proper linkage you want.
|
||||
|
|
|
@ -11,10 +11,11 @@
|
|||
#pragma once
|
||||
#define HAVE_IRCD_UTIL_SCOPE_COUNT_H
|
||||
|
||||
namespace ircd::util
|
||||
namespace ircd {
|
||||
inline namespace util
|
||||
{
|
||||
template<class T> struct scope_count;
|
||||
};
|
||||
}};
|
||||
|
||||
/// A simple boiler-plate for incrementing a counter when constructed and
|
||||
/// decrementing it to its previous value when destructed. This takes a runtime
|
||||
|
|
|
@ -11,10 +11,11 @@
|
|||
#pragma once
|
||||
#define HAVE_IRCD_UTIL_SCOPE_RESTORE_H
|
||||
|
||||
namespace ircd::util
|
||||
namespace ircd {
|
||||
inline namespace util
|
||||
{
|
||||
template<class T> struct scope_restore;
|
||||
};
|
||||
}}
|
||||
|
||||
template<class T>
|
||||
struct ircd::util::scope_restore
|
||||
|
|
|
@ -15,7 +15,8 @@
|
|||
// String generating patterns
|
||||
//
|
||||
|
||||
namespace ircd::util
|
||||
namespace ircd {
|
||||
inline namespace util
|
||||
{
|
||||
using string_closure_size = std::function<size_t (const mutable_buffer &)>;
|
||||
using string_closure_view = std::function<string_view (const mutable_buffer &)>;
|
||||
|
@ -42,7 +43,7 @@ namespace ircd::util
|
|||
template<class T> std::string string(const T &s);
|
||||
|
||||
template<class F, class... A> std::string string_buffer(const size_t &, F&&, A&&...);
|
||||
}
|
||||
}}
|
||||
|
||||
/// Convenience template for working with various functions throughout IRCd
|
||||
/// with the pattern `size_t func(mutable_buffer, ...)`. This function closes
|
||||
|
|
|
@ -11,14 +11,15 @@
|
|||
#pragma once
|
||||
#define HAVE_IRCD_UTIL_SYSCALL_H
|
||||
|
||||
namespace ircd::util
|
||||
namespace ircd {
|
||||
inline namespace util
|
||||
{
|
||||
template<class function, class... args> long syscall(function&& f, args&&... a);
|
||||
template<long number, class... args> long syscall(args&&... a);
|
||||
|
||||
template<class function, class... args> long syscall_nointr(function&& f, args&&... a);
|
||||
template<long number, class... args> long syscall_nointr(args&&... a);
|
||||
}
|
||||
}}
|
||||
|
||||
/// Posix system call template to check for returned error value and throw the
|
||||
/// approps errno in the proper std::system_error exception. Note the usage
|
||||
|
|
|
@ -11,7 +11,8 @@
|
|||
#pragma once
|
||||
#define HAVE_IRCD_UTIL_TEST_H
|
||||
|
||||
namespace ircd::util
|
||||
namespace ircd {
|
||||
inline namespace util
|
||||
{
|
||||
void test();
|
||||
}
|
||||
}}
|
||||
|
|
|
@ -11,10 +11,11 @@
|
|||
#pragma once
|
||||
#define HAVE_IRCD_UTIL_TIMER_H
|
||||
|
||||
namespace ircd::util
|
||||
namespace ircd {
|
||||
inline namespace util
|
||||
{
|
||||
struct timer;
|
||||
}
|
||||
}}
|
||||
|
||||
struct ircd::util::timer
|
||||
{
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
//
|
||||
|
||||
namespace ircd {
|
||||
namespace util {
|
||||
inline namespace util {
|
||||
|
||||
template<class tuple>
|
||||
constexpr bool
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
#define HAVE_IRCD_UTIL_TYPOGRAPHY_H
|
||||
|
||||
namespace ircd {
|
||||
namespace util {
|
||||
inline namespace util {
|
||||
|
||||
//
|
||||
// Overloading macros
|
||||
|
|
|
@ -11,10 +11,11 @@
|
|||
#pragma once
|
||||
#define HAVE_IRCD_UTIL_U2A_H
|
||||
|
||||
namespace ircd::util
|
||||
namespace ircd {
|
||||
inline namespace util
|
||||
{
|
||||
// Binary <-> Hex conversion suite
|
||||
const_buffer a2u(const mutable_buffer &out, const const_buffer &in);
|
||||
string_view u2a(const mutable_buffer &out, const const_buffer &in);
|
||||
std::string u2a(const const_buffer &in);
|
||||
}
|
||||
}}
|
||||
|
|
|
@ -11,7 +11,8 @@
|
|||
#pragma once
|
||||
#define HAVE_IRCD_UTIL_UNIQUE_ITERATOR_H
|
||||
|
||||
namespace ircd::util
|
||||
namespace ircd {
|
||||
inline namespace util
|
||||
{
|
||||
template<class container,
|
||||
class iterator = typename container::iterator>
|
||||
|
@ -19,7 +20,7 @@ namespace ircd::util
|
|||
|
||||
template<class container>
|
||||
struct unique_const_iterator;
|
||||
}
|
||||
}}
|
||||
|
||||
//
|
||||
// For objects using the pattern of adding their own instance to a container
|
||||
|
|
|
@ -49,7 +49,7 @@ noexcept \
|
|||
}
|
||||
|
||||
namespace ircd {
|
||||
namespace util {
|
||||
inline namespace util {
|
||||
|
||||
// IEC unit literals
|
||||
IRCD_UNIT_LITERAL_UL( B, val )
|
||||
|
|
|
@ -11,10 +11,11 @@
|
|||
#pragma once
|
||||
#define HAVE_IRCD_UTIL_UNWIND_H
|
||||
|
||||
namespace ircd::util
|
||||
namespace ircd {
|
||||
inline namespace util
|
||||
{
|
||||
struct unwind;
|
||||
};
|
||||
}}
|
||||
|
||||
//
|
||||
// Fundamental scope-unwind utilities establishing actions during destruction
|
||||
|
|
|
@ -64,7 +64,7 @@ namespace ircd
|
|||
|
||||
// Unsorted section
|
||||
namespace ircd {
|
||||
namespace util {
|
||||
inline namespace util {
|
||||
|
||||
//
|
||||
// Misc size() participants.
|
||||
|
|
|
@ -11,7 +11,8 @@
|
|||
#pragma once
|
||||
#define HAVE_IRCD_UTIL_VA_RTTI_H
|
||||
|
||||
namespace ircd::util
|
||||
namespace ircd {
|
||||
inline namespace util
|
||||
{
|
||||
struct va_rtti;
|
||||
|
||||
|
@ -19,7 +20,7 @@ namespace ircd::util
|
|||
{
|
||||
12
|
||||
};
|
||||
}
|
||||
}}
|
||||
|
||||
//
|
||||
// Similar to a va_list, but conveying std-c++ type data acquired from a variadic template
|
||||
|
|
|
@ -11,7 +11,8 @@
|
|||
#pragma once
|
||||
#define HAVE_IRCD_UTIL_WHAT_H
|
||||
|
||||
namespace ircd::util
|
||||
namespace ircd {
|
||||
inline namespace util
|
||||
{
|
||||
string_view what(const std::exception_ptr eptr = std::current_exception()) noexcept;
|
||||
}
|
||||
}}
|
||||
|
|
Loading…
Reference in a new issue