Xcode: turn on and resolve all warnings

This commit is contained in:
2024-02-14 15:05:41 +01:00
parent 0560c7bce9
commit 0a719e3081
18 changed files with 197 additions and 37 deletions

View File

@@ -181,13 +181,14 @@
#ifdef _WIN32
#define _Unreferenced_(x) UNREFERENCED_PARAMETER(x)
#else
#define _Unreferenced_(x)
#define _Unreferenced_(x) (void)(x)
#endif
#ifndef _WIN32
template <class T, size_t N>
size_t _countof(const T (&arr)[N])
{
_Unreferenced_(arr);
return std::extent<T[N]>::value;
}
#endif

View File

@@ -27,6 +27,8 @@ namespace stdex
class basic_hash
{
public:
virtual ~basic_hash() {}
///
/// Initializes hash value and internal state
///

View File

@@ -110,15 +110,15 @@ namespace stdex
if (i >= size)
break;
int x = data[i];
auto x = data[i];
if ('0' <= x && x <= '9') {
buf = ((buf & 0xf) << 4) | (uint8_t)(x - '0');
buf = ((buf & 0xf) << 4) | static_cast<uint8_t>(x - '0');
num++;
} else if ('A' <= x && x <= 'F') {
buf = ((buf & 0xf) << 4) | (uint8_t)(x - ('A' - 10));
buf = ((buf & 0xf) << 4) | static_cast<uint8_t>(x - ('A' - 10));
num++;
} else if ('a' <= x && x <= 'f') {
buf = ((buf & 0xf) << 4) | (uint8_t)(x - ('a' - 10));
buf = ((buf & 0xf) << 4) | static_cast<uint8_t>(x - ('a' - 10));
num++;
}
}

View File

@@ -248,17 +248,17 @@ namespace stdex
case '%': {
i++;
uint8_t chr;
if ('0' <= src[i] && src[i] <= '9') chr = (src[i++] - '0') << 4;
else if ('A' <= src[i] && src[i] <= 'F') chr = (src[i++] - 'A' + 10) << 4;
else if ('a' <= src[i] && src[i] <= 'f') chr = (src[i++] - 'a' + 10) << 4;
char chr;
if ('0' <= src[i] && src[i] <= '9') chr = static_cast<char>((src[i++] - '0') << 4);
else if ('A' <= src[i] && src[i] <= 'F') chr = static_cast<char>((src[i++] - 'A' + 10) << 4);
else if ('a' <= src[i] && src[i] <= 'f') chr = static_cast<char>((src[i++] - 'a' + 10) << 4);
else { dst += '%'; continue; }
if ('0' <= src[i] && src[i] <= '9') chr |= (src[i++] - '0');
else if ('A' <= src[i] && src[i] <= 'F') chr |= (src[i++] - 'A' + 10);
else if ('a' <= src[i] && src[i] <= 'f') chr |= (src[i++] - 'a' + 10);
if ('0' <= src[i] && src[i] <= '9') chr |= static_cast<char>((src[i++] - '0'));
else if ('A' <= src[i] && src[i] <= 'F') chr |= static_cast<char>((src[i++] - 'A' + 10));
else if ('a' <= src[i] && src[i] <= 'f') chr |= static_cast<char>((src[i++] - 'a' + 10));
else { dst += '%'; dst += src[i - 1]; continue; }
dst += static_cast<char>(chr);
dst += chr;
break;
}

View File

@@ -9,6 +9,11 @@
#include <locale.h>
#include <memory>
#if defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wexit-time-destructors"
#endif
namespace stdex
{
#ifdef _WIN32
@@ -112,3 +117,7 @@ namespace stdex
#endif
);
}
#if defined(__GNUC__)
#pragma GCC diagnostic pop
#endif

View File

@@ -37,6 +37,7 @@
#elif defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunknown-pragmas"
#pragma GCC diagnostic ignored "-Wunused-parameter"
#endif
#define ENUM_FLAG_OPERATOR(T,X) \
@@ -377,8 +378,8 @@ namespace stdex
wchar_t buf[3];
const wchar_t* chr = next_sgml_cp(text, start, end, this->interval.end, buf);
bool r = ((flags & match_case_insensitive) ?
stdex::strnicmp(chr, SIZE_MAX, m_chr.data(), m_chr.size(), m_locale) :
stdex::strncmp(chr, SIZE_MAX, m_chr.data(), m_chr.size())) == 0;
stdex::strnicmp(chr, stdex::strlen(chr), m_chr.data(), m_chr.size(), m_locale) :
stdex::strncmp(chr, stdex::strlen(chr), m_chr.data(), m_chr.size())) == 0;
if ((r && !m_invert) || (!r && m_invert)) {
this->interval.start = start;
return true;

View File

@@ -21,6 +21,8 @@ namespace stdex
class progress
{
public:
virtual ~progress() {}
///
/// Set progress indicator text
///

View File

@@ -14,6 +14,11 @@
#include <string_view>
#include <string>
#if defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wexit-time-destructors"
#endif
namespace stdex
{
/// \cond internal
@@ -861,3 +866,7 @@ namespace stdex
return str2sgml(src.data(), src.size(), what);
}
}
#if defined(__GNUC__)
#pragma GCC diagnostic pop
#endif

View File

@@ -25,4 +25,4 @@ namespace stdex
constexpr socket_t invalid_socket = ((socket_t)-1);
inline int closesocket(_In_ socket_t socket) { return ::close(socket); }
#endif
}
}

View File

@@ -3027,6 +3027,7 @@ namespace stdex
return;
throw std::system_error(GetLastError(), std::system_category(), "SetFileTime failed");
#else
_Unreferenced_(date);
throw std::runtime_error("not supported");
#endif
}
@@ -3849,7 +3850,7 @@ namespace stdex
return 0;
while (to_write) {
num_read = stream.read(m_data + dst_offset, to_write);
dst_size = dst_offset += num_read;
/*dst_size =*/ dst_offset += num_read;
num_copied += num_read;
to_write -= num_read;
if (!stream.ok()) {

View File

@@ -87,8 +87,8 @@ namespace stdex
{
_Assume_(chr >= 0x10000);
chr -= 0x10000;
str[0] = 0xd800 + static_cast<utf32_t>((chr >> 10) & 0x3ff);
str[1] = 0xdc00 + static_cast<utf32_t>(chr & 0x3ff);
str[0] = 0xd800 + static_cast<utf16_t>((chr >> 10) & 0x3ff);
str[1] = 0xdc00 + static_cast<utf16_t>(chr & 0x3ff);
}
///

View File

@@ -16,6 +16,11 @@
#endif
#include <memory>
#if defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wexit-time-destructors"
#endif
namespace stdex
{
///
@@ -238,3 +243,7 @@ namespace stdex
#endif
} sys_info;
}
#if defined(__GNUC__)
#pragma GCC diagnostic pop
#endif

View File

@@ -21,6 +21,7 @@
#if defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#pragma GCC diagnostic ignored "-Wexit-time-destructors"
#endif
namespace stdex