build: fix some -Wsign-conversion/-Warith-conversion warnings

- enable `-Wsign-conversion` warnings, but also setting them to not
  raise errors.
- fix `-Warith-conversion` warnings seen in CI.
  These are triggered by `-Wsign-converion` and causing errors unless
  explicitly silenced. It makes more sense to fix them, there just a few
  of them.
- fix some `-Wsign-conversion` warnings.
- hide `-Wsign-conversion` warnings with a `#pragma`.
- add macro `CURL_WARN_SIGN_CONVERSION` to unhide them on a per-build
  basis.
- update a CI job to unhide them with the above macro:
  https://github.com/curl/curl/actions/workflows/linux.yml -> OpenSSL -O3

Closes #12492
This commit is contained in:
Viktor Szakats 2023-12-09 02:45:19 +00:00
parent 68d80a8f9b
commit 2dbe75bd7f
No known key found for this signature in database
GPG key ID: B5ABD165E2AEF201
17 changed files with 56 additions and 42 deletions

View file

@ -137,7 +137,7 @@ void logmsg(const char *msg, ...)
static const char *win32_strerror(int err, char *buf, size_t buflen)
{
if(!FormatMessageA((FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS), NULL, err,
FORMAT_MESSAGE_IGNORE_INSERTS), NULL, (DWORD)err,
LANG_NEUTRAL, buf, (DWORD)buflen, NULL))
msnprintf(buf, buflen, "Unknown error %d (%#x)", err, err);
return buf;
@ -247,7 +247,7 @@ int wait_ms(int timeout_ms)
#if defined(MSDOS)
delay(timeout_ms);
#elif defined(USE_WINSOCK)
Sleep(timeout_ms);
Sleep((DWORD)timeout_ms);
#else
pending_ms = timeout_ms;
initial_tv = tvnow();