From 4a5691e3496f76f251c66820b6b54f9f6e1d010b Mon Sep 17 00:00:00 2001 From: SChernykh Date: Mon, 23 Aug 2021 11:31:16 +0200 Subject: [PATCH] clang fixes --- .gitignore | 2 ++ src/log.h | 22 ++++------------------ src/tcp_server.inl | 2 +- 3 files changed, 7 insertions(+), 19 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9ef9604 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +build + diff --git a/src/log.h b/src/log.h index 7f33ece..b09a355 100644 --- a/src/log.h +++ b/src/log.h @@ -166,6 +166,10 @@ INT_ENTRY(uint16_t) INT_ENTRY(uint32_t) INT_ENTRY(uint64_t) +#ifdef __clang__ +INT_ENTRY(unsigned long) +#endif + #undef INT_ENTRY template @@ -287,24 +291,6 @@ template<> struct log::Stream::Entry static FORCEINLINE void put(const std::string& value, Stream* wrapper) { wrapper->writeBuf(value.c_str(), value.length()); } }; -template struct to_str { static const char s[]; }; -template constexpr char to_str::s[] = { ('0' + digits)..., 0 }; - -template -struct Str : Str {}; - -template -struct Str<0, digits...> : to_str {}; - -template -struct log::Stream::Entry> -{ - static FORCEINLINE void put(Str&& value, Stream* wrapper) - { - wrapper->writeBuf(value.s, sizeof(value.s) - 1); - } -}; - struct Hashrate { explicit FORCEINLINE Hashrate(uint64_t data) : m_data(data) {} diff --git a/src/tcp_server.inl b/src/tcp_server.inl index 0d2f4cd..fbaae46 100644 --- a/src/tcp_server.inl +++ b/src/tcp_server.inl @@ -447,7 +447,7 @@ bool TCPServer::send_internal(Client* client, Sen const size_t bytes_written = callback(buf->m_data); if (bytes_written > sizeof(buf->m_data)) { - LOGERR(0, "send callback wrote " << bytes_written << " bytes, expected no more than " << log::Strm_data)>() << " bytes"); + LOGERR(0, "send callback wrote " << bytes_written << " bytes, expected no more than " << sizeof(buf->m_data) << " bytes"); panic(); }