2018-12-18 01:00:22 +01:00
|
|
|
// 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.
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
#define HAVE_IRCD_CTX_SLICE_USAGE_WARNING_H
|
|
|
|
|
2019-06-23 08:08:46 +02:00
|
|
|
namespace ircd::ctx {
|
|
|
|
inline namespace this_ctx
|
2018-12-18 01:00:22 +01:00
|
|
|
{
|
|
|
|
struct slice_usage_warning;
|
2019-06-23 08:08:46 +02:00
|
|
|
}}
|
2018-12-18 01:00:22 +01:00
|
|
|
|
2020-05-25 01:34:04 +02:00
|
|
|
#ifdef RB_DEBUG
|
2018-12-18 01:00:22 +01:00
|
|
|
struct ircd::ctx::this_ctx::slice_usage_warning
|
|
|
|
{
|
|
|
|
string_view fmt;
|
|
|
|
va_rtti ap;
|
2020-05-25 01:43:56 +02:00
|
|
|
ulong epoch;
|
2018-12-18 01:00:22 +01:00
|
|
|
ulong start;
|
|
|
|
|
|
|
|
template<class... args>
|
|
|
|
slice_usage_warning(const string_view &fmt, args&&... ap)
|
|
|
|
:slice_usage_warning{fmt, va_rtti{ap...}}
|
|
|
|
{}
|
|
|
|
|
|
|
|
explicit slice_usage_warning(const string_view &fmt, va_rtti &&ap);
|
|
|
|
~slice_usage_warning() noexcept;
|
|
|
|
};
|
|
|
|
#else
|
|
|
|
struct ircd::ctx::this_ctx::slice_usage_warning
|
|
|
|
{
|
2019-07-20 02:03:58 +02:00
|
|
|
#if defined(__clang__)
|
|
|
|
template<class... args>
|
|
|
|
slice_usage_warning(const string_view &fmt, args&&...)
|
|
|
|
{}
|
|
|
|
#else
|
|
|
|
// In at least gcc 6.3.0 20170519, template param packs are not DCE'ed
|
|
|
|
// so legacy varargs are used here.
|
2018-12-18 01:00:22 +01:00
|
|
|
slice_usage_warning(const string_view &fmt, ...)
|
2019-07-20 02:03:58 +02:00
|
|
|
{}
|
|
|
|
#endif
|
2018-12-18 01:00:22 +01:00
|
|
|
};
|
|
|
|
#endif
|