add support of clang 14.0.3

This commit is contained in:
InoriRus
2022-05-25 20:07:51 +10:00
parent 6129b6ecac
commit adda20a6fe
53 changed files with 681 additions and 210 deletions
+1 -1
View File
@@ -25,7 +25,7 @@ public:
}
}
ByteBuffer(const void* buf, uint32_t size): ByteBuffer(size, false) // @suppress("Ambiguous problem")
explicit ByteBuffer(const void* buf, uint32_t size): ByteBuffer(size, false) // @suppress("Ambiguous problem")
{
Byte* values_ptr = GetData();
std::memcpy(values_ptr, buf, size);
+7 -6
View File
@@ -17,6 +17,7 @@
// IWYU pragma: begin_exports
#include <cinttypes>
#include <cstddef>
#include <cstdint>
#include <cstdio>
// IWYU pragma: end_exports
@@ -31,16 +32,16 @@
#define KYTY_CLASS_NO_COPY(name) \
public: \
name(const name&) = delete; /* NOLINT(bugprone-macro-parentheses) */ \
name& operator=(const name&) = delete; /* NOLINT(bugprone-macro-parentheses) */ \
name(name&&) noexcept = delete; /* NOLINT(bugprone-macro-parentheses) */ \
name(const name&) = delete; /* NOLINT(bugprone-macro-parentheses) */ \
name& operator=(const name&) = delete; /* NOLINT(bugprone-macro-parentheses) */ \
name(name&&) noexcept = delete; /* NOLINT(bugprone-macro-parentheses) */ \
name& operator=(name&&) noexcept = delete; /* NOLINT(bugprone-macro-parentheses) */
#define KYTY_CLASS_DEFAULT_COPY(name) \
public: \
name(const name&) = default; /* NOLINT(bugprone-macro-parentheses) */ \
name& operator=(const name&) = default; /* NOLINT(bugprone-macro-parentheses) */ \
name(name&&) noexcept = default; /* NOLINT(bugprone-macro-parentheses) */ \
name(const name&) = default; /* NOLINT(bugprone-macro-parentheses) */ \
name& operator=(const name&) = default; /* NOLINT(bugprone-macro-parentheses) */ \
name(name&&) noexcept = default; /* NOLINT(bugprone-macro-parentheses) */ \
name& operator=(name&&) noexcept = default; /* NOLINT(bugprone-macro-parentheses) */
#if (KYTY_COMPILER == KYTY_COMPILER_MINGW || KYTY_COMPILER == KYTY_COMPILER_GCC)
+2 -2
View File
@@ -13,7 +13,7 @@ struct ConnectionPrivate;
void Init();
class Statement
class Statement final
{
public:
enum class State
@@ -79,7 +79,7 @@ public:
friend class Connection;
protected:
virtual ~Statement();
~Statement();
explicit Statement(ConnectionPrivate* c);
private:
+7 -7
View File
@@ -33,7 +33,7 @@ public:
explicit Date(jd_t d): m_jd(d) {}
Date(const Date& d) = default;
Date(Date&& d) noexcept = default;
Date(int year, int month, int day); // month in [1...12], day in [1...31]
explicit Date(int year, int month, int day); // month in [1...12], day in [1...31]
~Date() = default;
static Date FromSystem();
@@ -70,7 +70,7 @@ public:
bool operator>(const Date& other) const { return m_jd > other.m_jd; }
bool operator>=(const Date& other) const { return m_jd >= other.m_jd; }
Date& operator=(const Date& other) = default;
Date& operator=(const Date& other) = default;
Date& operator=(Date&& other) noexcept = default;
Date operator+(int days) const { return Date(m_jd + days); }
Date operator-(int days) const { return Date(m_jd - days); }
@@ -102,7 +102,7 @@ public:
}
Time(const Time& t) = default;
Time(Time&& t) noexcept = default;
Time(int hour24, int minute, int second, int msec = 0);
explicit Time(int hour24, int minute, int second, int msec = 0);
~Time() = default;
static Time FromSystem();
@@ -133,7 +133,7 @@ public:
bool operator>(const Time& other) const { return m_ms > other.m_ms; }
bool operator>=(const Time& other) const { return m_ms >= other.m_ms; }
Time& operator=(const Time& other) = default;
Time& operator=(const Time& other) = default;
Time& operator=(Time&& other) noexcept = default;
Time operator+(int secs) const;
Time operator-(int secs) const;
@@ -150,8 +150,8 @@ public:
DateTime() = default;
explicit DateTime(const Date& d): m_date(d) {}
explicit DateTime(const Time& t): m_time(t) {}
DateTime(const Date& d, const Time& t): m_date(d), m_time(t) {}
DateTime(const Time& t, const Date& d): m_date(d), m_time(t) {}
explicit DateTime(const Date& d, const Time& t): m_date(d), m_time(t) {}
explicit DateTime(const Time& t, const Date& d): m_date(d), m_time(t) {}
DateTime(const DateTime& dt) = default;
DateTime(DateTime&& dt) noexcept = default;
~DateTime() = default;
@@ -178,7 +178,7 @@ public:
String ToString(const char* format = "YYYY.MM.DD HH24:MI:SS", LanguageId lang_id = LanguageId::English) const;
DateTime& operator=(const DateTime& other) = default;
DateTime& operator=(const DateTime& other) = default;
DateTime& operator=(DateTime&& other) noexcept = default;
bool operator==(const DateTime& other) const { return m_date == other.m_date && m_time == other.m_time; }
+4
View File
@@ -27,6 +27,10 @@ bool dbg_is_debugger_present();
} // namespace Kyty::Core
//#if KYTY_COMPILER == KYTY_COMPILER_MINGW
//#pragma GCC diagnostic ignored "-Warray-bounds"
//#endif
#if KYTY_PLATFORM == KYTY_PLATFORM_WINDOWS
#define ASSERT_HALT() \
(Kyty::Core::dbg_is_debugger_present() ? (::fflush(nullptr), *(reinterpret_cast<volatile int*>(1)) = 0) : (std::_Exit(321), 1))
+3 -2
View File
@@ -111,7 +111,7 @@ public:
V& operator[](const K& key)
{
V def;
V def {};
return *(static_cast<V*>(m_b.OperatorSquareBrackets(&key, &def)));
}
@@ -155,7 +155,8 @@ public:
return false;
}
bool ok = true;
auto callback = [&ok, &other](const K* key, const V* value) {
auto callback = [&ok, &other](const K* key, const V* value)
{
if (!(other.Find(*key) && other.Get(*key) == *value))
{
ok = false;
+6 -3
View File
@@ -27,7 +27,7 @@ using ListIndex = struct
index = (list).Prev(index)) /* NOLINT(bugprone-macro-parentheses) */
template <typename T>
class ListNode
class ListNode final
{
/*private:*/
@@ -35,7 +35,7 @@ class ListNode
explicit ListNode(const T& v): m_value(v), m_next(this), m_prev(this) {}
virtual ~ListNode() { Remove(); }
/*virtual*/ ~ListNode() { Remove(); }
void Remove()
{
@@ -263,7 +263,10 @@ public:
if (this != &list)
{
Clear();
FOR_LIST(index, list) { add(list[index]); }
FOR_LIST(index, list)
{
add(list[index]);
}
}
return *this;
}
+7 -6
View File
@@ -38,7 +38,8 @@ public:
using SortSwapFunc = void (*)(T*, int32_t, int32_t, void*);
using SortCompareFunc = bool (*)(const T&, const T&);
static constexpr size_t SIZEOF_T = sizeof(T); // NOLINT(bugprone-sizeof-expression)
static constexpr size_t SIZEOF_T = sizeof(T); // NOLINT(bugprone-sizeof-expression)
static constexpr uint32_t INVALID_INDEX = static_cast<uint32_t>(-1);
SimpleArray() = default;
@@ -191,7 +192,7 @@ public:
return index;
}
}
return uint32_t(-1);
return INVALID_INDEX;
}
template <typename OP>
@@ -204,7 +205,7 @@ public:
return index;
}
}
return uint32_t(-1);
return INVALID_INDEX;
}
template <typename T2, typename OP>
@@ -217,7 +218,7 @@ public:
return index;
}
}
return uint32_t(-1);
return INVALID_INDEX;
}
template <typename T2, typename OP, typename V>
@@ -242,13 +243,13 @@ public:
return index;
}
}
return uint32_t(-1);
return INVALID_INDEX;
}
bool Remove(const T& t)
{
uint32_t index = Find(t);
if (index == uint32_t(-1))
if (index == INVALID_INDEX)
{
return false;
}
+2 -2
View File
@@ -251,12 +251,12 @@ public:
[[nodiscard]] const_iterator cend() const { return GetDataConst() + Size(); } // NOLINT(readability-identifier-naming)
private:
String(const char32_t* array, uint32_t size);
explicit String(const char32_t* array, uint32_t size);
// String(const uint8_t *utf8_str);
// String(const char16_t *utf16_str);
template <class T, class OP>
String(const T* str, OP&& read, uint32_t size = 0, bool with_size = false): m_data(new DataType)
explicit String(const T* str, OP&& read, uint32_t size = 0, bool with_size = false): m_data(new DataType)
{
if (str == nullptr)
{
+4 -2
View File
@@ -18,6 +18,8 @@ public:
using SortSwapFunc = typename A::SortSwapFunc;
using SortCompareFunc = typename A::SortCompareFunc;
static constexpr uint32_t INVALID_INDEX = static_cast<uint32_t>(-1);
VectorBase(): m_data(new DataType) {}
VectorBase(const VectorType& src) { src.m_data->CopyPtr(&m_data, src.m_data); }
@@ -162,12 +164,12 @@ public:
return m_data->Find(t2, t3, op_eq);
}
[[nodiscard]] bool Contains(const T& t) const { return Find(t) != uint32_t(-1); }
[[nodiscard]] bool Contains(const T& t) const { return Find(t) != INVALID_INDEX; }
template <typename T2, typename OP>
bool Contains(const T2& t, OP&& op_eq) const
{
return Find(t, op_eq) != uint32_t(-1);
return Find(t, op_eq) != INVALID_INDEX;
}
bool Remove(const T& t)
+3 -3
View File
@@ -53,7 +53,7 @@ inline void SwapByteOrder(T& x)
{
if (std::is_signed_v<T>)
{
x = std::make_signed_t<T>(SwapByteOrder16(std::make_unsigned_t<uint16_t>(x)));
x = static_cast<std::make_signed_t<T>>(SwapByteOrder16(static_cast<std::make_unsigned_t<uint16_t>>(x)));
} else
{
x = SwapByteOrder16(x);
@@ -63,7 +63,7 @@ inline void SwapByteOrder(T& x)
{
if (std::is_signed_v<T>)
{
x = std::make_signed_t<T>(SwapByteOrder32(std::make_unsigned_t<uint32_t>(x)));
x = static_cast<std::make_signed_t<T>>(SwapByteOrder32(static_cast<std::make_unsigned_t<uint32_t>>(x)));
} else
{
x = SwapByteOrder32(x);
@@ -73,7 +73,7 @@ inline void SwapByteOrder(T& x)
{
if (std::is_signed_v<T>)
{
x = std::make_signed_t<T>(SwapByteOrder64(std::make_unsigned_t<uint64_t>(x)));
x = static_cast<std::make_signed_t<T>>(SwapByteOrder64(static_cast<std::make_unsigned_t<uint64_t>>(x)));
} else
{
x = SwapByteOrder64(x);