From fdafddafa0b4aa8ce7237acd2ee8b90eb54ff78e Mon Sep 17 00:00:00 2001 From: Adam Ierymenko Date: Tue, 20 Apr 2021 18:57:19 -0400 Subject: [PATCH] Warning removal. --- core/Buf.hpp | 64 +++++++++++++------------- core/Dictionary.cpp | 22 ++++----- core/Dictionary.hpp | 66 +++++++++++++-------------- core/FCV.hpp | 54 +++++++++++----------- core/InetAddress.cpp | 38 ++++++++-------- core/InetAddress.hpp | 104 +++++++++++++++++++++---------------------- 6 files changed, 174 insertions(+), 174 deletions(-) diff --git a/core/Buf.hpp b/core/Buf.hpp index cb07b7e50..4326d87f2 100644 --- a/core/Buf.hpp +++ b/core/Buf.hpp @@ -286,7 +286,7 @@ public: /** * Set all memory to zero */ - ZT_MAYBE_UNUSED ZT_INLINE void clear() noexcept + ZT_INLINE void clear() noexcept { Utils::zero< ZT_BUF_MEM_SIZE >(unsafeData); } @@ -297,7 +297,7 @@ public: * @param ii Index value-result parameter (incremented by 1) * @return Byte (undefined on overflow) */ - ZT_MAYBE_UNUSED ZT_INLINE uint8_t rI8(int &ii) const noexcept + ZT_INLINE uint8_t rI8(int &ii) const noexcept { const int s = ii++; return unsafeData[(unsigned int)s & ZT_BUF_MEM_MASK]; @@ -309,7 +309,7 @@ public: * @param ii Index value-result parameter (incremented by 2) * @return Integer (undefined on overflow) */ - ZT_MAYBE_UNUSED ZT_INLINE uint16_t rI16(int &ii) const noexcept + ZT_INLINE uint16_t rI16(int &ii) const noexcept { const unsigned int s = (unsigned int)ii & ZT_BUF_MEM_MASK; ii += 2; @@ -328,7 +328,7 @@ public: * @param ii Index value-result parameter (incremented by 4) * @return Integer (undefined on overflow) */ - ZT_MAYBE_UNUSED ZT_INLINE uint32_t rI32(int &ii) const noexcept + ZT_INLINE uint32_t rI32(int &ii) const noexcept { const unsigned int s = (unsigned int)ii & ZT_BUF_MEM_MASK; ii += 4; @@ -349,7 +349,7 @@ public: * @param ii Index value-result parameter (incremented by 8) * @return Integer (undefined on overflow) */ - ZT_MAYBE_UNUSED ZT_INLINE uint64_t rI64(int &ii) const noexcept + ZT_INLINE uint64_t rI64(int &ii) const noexcept { const unsigned int s = (unsigned int)ii & ZT_BUF_MEM_MASK; ii += 8; @@ -384,7 +384,7 @@ public: * @return Bytes read or a negative value on unmarshal error (passed from object) or overflow */ template< typename T > - ZT_MAYBE_UNUSED ZT_INLINE int rO(int &ii, T &obj) const noexcept + ZT_INLINE int rO(int &ii, T &obj) const noexcept { if (likely(ii < ZT_BUF_MEM_SIZE)) { int ms = obj.unmarshal(unsafeData + ii, ZT_BUF_MEM_SIZE - ii); @@ -406,7 +406,7 @@ public: * @param bufSize Capacity of buffer in bytes * @return Pointer to buf or NULL on overflow or error */ - ZT_MAYBE_UNUSED ZT_INLINE char *rS(int &ii, char *const buf, const unsigned int bufSize) const noexcept + ZT_INLINE char *rS(int &ii, char *const buf, const unsigned int bufSize) const noexcept { const char *const s = (const char *)(unsafeData + ii); const int sii = ii; @@ -435,7 +435,7 @@ public: * @param ii Index value-result parameter (incremented by length of string) * @return Pointer to null-terminated C-style string or NULL on overflow or error */ - ZT_MAYBE_UNUSED ZT_INLINE const char *rSnc(int &ii) const noexcept + ZT_INLINE const char *rSnc(int &ii) const noexcept { const char *const s = (const char *)(unsafeData + ii); while (ii < ZT_BUF_MEM_SIZE) { @@ -456,7 +456,7 @@ public: * @param len Length of buffer * @return Pointer to data or NULL on overflow or error */ - ZT_MAYBE_UNUSED ZT_INLINE uint8_t *rB(int &ii, void *const bytes, const unsigned int len) const noexcept + ZT_INLINE uint8_t *rB(int &ii, void *const bytes, const unsigned int len) const noexcept { if (likely(((ii += (int)len) <= ZT_BUF_MEM_SIZE))) { Utils::copy(bytes, unsafeData + ii, len); @@ -478,7 +478,7 @@ public: * @param len Length of data field to obtain a pointer to * @return Pointer to field or NULL on overflow */ - ZT_MAYBE_UNUSED ZT_INLINE const uint8_t *rBnc(int &ii, unsigned int len) const noexcept + ZT_INLINE const uint8_t *rBnc(int &ii, unsigned int len) const noexcept { const uint8_t *const b = unsafeData + ii; return ((ii += (int)len) <= ZT_BUF_MEM_SIZE) ? b : nullptr; @@ -491,7 +491,7 @@ public: * @return Value */ template< unsigned int I > - ZT_MAYBE_UNUSED ZT_INLINE uint8_t lI8() const noexcept + ZT_INLINE uint8_t lI8() const noexcept { static_assert(I < ZT_BUF_MEM_SIZE, "overflow"); return unsafeData[I]; @@ -504,7 +504,7 @@ public: * @return Value */ template< unsigned int I > - ZT_MAYBE_UNUSED ZT_INLINE uint8_t lI16() const noexcept + ZT_INLINE uint8_t lI16() const noexcept { static_assert((I + 1) < ZT_BUF_MEM_SIZE, "overflow"); #ifdef ZT_NO_UNALIGNED_ACCESS @@ -523,7 +523,7 @@ public: * @return Value */ template< unsigned int I > - ZT_MAYBE_UNUSED ZT_INLINE uint8_t lI32() const noexcept + ZT_INLINE uint8_t lI32() const noexcept { static_assert((I + 3) < ZT_BUF_MEM_SIZE, "overflow"); #ifdef ZT_NO_UNALIGNED_ACCESS @@ -544,7 +544,7 @@ public: * @return Value */ template< unsigned int I > - ZT_MAYBE_UNUSED ZT_INLINE uint8_t lI64() const noexcept + ZT_INLINE uint8_t lI64() const noexcept { static_assert((I + 7) < ZT_BUF_MEM_SIZE, "overflow"); #ifdef ZT_NO_UNALIGNED_ACCESS @@ -569,7 +569,7 @@ public: * will not necessarily result in a 'true' return from readOverflow(). It does * however subject 'ii' to soft bounds masking like the gI??() methods. */ - ZT_MAYBE_UNUSED ZT_INLINE uint8_t lI8(const int ii) const noexcept + ZT_INLINE uint8_t lI8(const int ii) const noexcept { return unsafeData[(unsigned int)ii & ZT_BUF_MEM_MASK]; } @@ -581,7 +581,7 @@ public: * will not necessarily result in a 'true' return from readOverflow(). It does * however subject 'ii' to soft bounds masking like the gI??() methods. */ - ZT_MAYBE_UNUSED ZT_INLINE uint16_t lI16(const int ii) const noexcept + ZT_INLINE uint16_t lI16(const int ii) const noexcept { const unsigned int s = (unsigned int)ii & ZT_BUF_MEM_MASK; #ifdef ZT_NO_UNALIGNED_ACCESS @@ -600,7 +600,7 @@ public: * will not necessarily result in a 'true' return from readOverflow(). It does * however subject 'ii' to soft bounds masking like the gI??() methods. */ - ZT_MAYBE_UNUSED ZT_INLINE uint32_t lI32(const int ii) const noexcept + ZT_INLINE uint32_t lI32(const int ii) const noexcept { const unsigned int s = (unsigned int)ii & ZT_BUF_MEM_MASK; #ifdef ZT_NO_UNALIGNED_ACCESS @@ -621,7 +621,7 @@ public: * will not necessarily result in a 'true' return from readOverflow(). It does * however subject 'ii' to soft bounds masking like the gI??() methods. */ - ZT_MAYBE_UNUSED ZT_INLINE uint8_t lI64(const int ii) const noexcept + ZT_INLINE uint8_t lI64(const int ii) const noexcept { const unsigned int s = (unsigned int)ii & ZT_BUF_MEM_MASK; #ifdef ZT_NO_UNALIGNED_ACCESS @@ -645,7 +645,7 @@ public: * @param ii Index value-result parameter (incremented by 1) * @param n Byte */ - ZT_MAYBE_UNUSED ZT_INLINE void wI8(int &ii, const uint8_t n) noexcept + ZT_INLINE void wI8(int &ii, const uint8_t n) noexcept { const int s = ii++; unsafeData[(unsigned int)s & ZT_BUF_MEM_MASK] = n; @@ -657,7 +657,7 @@ public: * @param ii Index value-result parameter (incremented by 2) * @param n Integer */ - ZT_MAYBE_UNUSED ZT_INLINE void wI16(int &ii, const uint16_t n) noexcept + ZT_INLINE void wI16(int &ii, const uint16_t n) noexcept { const unsigned int s = ((unsigned int)ii) & ZT_BUF_MEM_MASK; ii += 2; @@ -675,7 +675,7 @@ public: * @param ii Index value-result parameter (incremented by 4) * @param n Integer */ - ZT_MAYBE_UNUSED ZT_INLINE void wI32(int &ii, const uint32_t n) noexcept + ZT_INLINE void wI32(int &ii, const uint32_t n) noexcept { const unsigned int s = ((unsigned int)ii) & ZT_BUF_MEM_MASK; ii += 4; @@ -695,7 +695,7 @@ public: * @param ii Index value-result parameter (incremented by 8) * @param n Integer */ - ZT_MAYBE_UNUSED ZT_INLINE void wI64(int &ii, const uint64_t n) noexcept + ZT_INLINE void wI64(int &ii, const uint64_t n) noexcept { const unsigned int s = ((unsigned int)ii) & ZT_BUF_MEM_MASK; ii += 8; @@ -721,7 +721,7 @@ public: * @param t Object to write */ template< typename T > - ZT_MAYBE_UNUSED ZT_INLINE void wO(int &ii, T &t) noexcept + ZT_INLINE void wO(int &ii, T &t) noexcept { const int s = ii; if (likely((s + T::marshalSizeMax()) <= ZT_BUF_MEM_SIZE)) { @@ -739,7 +739,7 @@ public: * @param ii Index value-result parameter (incremented by length of string) * @param s String to write (writes an empty string if this is NULL) */ - ZT_MAYBE_UNUSED ZT_INLINE void wS(int &ii, const char *s) noexcept + ZT_INLINE void wS(int &ii, const char *s) noexcept { if (s) { char c; @@ -759,7 +759,7 @@ public: * @param bytes Bytes to write * @param len Size of data in bytes */ - ZT_MAYBE_UNUSED ZT_INLINE void wB(int &ii, const void *const bytes, const unsigned int len) noexcept + ZT_INLINE void wB(int &ii, const void *const bytes, const unsigned int len) noexcept { const int s = ii; if (likely((ii += (int)len) <= ZT_BUF_MEM_SIZE)) @@ -772,7 +772,7 @@ public: * @param ii Index value-result parameter (incremented by len) * @param len Number of zero bytes to write */ - ZT_MAYBE_UNUSED ZT_INLINE void wZ(int &ii, const unsigned int len) noexcept + ZT_INLINE void wZ(int &ii, const unsigned int len) noexcept { const int s = ii; if (likely((ii += (int)len) <= ZT_BUF_MEM_SIZE)) @@ -785,7 +785,7 @@ public: * @param ii Index value-result parameter (incremented by len) * @param len Number of random bytes to write */ - ZT_MAYBE_UNUSED ZT_INLINE void wR(int &ii, const unsigned int len) noexcept + ZT_INLINE void wR(int &ii, const unsigned int len) noexcept { const int s = ii; if (likely((ii += (int)len) <= ZT_BUF_MEM_SIZE)) @@ -795,7 +795,7 @@ public: /** * Store a byte without advancing the index */ - ZT_MAYBE_UNUSED ZT_INLINE void sI8(const int ii, const uint8_t n) noexcept + ZT_INLINE void sI8(const int ii, const uint8_t n) noexcept { unsafeData[(unsigned int)ii & ZT_BUF_MEM_MASK] = n; } @@ -803,7 +803,7 @@ public: /** * Store an integer without advancing the index */ - ZT_MAYBE_UNUSED ZT_INLINE void sI16(const int ii, const uint16_t n) noexcept + ZT_INLINE void sI16(const int ii, const uint16_t n) noexcept { const unsigned int s = ((unsigned int)ii) & ZT_BUF_MEM_MASK; #ifdef ZT_NO_UNALIGNED_ACCESS @@ -817,7 +817,7 @@ public: /** * Store an integer without advancing the index */ - ZT_MAYBE_UNUSED ZT_INLINE void sI32(const int ii, const uint32_t n) noexcept + ZT_INLINE void sI32(const int ii, const uint32_t n) noexcept { const unsigned int s = ((unsigned int)ii) & ZT_BUF_MEM_MASK; #ifdef ZT_NO_UNALIGNED_ACCESS @@ -833,7 +833,7 @@ public: /** * Store an integer without advancing the index */ - ZT_MAYBE_UNUSED ZT_INLINE void sI64(const int ii, const uint64_t n) noexcept + ZT_INLINE void sI64(const int ii, const uint64_t n) noexcept { const unsigned int s = ((unsigned int)ii) & ZT_BUF_MEM_MASK; #ifdef ZT_NO_UNALIGNED_ACCESS @@ -853,7 +853,7 @@ public: /** * @return Capacity of this buffer (usable size of data.bytes) */ - ZT_MAYBE_UNUSED static constexpr unsigned int capacity() noexcept + static constexpr unsigned int capacity() noexcept { return ZT_BUF_MEM_SIZE; } private: diff --git a/core/Dictionary.cpp b/core/Dictionary.cpp index 0139189b6..d43689f93 100644 --- a/core/Dictionary.cpp +++ b/core/Dictionary.cpp @@ -15,24 +15,24 @@ namespace ZeroTier { -ZT_MAYBE_UNUSED Vector< uint8_t > &Dictionary::operator[](const char *const k) +Vector< uint8_t > &Dictionary::operator[](const char *const k) { return m_entries[k]; } -ZT_MAYBE_UNUSED const Vector< uint8_t > &Dictionary::operator[](const char *const k) const +const Vector< uint8_t > &Dictionary::operator[](const char *const k) const { static const Vector< uint8_t > s_emptyEntry; const SortedMap< String, Vector< uint8_t > >::const_iterator e(m_entries.find(k)); return (e == m_entries.end()) ? s_emptyEntry : e->second; } -ZT_MAYBE_UNUSED void Dictionary::add(const char *k, const Address &v) +void Dictionary::add(const char *k, const Address &v) { char tmp[ZT_ADDRESS_STRING_SIZE_MAX]; v.toString(tmp); add(k, tmp); } -ZT_MAYBE_UNUSED void Dictionary::add(const char *k, const char *v) +void Dictionary::add(const char *k, const char *v) { Vector< uint8_t > &e = (*this)[k]; e.clear(); @@ -42,7 +42,7 @@ ZT_MAYBE_UNUSED void Dictionary::add(const char *k, const char *v) } } -ZT_MAYBE_UNUSED void Dictionary::add(const char *k, const void *data, unsigned int len) +void Dictionary::add(const char *k, const void *data, unsigned int len) { Vector< uint8_t > &e = (*this)[k]; if (likely(len != 0)) { @@ -52,7 +52,7 @@ ZT_MAYBE_UNUSED void Dictionary::add(const char *k, const void *data, unsigned i } } -ZT_MAYBE_UNUSED uint64_t Dictionary::getUI(const char *k, uint64_t dfl) const +uint64_t Dictionary::getUI(const char *k, uint64_t dfl) const { char tmp[32]; getS(k, tmp, sizeof(tmp)); @@ -61,7 +61,7 @@ ZT_MAYBE_UNUSED uint64_t Dictionary::getUI(const char *k, uint64_t dfl) const return dfl; } -ZT_MAYBE_UNUSED char *Dictionary::getS(const char *k, char *v, const unsigned int cap) const +char *Dictionary::getS(const char *k, char *v, const unsigned int cap) const { if (cap == 0) // sanity check return v; @@ -84,10 +84,10 @@ ZT_MAYBE_UNUSED char *Dictionary::getS(const char *k, char *v, const unsigned in return v; } -ZT_MAYBE_UNUSED void Dictionary::clear() +void Dictionary::clear() { m_entries.clear(); } -ZT_MAYBE_UNUSED void Dictionary::encode(Vector< uint8_t > &out) const +void Dictionary::encode(Vector< uint8_t > &out) const { out.clear(); for (SortedMap< String, Vector< uint8_t > >::const_iterator ti(m_entries.begin()); ti != m_entries.end(); ++ti) { @@ -98,7 +98,7 @@ ZT_MAYBE_UNUSED void Dictionary::encode(Vector< uint8_t > &out) const } } -ZT_MAYBE_UNUSED bool Dictionary::decode(const void *data, unsigned int len) +bool Dictionary::decode(const void *data, unsigned int len) { clear(); String k; @@ -151,7 +151,7 @@ ZT_MAYBE_UNUSED bool Dictionary::decode(const void *data, unsigned int len) return true; } -ZT_MAYBE_UNUSED char *Dictionary::arraySubscript(char *buf, unsigned int bufSize, const char *name, const unsigned long sub) noexcept +char *Dictionary::arraySubscript(char *buf, unsigned int bufSize, const char *name, const unsigned long sub) noexcept { if (bufSize < 17) { // sanity check buf[0] = 0; diff --git a/core/Dictionary.hpp b/core/Dictionary.hpp index 4b9bac04b..9db887e9c 100644 --- a/core/Dictionary.hpp +++ b/core/Dictionary.hpp @@ -81,7 +81,7 @@ public: * @param k Key to look up * @return Reference to value */ - ZT_MAYBE_UNUSED Vector< uint8_t > &operator[](const char *k); + Vector< uint8_t > &operator[](const char *k); /** * Get a const reference to a value @@ -89,18 +89,18 @@ public: * @param k Key to look up * @return Reference to value or to empty vector if not found */ - ZT_MAYBE_UNUSED const Vector< uint8_t > &operator[](const char *k) const; + const Vector< uint8_t > &operator[](const char *k) const; /** * @return Start of key->value pairs */ - ZT_MAYBE_UNUSED ZT_INLINE const_iterator begin() const noexcept + ZT_INLINE const_iterator begin() const noexcept { return m_entries.begin(); } /** * @return End of key->value pairs */ - ZT_MAYBE_UNUSED ZT_INLINE const_iterator end() const noexcept + ZT_INLINE const_iterator end() const noexcept { return m_entries.end(); } /** @@ -109,7 +109,7 @@ public: * @param k Key to set * @param v Integer to set, will be cast to uint64_t and stored as hex */ - ZT_MAYBE_UNUSED ZT_INLINE void add(const char *const k, const uint64_t v) + ZT_INLINE void add(const char *const k, const uint64_t v) { char buf[24]; add(k, Utils::hex((uint64_t)(v), buf)); @@ -121,7 +121,7 @@ public: * @param k Key to set * @param v Integer to set, will be cast to uint64_t and stored as hex */ - ZT_MAYBE_UNUSED ZT_INLINE void add(const char *const k, const int64_t v) + ZT_INLINE void add(const char *const k, const int64_t v) { char buf[24]; add(k, Utils::hex((uint64_t)(v), buf)); @@ -130,17 +130,17 @@ public: /** * Add an address in 10-digit hex string format */ - ZT_MAYBE_UNUSED void add(const char *k, const Address &v); + void add(const char *k, const Address &v); /** * Add a C string as a value */ - ZT_MAYBE_UNUSED void add(const char *k, const char *v); + void add(const char *k, const char *v); /** * Add a binary blob as a value */ - ZT_MAYBE_UNUSED void add(const char *k, const void *data, unsigned int len); + void add(const char *k, const void *data, unsigned int len); /** * Get an integer @@ -149,7 +149,7 @@ public: * @param dfl Default value (default: 0) * @return Value of key or default if not found */ - ZT_MAYBE_UNUSED uint64_t getUI(const char *k, uint64_t dfl = 0) const; + uint64_t getUI(const char *k, uint64_t dfl = 0) const; /** * Get a C string @@ -161,7 +161,7 @@ public: * @param v Buffer to hold string * @param cap Maximum size of string (including terminating null) */ - ZT_MAYBE_UNUSED char *getS(const char *k, char *v, unsigned int cap) const; + char *getS(const char *k, char *v, unsigned int cap) const; /** * Get an object supporting the marshal/unmarshal interface pattern @@ -172,7 +172,7 @@ public: * @return True if unmarshal was successful */ template< typename T > - ZT_MAYBE_UNUSED ZT_INLINE bool getO(const char *k, T &obj) const + ZT_INLINE bool getO(const char *k, T &obj) const { const Vector< uint8_t > &d = (*this)[k]; if (d.empty()) @@ -189,7 +189,7 @@ public: * @return True if successful */ template< typename T > - ZT_MAYBE_UNUSED ZT_INLINE bool addO(const char *k, T &obj) + ZT_INLINE bool addO(const char *k, T &obj) { Vector< uint8_t > &d = (*this)[k]; d.resize(T::marshalSizeMax()); @@ -205,18 +205,18 @@ public: /** * Erase all entries in dictionary */ - ZT_MAYBE_UNUSED void clear(); + void clear(); /** * @return Number of entries */ - ZT_MAYBE_UNUSED ZT_INLINE unsigned int size() const noexcept + ZT_INLINE unsigned int size() const noexcept { return (unsigned int)m_entries.size(); } /** * @return True if dictionary is not empty */ - ZT_MAYBE_UNUSED ZT_INLINE bool empty() const noexcept + ZT_INLINE bool empty() const noexcept { return m_entries.empty(); } /** @@ -224,7 +224,7 @@ public: * * @param out String encoded dictionary */ - ZT_MAYBE_UNUSED void encode(Vector< uint8_t > &out) const; + void encode(Vector< uint8_t > &out) const; /** * Decode a string encoded dictionary @@ -236,7 +236,7 @@ public: * @param len Length of data * @return True if dictionary was formatted correctly and valid, false on error */ - ZT_MAYBE_UNUSED bool decode(const void *data, unsigned int len); + bool decode(const void *data, unsigned int len); /** * Append a key=value pair to a buffer (vector or FCV) @@ -246,7 +246,7 @@ public: * @param v Value */ template< typename V > - ZT_MAYBE_UNUSED ZT_INLINE static void append(V &out, const char *const k, const bool v) + ZT_INLINE static void append(V &out, const char *const k, const bool v) { s_appendKey(out, k); out.push_back((uint8_t)(v ? '1' : '0')); @@ -261,7 +261,7 @@ public: * @param v Value */ template< typename V > - ZT_MAYBE_UNUSED ZT_INLINE static void append(V &out, const char *const k, const Address v) + ZT_INLINE static void append(V &out, const char *const k, const Address v) { s_appendKey(out, k); const uint64_t a = v.toInt(); @@ -287,7 +287,7 @@ public: * @param v Value */ template< typename V > - ZT_MAYBE_UNUSED ZT_INLINE static void append(V &out, const char *const k, const uint64_t v) + ZT_INLINE static void append(V &out, const char *const k, const uint64_t v) { s_appendKey(out, k); char buf[17]; @@ -299,31 +299,31 @@ public: } template< typename V > - ZT_MAYBE_UNUSED ZT_INLINE static void append(V &out, const char *const k, const int64_t v) + ZT_INLINE static void append(V &out, const char *const k, const int64_t v) { append(out, k, (uint64_t)v); } template< typename V > - ZT_MAYBE_UNUSED ZT_INLINE static void append(V &out, const char *const k, const uint32_t v) + ZT_INLINE static void append(V &out, const char *const k, const uint32_t v) { append(out, k, (uint64_t)v); } template< typename V > - ZT_MAYBE_UNUSED ZT_INLINE static void append(V &out, const char *const k, const int32_t v) + ZT_INLINE static void append(V &out, const char *const k, const int32_t v) { append(out, k, (uint64_t)v); } template< typename V > - ZT_MAYBE_UNUSED ZT_INLINE static void append(V &out, const char *const k, const uint16_t v) + ZT_INLINE static void append(V &out, const char *const k, const uint16_t v) { append(out, k, (uint64_t)v); } template< typename V > - ZT_MAYBE_UNUSED ZT_INLINE static void append(V &out, const char *const k, const int16_t v) + ZT_INLINE static void append(V &out, const char *const k, const int16_t v) { append(out, k, (uint64_t)v); } template< typename V > - ZT_MAYBE_UNUSED ZT_INLINE static void append(V &out, const char *const k, const uint8_t v) + ZT_INLINE static void append(V &out, const char *const k, const uint8_t v) { append(out, k, (uint64_t)v); } template< typename V > - ZT_MAYBE_UNUSED ZT_INLINE static void append(V &out, const char *const k, const int8_t v) + ZT_INLINE static void append(V &out, const char *const k, const int8_t v) { append(out, k, (uint64_t)v); } /** @@ -334,7 +334,7 @@ public: * @param v Value */ template< typename V > - ZT_MAYBE_UNUSED ZT_INLINE static void append(V &out, const char *const k, const char *v) + ZT_INLINE static void append(V &out, const char *const k, const char *v) { if ((v) && (*v)) { s_appendKey(out, k); @@ -353,7 +353,7 @@ public: * @param vlen Value length in bytes */ template< typename V > - ZT_MAYBE_UNUSED ZT_INLINE static void append(V &out, const char *const k, const void *const v, const unsigned int vlen) + ZT_INLINE static void append(V &out, const char *const k, const void *const v, const unsigned int vlen) { s_appendKey(out, k); for (unsigned int i = 0; i < vlen; ++i) @@ -369,7 +369,7 @@ public: * @param pid Packet ID */ template< typename V > - ZT_MAYBE_UNUSED static ZT_INLINE void appendPacketId(V &out, const char *const k, const uint64_t pid) + static ZT_INLINE void appendPacketId(V &out, const char *const k, const uint64_t pid) { append(out, k, &pid, 8); } /** @@ -381,7 +381,7 @@ public: * @return Bytes appended or negative on error (return value of marshal()) */ template< typename V, typename T > - ZT_MAYBE_UNUSED static ZT_INLINE int appendObject(V &out, const char *const k, const T &v) + static ZT_INLINE int appendObject(V &out, const char *const k, const T &v) { uint8_t tmp[2048]; // large enough for any current object if (T::marshalSizeMax() > sizeof(tmp)) @@ -400,7 +400,7 @@ public: * @param sub Subscript index * @return Pointer to 'buf' */ - ZT_MAYBE_UNUSED static char *arraySubscript(char *buf, unsigned int bufSize, const char *name, const unsigned long sub) noexcept; + static char *arraySubscript(char *buf, unsigned int bufSize, const char *name, const unsigned long sub) noexcept; private: template< typename V > diff --git a/core/FCV.hpp b/core/FCV.hpp index ab3628d1f..ebac2f458 100644 --- a/core/FCV.hpp +++ b/core/FCV.hpp @@ -81,7 +81,7 @@ public: /** * Clear this vector, destroying all content objects */ - ZT_MAYBE_UNUSED ZT_INLINE void clear() + ZT_INLINE void clear() { const unsigned int s = _s; _s = 0; @@ -94,51 +94,51 @@ public: * * @param v Target vector */ - ZT_MAYBE_UNUSED ZT_INLINE void unsafeMoveTo(FCV &v) noexcept + ZT_INLINE void unsafeMoveTo(FCV &v) noexcept { Utils::copy(v._m, _m, (v._s = _s) * sizeof(T)); _s = 0; } - ZT_MAYBE_UNUSED ZT_INLINE iterator begin() noexcept + ZT_INLINE iterator begin() noexcept { return reinterpret_cast(_m); } - ZT_MAYBE_UNUSED ZT_INLINE iterator end() noexcept + ZT_INLINE iterator end() noexcept { return reinterpret_cast(_m) + _s; } - ZT_MAYBE_UNUSED ZT_INLINE const_iterator begin() const noexcept + ZT_INLINE const_iterator begin() const noexcept { return reinterpret_cast(_m); } - ZT_MAYBE_UNUSED ZT_INLINE const_iterator end() const noexcept + ZT_INLINE const_iterator end() const noexcept { return reinterpret_cast(_m) + _s; } - ZT_MAYBE_UNUSED ZT_INLINE T &operator[](const unsigned int i) + ZT_INLINE T &operator[](const unsigned int i) { if (likely(i < _s)) return reinterpret_cast(_m)[i]; throw Utils::OutOfRangeException; } - ZT_MAYBE_UNUSED ZT_INLINE const T &operator[](const unsigned int i) const + ZT_INLINE const T &operator[](const unsigned int i) const { if (likely(i < _s)) return reinterpret_cast(_m)[i]; throw Utils::OutOfRangeException; } - ZT_MAYBE_UNUSED static constexpr unsigned int capacity() noexcept + static constexpr unsigned int capacity() noexcept { return C; } - ZT_MAYBE_UNUSED ZT_INLINE unsigned int size() const noexcept + ZT_INLINE unsigned int size() const noexcept { return _s; } - ZT_MAYBE_UNUSED ZT_INLINE bool empty() const noexcept + ZT_INLINE bool empty() const noexcept { return (_s == 0); } - ZT_MAYBE_UNUSED ZT_INLINE T *data() noexcept + ZT_INLINE T *data() noexcept { return reinterpret_cast(_m); } - ZT_MAYBE_UNUSED ZT_INLINE const T *data() const noexcept + ZT_INLINE const T *data() const noexcept { return reinterpret_cast(_m); } /** @@ -148,7 +148,7 @@ public: * * @param v Value to push */ - ZT_MAYBE_UNUSED ZT_INLINE void push_back(const T &v) + ZT_INLINE void push_back(const T &v) { if (likely(_s < C)) new(reinterpret_cast(_m) + _s++) T(v); @@ -160,7 +160,7 @@ public: * * @return Reference to new item */ - ZT_MAYBE_UNUSED ZT_INLINE T &push() + ZT_INLINE T &push() { if (likely(_s < C)) { return *(new(reinterpret_cast(_m) + _s++) T()); @@ -174,7 +174,7 @@ public: * * @return Reference to new item */ - ZT_MAYBE_UNUSED ZT_INLINE T &push(const T &v) + ZT_INLINE T &push(const T &v) { if (likely(_s < C)) { return *(new(reinterpret_cast(_m) + _s++) T(v)); @@ -188,7 +188,7 @@ public: /** * Remove the last element if this vector is not empty */ - ZT_MAYBE_UNUSED ZT_INLINE void pop_back() + ZT_INLINE void pop_back() { if (likely(_s != 0)) (reinterpret_cast(_m) + --_s)->~T(); @@ -199,7 +199,7 @@ public: * * @param ns New size (clipped to C if larger than capacity) */ - ZT_MAYBE_UNUSED ZT_INLINE void resize(unsigned int ns) + ZT_INLINE void resize(unsigned int ns) { if (unlikely(ns > C)) throw Utils::OutOfRangeException; @@ -216,7 +216,7 @@ public: * * @param ns New size */ - ZT_MAYBE_UNUSED ZT_INLINE void unsafeSetSize(unsigned int ns) + ZT_INLINE void unsafeSetSize(unsigned int ns) { _s = ns; } /** @@ -228,7 +228,7 @@ public: * @param i Index to obtain as a reference, resizing if needed * @return Reference to value at this index */ - ZT_MAYBE_UNUSED ZT_INLINE T &at(unsigned int i) + ZT_INLINE T &at(unsigned int i) { if (i >= _s) { if (unlikely(i >= C)) @@ -250,7 +250,7 @@ public: * @param end Ending iterator (must be greater than start) */ template< typename X > - ZT_MAYBE_UNUSED ZT_INLINE void assign(X start, const X &end) + ZT_INLINE void assign(X start, const X &end) { const int l = std::min((int)std::distance(start, end), (int)C); if (l > 0) { @@ -262,7 +262,7 @@ public: } } - ZT_MAYBE_UNUSED ZT_INLINE bool operator==(const FCV &v) const noexcept + ZT_INLINE bool operator==(const FCV &v) const noexcept { if (_s == v._s) { for (unsigned int i = 0; i < _s; ++i) { @@ -274,19 +274,19 @@ public: return false; } - ZT_MAYBE_UNUSED ZT_INLINE bool operator!=(const FCV &v) const noexcept + ZT_INLINE bool operator!=(const FCV &v) const noexcept { return *this != v; } - ZT_MAYBE_UNUSED ZT_INLINE bool operator<(const FCV &v) const noexcept + ZT_INLINE bool operator<(const FCV &v) const noexcept { return std::lexicographical_compare(begin(), end(), v.begin(), v.end()); } - ZT_MAYBE_UNUSED ZT_INLINE bool operator>(const FCV &v) const noexcept + ZT_INLINE bool operator>(const FCV &v) const noexcept { return (v < *this); } - ZT_MAYBE_UNUSED ZT_INLINE bool operator<=(const FCV &v) const noexcept + ZT_INLINE bool operator<=(const FCV &v) const noexcept { return v >= *this; } - ZT_MAYBE_UNUSED ZT_INLINE bool operator>=(const FCV &v) const noexcept + ZT_INLINE bool operator>=(const FCV &v) const noexcept { return *this >= v; } private: diff --git a/core/InetAddress.cpp b/core/InetAddress.cpp index 7d9f26dcc..277e9c8f6 100644 --- a/core/InetAddress.cpp +++ b/core/InetAddress.cpp @@ -27,7 +27,7 @@ const InetAddress InetAddress::LO4((const void *) ("\x7f\x00\x00\x01"), 4, 0); const InetAddress InetAddress::LO6((const void *) ("\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01"), 16, 0); const InetAddress InetAddress::NIL; -ZT_MAYBE_UNUSED InetAddress::IpScope InetAddress::ipScope() const noexcept +InetAddress::IpScope InetAddress::ipScope() const noexcept { switch (as.ss.ss_family) { @@ -112,7 +112,7 @@ ZT_MAYBE_UNUSED InetAddress::IpScope InetAddress::ipScope() const noexcept return ZT_IP_SCOPE_NONE; } -ZT_MAYBE_UNUSED void InetAddress::set(const void *ipBytes, unsigned int ipLen, unsigned int port) noexcept +void InetAddress::set(const void *ipBytes, unsigned int ipLen, unsigned int port) noexcept { memoryZero(this); if (ipLen == 4) { @@ -126,7 +126,7 @@ ZT_MAYBE_UNUSED void InetAddress::set(const void *ipBytes, unsigned int ipLen, u } } -ZT_MAYBE_UNUSED bool InetAddress::isDefaultRoute() const noexcept +bool InetAddress::isDefaultRoute() const noexcept { switch (as.ss.ss_family) { case AF_INET: @@ -145,7 +145,7 @@ ZT_MAYBE_UNUSED bool InetAddress::isDefaultRoute() const noexcept } } -ZT_MAYBE_UNUSED char *InetAddress::toString(char buf[ZT_INETADDRESS_STRING_SIZE_MAX]) const noexcept +char *InetAddress::toString(char buf[ZT_INETADDRESS_STRING_SIZE_MAX]) const noexcept { char *p = toIpString(buf); if (*p) { @@ -156,7 +156,7 @@ ZT_MAYBE_UNUSED char *InetAddress::toString(char buf[ZT_INETADDRESS_STRING_SIZE_ return buf; } -ZT_MAYBE_UNUSED char *InetAddress::toIpString(char buf[ZT_INETADDRESS_STRING_SIZE_MAX]) const noexcept +char *InetAddress::toIpString(char buf[ZT_INETADDRESS_STRING_SIZE_MAX]) const noexcept { buf[0] = (char) 0; switch (as.ss.ss_family) { @@ -170,7 +170,7 @@ ZT_MAYBE_UNUSED char *InetAddress::toIpString(char buf[ZT_INETADDRESS_STRING_SIZ return buf; } -ZT_MAYBE_UNUSED bool InetAddress::fromString(const char *ipSlashPort) noexcept +bool InetAddress::fromString(const char *ipSlashPort) noexcept { char buf[64]; @@ -205,7 +205,7 @@ ZT_MAYBE_UNUSED bool InetAddress::fromString(const char *ipSlashPort) noexcept return false; } -ZT_MAYBE_UNUSED InetAddress InetAddress::netmask() const noexcept +InetAddress InetAddress::netmask() const noexcept { InetAddress r(*this); switch (r.as.ss.ss_family) { @@ -229,7 +229,7 @@ ZT_MAYBE_UNUSED InetAddress InetAddress::netmask() const noexcept return r; } -ZT_MAYBE_UNUSED InetAddress InetAddress::broadcast() const noexcept +InetAddress InetAddress::broadcast() const noexcept { if (as.ss.ss_family == AF_INET) { InetAddress r(*this); @@ -239,7 +239,7 @@ ZT_MAYBE_UNUSED InetAddress InetAddress::broadcast() const noexcept return InetAddress(); } -ZT_MAYBE_UNUSED InetAddress InetAddress::network() const noexcept +InetAddress InetAddress::network() const noexcept { InetAddress r(*this); switch (r.as.ss.ss_family) { @@ -259,7 +259,7 @@ ZT_MAYBE_UNUSED InetAddress InetAddress::network() const noexcept return r; } -ZT_MAYBE_UNUSED bool InetAddress::isEqualPrefix(const InetAddress &addr) const noexcept +bool InetAddress::isEqualPrefix(const InetAddress &addr) const noexcept { if (addr.as.ss.ss_family == as.ss.ss_family) { switch (as.ss.ss_family) { @@ -281,7 +281,7 @@ ZT_MAYBE_UNUSED bool InetAddress::isEqualPrefix(const InetAddress &addr) const n return false; } -ZT_MAYBE_UNUSED bool InetAddress::containsAddress(const InetAddress &addr) const noexcept +bool InetAddress::containsAddress(const InetAddress &addr) const noexcept { if (addr.as.ss.ss_family == as.ss.ss_family) { switch (as.ss.ss_family) { @@ -310,7 +310,7 @@ ZT_MAYBE_UNUSED bool InetAddress::containsAddress(const InetAddress &addr) const return false; } -ZT_MAYBE_UNUSED bool InetAddress::isNetwork() const noexcept +bool InetAddress::isNetwork() const noexcept { switch (as.ss.ss_family) { case AF_INET: { @@ -342,7 +342,7 @@ ZT_MAYBE_UNUSED bool InetAddress::isNetwork() const noexcept return false; } -ZT_MAYBE_UNUSED int InetAddress::marshal(uint8_t data[ZT_INETADDRESS_MARSHAL_SIZE_MAX]) const noexcept +int InetAddress::marshal(uint8_t data[ZT_INETADDRESS_MARSHAL_SIZE_MAX]) const noexcept { unsigned int port; switch (as.ss.ss_family) { @@ -369,7 +369,7 @@ ZT_MAYBE_UNUSED int InetAddress::marshal(uint8_t data[ZT_INETADDRESS_MARSHAL_SIZ } } -ZT_MAYBE_UNUSED int InetAddress::unmarshal(const uint8_t *restrict data, const int len) noexcept +int InetAddress::unmarshal(const uint8_t *restrict data, const int len) noexcept { memoryZero(this); if (unlikely(len <= 0)) @@ -396,7 +396,7 @@ ZT_MAYBE_UNUSED int InetAddress::unmarshal(const uint8_t *restrict data, const i } } -ZT_MAYBE_UNUSED InetAddress InetAddress::makeIpv6LinkLocal(const MAC &mac) noexcept +InetAddress InetAddress::makeIpv6LinkLocal(const MAC &mac) noexcept { InetAddress r; r.as.sa_in6.sin6_family = AF_INET6; @@ -420,7 +420,7 @@ ZT_MAYBE_UNUSED InetAddress InetAddress::makeIpv6LinkLocal(const MAC &mac) noexc return r; } -ZT_MAYBE_UNUSED InetAddress InetAddress::makeIpv6rfc4193(uint64_t nwid, uint64_t zeroTierAddress) noexcept +InetAddress InetAddress::makeIpv6rfc4193(uint64_t nwid, uint64_t zeroTierAddress) noexcept { InetAddress r; r.as.sa_in6.sin6_family = AF_INET6; @@ -444,7 +444,7 @@ ZT_MAYBE_UNUSED InetAddress InetAddress::makeIpv6rfc4193(uint64_t nwid, uint64_t return r; } -ZT_MAYBE_UNUSED InetAddress InetAddress::makeIpv66plane(uint64_t nwid, uint64_t zeroTierAddress) noexcept +InetAddress InetAddress::makeIpv66plane(uint64_t nwid, uint64_t zeroTierAddress) noexcept { nwid ^= (nwid >> 32U); InetAddress r; @@ -465,8 +465,8 @@ ZT_MAYBE_UNUSED InetAddress InetAddress::makeIpv66plane(uint64_t nwid, uint64_t } extern "C" { -ZT_MAYBE_UNUSED extern const int ZT_AF_INET = (int)AF_INET; -ZT_MAYBE_UNUSED extern const int ZT_AF_INET6 = (int)AF_INET6; +extern const int ZT_AF_INET = (int)AF_INET; +extern const int ZT_AF_INET6 = (int)AF_INET6; } } // namespace ZeroTier diff --git a/core/InetAddress.hpp b/core/InetAddress.hpp index 04a9a55b4..bd2d20f9f 100644 --- a/core/InetAddress.hpp +++ b/core/InetAddress.hpp @@ -162,13 +162,13 @@ public: return *this; } - ZT_MAYBE_UNUSED ZT_INLINE void clear() noexcept + ZT_INLINE void clear() noexcept { memoryZero(this); } /** * @return IP scope classification (e.g. loopback, link-local, private, global) */ - ZT_MAYBE_UNUSED IpScope ipScope() const noexcept; + IpScope ipScope() const noexcept; /** * Set from a raw IP and port number @@ -177,14 +177,14 @@ public: * @param ipLen Length of IP address: 4 or 16 * @param port Port number or 0 for none */ - ZT_MAYBE_UNUSED void set(const void *ipBytes, unsigned int ipLen, unsigned int port) noexcept; + void set(const void *ipBytes, unsigned int ipLen, unsigned int port) noexcept; /** * Set the port component * * @param port Port, 0 to 65535 */ - ZT_MAYBE_UNUSED ZT_INLINE void setPort(unsigned int port) noexcept + ZT_INLINE void setPort(unsigned int port) noexcept { switch (as.ss.ss_family) { case AF_INET: @@ -199,14 +199,14 @@ public: /** * @return True if this network/netmask route describes a default route (e.g. 0.0.0.0/0) */ - ZT_MAYBE_UNUSED bool isDefaultRoute() const noexcept; + bool isDefaultRoute() const noexcept; /** * @return ASCII IP/port format representation */ - ZT_MAYBE_UNUSED char *toString(char buf[ZT_INETADDRESS_STRING_SIZE_MAX]) const noexcept; + char *toString(char buf[ZT_INETADDRESS_STRING_SIZE_MAX]) const noexcept; - ZT_MAYBE_UNUSED ZT_INLINE String toString() const + ZT_INLINE String toString() const { char buf[ZT_INETADDRESS_STRING_SIZE_MAX]; toString(buf); @@ -216,9 +216,9 @@ public: /** * @return IP portion only, in ASCII string format */ - ZT_MAYBE_UNUSED char *toIpString(char buf[ZT_INETADDRESS_STRING_SIZE_MAX]) const noexcept; + char *toIpString(char buf[ZT_INETADDRESS_STRING_SIZE_MAX]) const noexcept; - ZT_MAYBE_UNUSED ZT_INLINE String toIpString() const + ZT_INLINE String toIpString() const { char buf[ZT_INETADDRESS_STRING_SIZE_MAX]; toIpString(buf); @@ -229,12 +229,12 @@ public: * @param ipSlashPort IP/port (port is optional, will be 0 if not included) * @return True if address appeared to be valid */ - ZT_MAYBE_UNUSED bool fromString(const char *ipSlashPort) noexcept; + bool fromString(const char *ipSlashPort) noexcept; /** * @return Port or 0 if no port component defined */ - ZT_MAYBE_UNUSED ZT_INLINE unsigned int port() const noexcept + ZT_INLINE unsigned int port() const noexcept { switch (as.ss.ss_family) { case AF_INET: @@ -255,13 +255,13 @@ public: * * @return Netmask bits */ - ZT_MAYBE_UNUSED ZT_INLINE unsigned int netmaskBits() const noexcept + ZT_INLINE unsigned int netmaskBits() const noexcept { return port(); } /** * @return True if netmask bits is valid for the address type */ - ZT_MAYBE_UNUSED ZT_INLINE bool netmaskBitsValid() const noexcept + ZT_INLINE bool netmaskBitsValid() const noexcept { const unsigned int n = port(); switch (as.ss.ss_family) { @@ -281,7 +281,7 @@ public: * * @return Gateway metric */ - ZT_MAYBE_UNUSED ZT_INLINE unsigned int metric() const noexcept + ZT_INLINE unsigned int metric() const noexcept { return port(); } /** @@ -289,7 +289,7 @@ public: * * @return Netmask such as 255.255.255.0 if this address is /24 (port field will be unchanged) */ - ZT_MAYBE_UNUSED InetAddress netmask() const noexcept; + InetAddress netmask() const noexcept; /** * Constructs a broadcast address from a network/netmask address @@ -299,14 +299,14 @@ public: * * @return Broadcast address (only IP portion is meaningful) */ - ZT_MAYBE_UNUSED InetAddress broadcast() const noexcept; + InetAddress broadcast() const noexcept; /** * Return the network -- a.k.a. the IP ANDed with the netmask * * @return Network e.g. 10.0.1.0/24 from 10.0.1.200/24 */ - ZT_MAYBE_UNUSED InetAddress network() const noexcept; + InetAddress network() const noexcept; /** * Test whether this IPv6 prefix matches the prefix of a given IPv6 address @@ -314,7 +314,7 @@ public: * @param addr Address to check * @return True if this IPv6 prefix matches the prefix of a given IPv6 address */ - ZT_MAYBE_UNUSED bool isEqualPrefix(const InetAddress &addr) const noexcept; + bool isEqualPrefix(const InetAddress &addr) const noexcept; /** * Test whether this IP/netmask contains this address @@ -322,24 +322,24 @@ public: * @param addr Address to check * @return True if this IP/netmask (route) contains this address */ - ZT_MAYBE_UNUSED bool containsAddress(const InetAddress &addr) const noexcept; + bool containsAddress(const InetAddress &addr) const noexcept; /** * @return True if this is an IPv4 address */ - ZT_MAYBE_UNUSED ZT_INLINE bool isV4() const noexcept + ZT_INLINE bool isV4() const noexcept { return (as.ss.ss_family == AF_INET); } /** * @return True if this is an IPv6 address */ - ZT_MAYBE_UNUSED ZT_INLINE bool isV6() const noexcept + ZT_INLINE bool isV6() const noexcept { return (as.ss.ss_family == AF_INET6); } /** * @return pointer to raw address bytes or NULL if not available */ - ZT_MAYBE_UNUSED ZT_INLINE const void *rawIpData() const noexcept + ZT_INLINE const void *rawIpData() const noexcept { switch (as.ss.ss_family) { case AF_INET: @@ -354,7 +354,7 @@ public: /** * @return InetAddress containing only the IP portion of this address and a zero port, or NULL if not IPv4 or IPv6 */ - ZT_MAYBE_UNUSED ZT_INLINE InetAddress ipOnly() const noexcept + ZT_INLINE InetAddress ipOnly() const noexcept { InetAddress r; switch (as.ss.ss_family) { @@ -376,7 +376,7 @@ public: * @param a InetAddress to compare again * @return True if only IP portions are equal (false for non-IP or null addresses) */ - ZT_MAYBE_UNUSED ZT_INLINE bool ipsEqual(const InetAddress &a) const noexcept + ZT_INLINE bool ipsEqual(const InetAddress &a) const noexcept { const uint8_t f = as.ss.ss_family; if (f == a.as.ss.ss_family) { @@ -397,7 +397,7 @@ public: * @param a InetAddress to compare again * @return True if only IP portions are equal (false for non-IP or null addresses) */ - ZT_MAYBE_UNUSED ZT_INLINE bool ipsEqual2(const InetAddress &a) const noexcept + ZT_INLINE bool ipsEqual2(const InetAddress &a) const noexcept { const uint8_t f = as.ss.ss_family; if (f == a.as.ss.ss_family) { @@ -410,7 +410,7 @@ public: return false; } - ZT_MAYBE_UNUSED ZT_INLINE unsigned long hashCode() const noexcept + ZT_INLINE unsigned long hashCode() const noexcept { if (as.ss.ss_family == AF_INET) { return (unsigned long)Utils::hash32(((uint32_t)as.sa_in.sin_addr.s_addr + (uint32_t)as.sa_in.sin_port) ^ (uint32_t)Utils::s_mapNonce); @@ -432,20 +432,20 @@ public: * * @return True if everything after netmask bits is zero */ - ZT_MAYBE_UNUSED bool isNetwork() const noexcept; + bool isNetwork() const noexcept; /** * @return True if address family is non-zero */ - ZT_MAYBE_UNUSED explicit ZT_INLINE operator bool() const noexcept + explicit ZT_INLINE operator bool() const noexcept { return (as.ss.ss_family != 0); } - ZT_MAYBE_UNUSED static constexpr int marshalSizeMax() noexcept + static constexpr int marshalSizeMax() noexcept { return ZT_INETADDRESS_MARSHAL_SIZE_MAX; } - ZT_MAYBE_UNUSED int marshal(uint8_t data[ZT_INETADDRESS_MARSHAL_SIZE_MAX]) const noexcept; + int marshal(uint8_t data[ZT_INETADDRESS_MARSHAL_SIZE_MAX]) const noexcept; - ZT_MAYBE_UNUSED int unmarshal(const uint8_t *restrict data, int len) noexcept; + int unmarshal(const uint8_t *restrict data, int len) noexcept; ZT_INLINE bool operator==(const InetAddress &a) const noexcept { @@ -499,7 +499,7 @@ public: * @param mac MAC address seed * @return IPv6 link-local address */ - ZT_MAYBE_UNUSED static InetAddress makeIpv6LinkLocal(const MAC &mac) noexcept; + static InetAddress makeIpv6LinkLocal(const MAC &mac) noexcept; /** * Compute private IPv6 unicast address from network ID and ZeroTier address @@ -561,64 +561,64 @@ public: } as; }; -ZT_MAYBE_UNUSED static ZT_INLINE InetAddress *asInetAddress(sockaddr_in *const p) noexcept +static ZT_INLINE InetAddress *asInetAddress(sockaddr_in *const p) noexcept { return reinterpret_cast(p); } -ZT_MAYBE_UNUSED static ZT_INLINE InetAddress *asInetAddress(sockaddr_in6 *const p) noexcept +static ZT_INLINE InetAddress *asInetAddress(sockaddr_in6 *const p) noexcept { return reinterpret_cast(p); } -ZT_MAYBE_UNUSED static ZT_INLINE InetAddress *asInetAddress(sockaddr *const p) noexcept +static ZT_INLINE InetAddress *asInetAddress(sockaddr *const p) noexcept { return reinterpret_cast(p); } -ZT_MAYBE_UNUSED static ZT_INLINE InetAddress *asInetAddress(sockaddr_storage *const p) noexcept +static ZT_INLINE InetAddress *asInetAddress(sockaddr_storage *const p) noexcept { return reinterpret_cast(p); } -ZT_MAYBE_UNUSED static ZT_INLINE InetAddress *asInetAddress(ZT_InetAddress *const p) noexcept +static ZT_INLINE InetAddress *asInetAddress(ZT_InetAddress *const p) noexcept { return reinterpret_cast(p); } -ZT_MAYBE_UNUSED static ZT_INLINE const InetAddress *asInetAddress(const sockaddr_in *const p) noexcept +static ZT_INLINE const InetAddress *asInetAddress(const sockaddr_in *const p) noexcept { return reinterpret_cast(p); } -ZT_MAYBE_UNUSED static ZT_INLINE const InetAddress *asInetAddress(const sockaddr_in6 *const p) noexcept +static ZT_INLINE const InetAddress *asInetAddress(const sockaddr_in6 *const p) noexcept { return reinterpret_cast(p); } -ZT_MAYBE_UNUSED static ZT_INLINE const InetAddress *asInetAddress(const sockaddr *const p) noexcept +static ZT_INLINE const InetAddress *asInetAddress(const sockaddr *const p) noexcept { return reinterpret_cast(p); } -ZT_MAYBE_UNUSED static ZT_INLINE const InetAddress *asInetAddress(const sockaddr_storage *const p) noexcept +static ZT_INLINE const InetAddress *asInetAddress(const sockaddr_storage *const p) noexcept { return reinterpret_cast(p); } -ZT_MAYBE_UNUSED static ZT_INLINE const InetAddress *asInetAddress(const ZT_InetAddress *const p) noexcept +static ZT_INLINE const InetAddress *asInetAddress(const ZT_InetAddress *const p) noexcept { return reinterpret_cast(p); } -ZT_MAYBE_UNUSED static ZT_INLINE InetAddress &asInetAddress(sockaddr_in &p) noexcept +static ZT_INLINE InetAddress &asInetAddress(sockaddr_in &p) noexcept { return *reinterpret_cast(&p); } -ZT_MAYBE_UNUSED static ZT_INLINE InetAddress &asInetAddress(sockaddr_in6 &p) noexcept +static ZT_INLINE InetAddress &asInetAddress(sockaddr_in6 &p) noexcept { return *reinterpret_cast(&p); } -ZT_MAYBE_UNUSED static ZT_INLINE InetAddress &asInetAddress(sockaddr &p) noexcept +static ZT_INLINE InetAddress &asInetAddress(sockaddr &p) noexcept { return *reinterpret_cast(&p); } -ZT_MAYBE_UNUSED static ZT_INLINE InetAddress &asInetAddress(sockaddr_storage &p) noexcept +static ZT_INLINE InetAddress &asInetAddress(sockaddr_storage &p) noexcept { return *reinterpret_cast(&p); } -ZT_MAYBE_UNUSED static ZT_INLINE InetAddress &asInetAddress(ZT_InetAddress &p) noexcept +static ZT_INLINE InetAddress &asInetAddress(ZT_InetAddress &p) noexcept { return *reinterpret_cast(&p); } -ZT_MAYBE_UNUSED static ZT_INLINE const InetAddress &asInetAddress(const sockaddr_in &p) noexcept +static ZT_INLINE const InetAddress &asInetAddress(const sockaddr_in &p) noexcept { return *reinterpret_cast(&p); } -ZT_MAYBE_UNUSED static ZT_INLINE const InetAddress &asInetAddress(const sockaddr_in6 &p) noexcept +static ZT_INLINE const InetAddress &asInetAddress(const sockaddr_in6 &p) noexcept { return *reinterpret_cast(&p); } -ZT_MAYBE_UNUSED static ZT_INLINE const InetAddress &asInetAddress(const sockaddr &p) noexcept +static ZT_INLINE const InetAddress &asInetAddress(const sockaddr &p) noexcept { return *reinterpret_cast(&p); } -ZT_MAYBE_UNUSED static ZT_INLINE const InetAddress &asInetAddress(const sockaddr_storage &p) noexcept +static ZT_INLINE const InetAddress &asInetAddress(const sockaddr_storage &p) noexcept { return *reinterpret_cast(&p); } -ZT_MAYBE_UNUSED static ZT_INLINE const InetAddress &asInetAddress(const ZT_InetAddress &p) noexcept +static ZT_INLINE const InetAddress &asInetAddress(const ZT_InetAddress &p) noexcept { return *reinterpret_cast(&p); } } // namespace ZeroTier