Fix debug_print for clang

This commit is contained in:
rexy712 2022-02-24 16:47:28 -08:00
parent bb6cc3e783
commit 2e7d214660

View File

@ -79,8 +79,6 @@
print_succ& operator=(print_succ&&) = delete; print_succ& operator=(print_succ&&) = delete;
}; };
template<class... Args> template<class... Args>
print_succ(Args&&...) -> print_succ<Args&&...>;
template<class... Args>
struct print_info{ struct print_info{
explicit print_info(Args&&... args, const rexy::source_location& loc = rexy::source_location::current()){ explicit print_info(Args&&... args, const rexy::source_location& loc = rexy::source_location::current()){
std::fprintf(stderr, "%s", detail::color_blue); std::fprintf(stderr, "%s", detail::color_blue);
@ -94,8 +92,6 @@
print_info& operator=(print_info&&) = delete; print_info& operator=(print_info&&) = delete;
}; };
template<class... Args> template<class... Args>
print_info(Args&&...) -> print_info<Args&&...>;
template<class... Args>
struct print_warn{ struct print_warn{
explicit print_warn(Args&&... args, const rexy::source_location& loc = rexy::source_location::current()){ explicit print_warn(Args&&... args, const rexy::source_location& loc = rexy::source_location::current()){
std::fprintf(stderr, "%s", detail::color_yellow); std::fprintf(stderr, "%s", detail::color_yellow);
@ -109,8 +105,6 @@
print_warn& operator=(print_warn&&) = delete; print_warn& operator=(print_warn&&) = delete;
}; };
template<class... Args> template<class... Args>
print_warn(Args&&...) -> print_warn<Args&&...>;
template<class... Args>
struct print_error{ struct print_error{
explicit print_error(Args&&... args, const rexy::source_location& loc = rexy::source_location::current()){ explicit print_error(Args&&... args, const rexy::source_location& loc = rexy::source_location::current()){
std::fprintf(stderr, "%s", detail::color_red); std::fprintf(stderr, "%s", detail::color_red);
@ -123,32 +117,77 @@
print_error& operator=(const print_error&) = delete; print_error& operator=(const print_error&) = delete;
print_error& operator=(print_error&&) = delete; print_error& operator=(print_error&&) = delete;
}; };
template<class... Args>
print_error(Args&&...) -> print_error<Args&&...>;
#else #else
template<class... Args> template<class... Args>
using print_succ = print<Args...>; class print_succ : public print<Args...>{
public:
using print<Args...>::print;
};
template<class... Args> template<class... Args>
using print_info = print<Args...>; class print_info : public print<Args...>{
public:
using print<Args...>::print;
};
template<class... Args> template<class... Args>
using print_warn = print<Args...>; class print_warn : public print<Args...>{
public:
using print<Args...>::print;
};
template<class... Args> template<class... Args>
using print_error = print<Args...>; class print_error : public print<Args...>{
public:
using print<Args...>::print;
};
#endif //REXY_ENABLE_COLOR_DEBUG #endif //REXY_ENABLE_COLOR_DEBUG
template<class... Args>
print_warn(Args&&...) -> print_warn<Args&&...>;
template<class... Args>
print_error(Args&&...) -> print_error<Args&&...>;
template<class... Args>
print_info(Args&&...) -> print_info<Args&&...>;
template<class... Args>
print_succ(Args&&...) -> print_succ<Args&&...>;
#ifdef REXY_ENABLE_DEBUG_VERBOSE_OUTPUT #ifdef REXY_ENABLE_DEBUG_VERBOSE_OUTPUT
namespace verbose{ namespace verbose{
template<class... Args> template<class... Args>
using print = rexy::debug::print<Args...>; class print : public ::rexy::debug::print<Args...>{
public:
using ::rexy::debug::print<Args...>::print;
};
template<class... Args> template<class... Args>
using print_succ = rexy::debug::print_succ<Args...>; class print_succ : public ::rexy::debug::print_succ<Args...>{
public:
using ::rexy::debug::print_succ<Args...>::print_succ;
};
template<class... Args> template<class... Args>
using print_info = rexy::debug::print_info<Args...>; class print_info : public ::rexy::debug::print_info<Args...>{
public:
using ::rexy::debug::print_info<Args...>::print_info;
};
template<class... Args> template<class... Args>
using print_warn = rexy::debug::print_warn<Args...>; class print_warn : public ::rexy::debug::print_warn<Args...>{
public:
using ::rexy::debug::print_warn<Args...>::print_warn;
};
template<class... Args> template<class... Args>
using print_error = rexy::debug::print_error<Args...>; class print_error : public ::rexy::debug::print_error<Args...>{
public:
using ::rexy::debug::print_error<Args...>::print_error;
};
template<class... Args>
print(Args&&...) -> print<Args&&...>;
template<class... Args>
print_warn(Args&&...) -> print_warn<Args&&...>;
template<class... Args>
print_error(Args&&...) -> print_error<Args&&...>;
template<class... Args>
print_info(Args&&...) -> print_info<Args&&...>;
template<class... Args>
print_succ(Args&&...) -> print_succ<Args&&...>;
} }
#else #else
namespace verbose{ namespace verbose{
static constexpr inline void print(...){} static constexpr inline void print(...){}