From 788cfe69a1668dfd7e6bca16907de696e6063fbe Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Fri, 7 Dec 2018 09:36:36 +0100 Subject: compat/warn: move to attic --- compat/warn.hpp | 67 --------------------------------------------------------- 1 file changed, 67 deletions(-) delete mode 100644 compat/warn.hpp (limited to 'compat') diff --git a/compat/warn.hpp b/compat/warn.hpp deleted file mode 100644 index 7f3e21d0..00000000 --- a/compat/warn.hpp +++ /dev/null @@ -1,67 +0,0 @@ -#pragma once - -#include "macros.hpp" - -#include -#include -#include -#include - -#include - -namespace warn_detail { -template using basic_string_stream = std::basic_ostringstream, std::allocator>; -using string_stream = basic_string_stream; - -cc_forceinline void do_warn(string_stream&) {} - -template -cc_forceinline void do_warn(string_stream& acc, const x& datum, const xs&... rest) -{ - acc << datum; - if (sizeof...(rest) > 0u) - acc << L' '; - do_warn(acc, rest...); -} - -template -cc_noinline void warn_(const char* file, int line, const char* level, const xs&... seq) -{ - using namespace warn_detail; - string_stream stream; - - do_warn(stream, seq...); - - std::wcerr << L'[' << level << L' ' - << file << L':' << line - << L"] " - << std::boolalpha - << stream.str() - << L'\n'; - std::wcerr.flush(); -} - -} // ns warn_detail - -// todo add runtime loglevel - -#define otr_impl_warn_base(level, ...) \ - (warn_detail::warn_(__FILE__, __LINE__, (level), __VA_ARGS__)) - -#define dbg_warn(...) \ - otr_impl_warn_base("WARN", __VA_ARGS__) - -#define dbg_log(...) \ - otr_impl_warn_base("INFO", __VA_ARGS__) - -#define dbg_crit(...) \ - otr_impl_warn_base("CRIT", __VA_ARGS__) - -#include - -#define dbg_fatal(...) \ - do \ - { \ - otr_impl_warn_base("FATAL", __VA_ARGS__); \ - std::abort(); \ - } while (0) -- cgit v1.2.3