Skip to content

mqttd: work around bogus VS2019 32-bit compiler warning - #23317

Closed
vszakats wants to merge 6 commits into
curl:masterfrom
vszakats:mqttd-vs2019-32bit-warning-fix
Closed

vszakats wants to merge 6 commits into
curl:masterfrom
vszakats:mqttd-vs2019-32bit-warning-fix

Conversation

@vszakats

@vszakats vszakats commented Oct 8, 2026 •

Copy link
Copy Markdown
Member

Seen in temporary job 'CM VS2019, Release, x86, OpenSSL 3.0 + Schannel,
Shared, !verbose, Build-tests', with Visual Studio Community 2019
v16.11.50:

-- Building for: Visual Studio 16 2019
-- Using CMake version 4.1.0
-- Selecting Windows SDK version 10.0.26100.0 to target Windows 10.0.17763.
-- The C compiler identification is MSVC 19.29.30159.0
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x86/cl.exe - skipped
-- CMake platform flags: WIN32 MSVC-1929
[...]
-- Found _WIN32_WINNT=0x0a00
-- Picky compiler options: -W4 -Wall -wd4061 -wd4191 -wd4255 -wd4464 -wd4548 -wd4574 -wd4668 -wd4710 -wd4711 -wd4746 -wd4820 -wd5045
[...]
tests\server\mqttd.c(169,19): error C2220: the following warning is treated as an error
tests\server\mqttd.c(169,19): warning C4777: 'fprintf' : format string '%x' requires an argument of type 'unsigned int', but variadic argument 3 has type 'size_t'
tests\server\mqttd.c(169,19): message : the sizes of types 'size_t' and 'unsigned int' might differ on other platforms
tests\server\mqttd.c(169,19): message : consider using '%zx' in the format string

Ref: https://ci.appveyor.com/project/curlorg/curl/builds/54855420/job/71ccddu696xhn95q#L263

(The suggested %zx solution does not fit other compilers.)

Cherry-picked from #23306


Passed OK: https://ci.appveyor.com/project/curlorg/curl/builds/54860597/job/14feltroupgv66cm
Passed FAIL without fix: https://ci.appveyor.com/project/curlorg/curl/builds/54860737/job/qylph95mgmtix865

Visual Studio Community 2019 version 16.11.50:
```
-- Building for: Visual Studio 16 2019
-- Using CMake version 4.1.0
-- curl version=[8.23.0-DEV]
-- Selecting Windows SDK version 10.0.26100.0 to target Windows 10.0.17763.
-- The C compiler identification is MSVC 19.29.30159.0
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x86/cl.exe - skipped
-- CMake platform flags: WIN32 MSVC-1929
[...]
-- Found _WIN32_WINNT=0x0a00
-- Picky compiler options: -W4 -Wall -wd4061 -wd4191 -wd4255 -wd4464 -wd4548 -wd4574 -wd4668 -wd4710 -wd4711 -wd4746 -wd4820 -wd5045
[...]
tests\server\mqttd.c(169,19): error C2220: the following warning is treated as an error
tests\server\mqttd.c(169,19): warning C4777: 'fprintf' : format string '%x' requires an argument of type 'unsigned int', but variadic argument 3 has type 'size_t'
tests\server\mqttd.c(169,19): message : the sizes of types 'size_t' and 'unsigned int' might differ on other platforms
tests\server\mqttd.c(169,19): message : consider using '%zx' in the format string
```
Ref: https://ci.appveyor.com/project/curlorg/curl/builds/54855420/job/71ccddu696xhn95q#L263
…r builds

linux-mingw, CM gcc (GNU 13.0.0)
```
/home/runner/work/curl/curl/tests/server/mqttd.c:169:19: error: unknown conversion type character ‘z’ in format [-Werror=format=]
  169 |   fprintf(output, "%s %s %zx %s\n",
      |                   ^~~~~~~~~~~~~~~~
/home/runner/work/curl/curl/tests/server/mqttd.c:169:19: error: format ‘%s’ expects argument of type ‘char *’, but argument 5 has type ‘size_t’ {aka ‘long long unsigned int’} [-Werror=format=]
  169 |   fprintf(output, "%s %s %zx %s\n",
      |                   ^~~~~~~~~~~~~~~~
  170 |           dir == FROM_CLIENT ? "client" : "server", prefix, remlen, data);
      |                                                             ~~~~~~
      |                                                             |
      |                                                             size_t {aka long long unsigned int}
/home/runner/work/curl/curl/tests/server/mqttd.c:169:19: error: too many arguments for format [-Werror=format-extra-args]
```
https://github.com/curl/curl/actions/runs/37773363483/job/113298111103?pr=23306

dl-mingw, CM 7.3.0-x86_64 schannel mbedtls U (gcc):
```
/home/runner/work/curl/curl/tests/server/mqttd.c:169:19: error: unknown conversion type character ‘z’ in format [-Werror=format=]
  169 |   fprintf(output, "%s %s %zx %s\n",
      |                   ^~~~~~~~~~~~~~~~
/home/runner/work/curl/curl/tests/server/mqttd.c:169:19: error: format ‘%s’ expects argument of type ‘char *’, but argument 5 has type ‘size_t’ {aka ‘long long unsigned int’} [-Werror=format=]
  169 |   fprintf(output, "%s %s %zx %s\n",
      |                   ^~~~~~~~~~~~~~~~
  170 |           dir == FROM_CLIENT ? "client" : "server", prefix, remlen, data);
      |                                                             ~~~~~~
      |                                                             |
      |                                                             size_t {aka long long unsigned int}
/home/runner/work/curl/curl/tests/server/mqttd.c:169:19: error: too many arguments for format [-Werror=format-extra-args]
```
https://github.com/curl/curl/actions/runs/37773363483/job/113298160212?pr=23306

dl-mingw, CM 6.4.0-i686 MultiSSL !unity (gcc):
```
D:/a/curl/curl/tests/server/mqttd.c:169:27: error: unknown conversion type character 'z' in format [-Werror=format=]
   fprintf(output, "%s %s %zx %s\n",
                           ^
D:/a/curl/curl/tests/server/mqttd.c:169:31: error: format '%s' expects argument of type 'char *', but argument 5 has type 'size_t {aka unsigned int}' [-Werror=format=]
   fprintf(output, "%s %s %zx %s\n",
                               ^
D:/a/curl/curl/tests/server/mqttd.c:169:19: error: too many arguments for format [-Werror=format-extra-args]
   fprintf(output, "%s %s %zx %s\n",
                   ^~~~~~~~~~~~~~~~
D:/a/curl/curl/tests/server/mqttd.c:169:27: error: unknown conversion type character 'z' in format [-Werror=format=]
   fprintf(output, "%s %s %zx %s\n",
                           ^
D:/a/curl/curl/tests/server/mqttd.c:169:31: error: format '%s' expects argument of type 'char *', but argument 5 has type 'size_t {aka unsigned int}' [-Werror=format=]
   fprintf(output, "%s %s %zx %s\n",
                               ^
D:/a/curl/curl/tests/server/mqttd.c:169:19: error: too many arguments for format [-Werror=format-extra-args]
   fprintf(output, "%s %s %zx %s\n",
                   ^~~~~~~~~~~~~~~~
```
https://github.com/curl/curl/actions/runs/37773363483/job/113298160106?pr=23306
@vszakats vszakats added build Windows Windows-specific labels Oct 8, 2026
@vszakats vszakats changed the title mqttd: silence bogus VS2019 32-bit compiler warning mqttd: work around bogus VS2019 32-bit compiler warning Oct 8, 2026
@github-actions github-actions Bot added tests MQTT CI Continuous Integration labels Oct 8, 2026
@vszakats
vszakats force-pushed the mqttd-vs2019-32bit-warning-fix branch from 45ed909 to 515cc65 Compare October 8, 2026 15:11
@vszakats
vszakats force-pushed the mqttd-vs2019-32bit-warning-fix branch 3 times, most recently from 96e2205 to 281794a Compare October 8, 2026 15:18
@vszakats vszakats closed this in 2874cc6 Oct 8, 2026
@vszakats
vszakats deleted the mqttd-vs2019-32bit-warning-fix branch October 8, 2026 15:36
@vszakats vszakats mentioned this pull request Oct 8, 2026
9 of 10 tasks
vszakats added a commit that referenced this pull request Oct 18, 2026
- in jobs building tests, also run them.
- to maintain CI cycle times, only run unit tests by default, and run
  all (supported) tests in just one job, carefully selected to be the
  one running them the fastest.
  Per job, it takes ~15 seconds to run ~80 unit tests.
  It takes 5 minutes to run all (~1600) tests. Total job time 5.5-6
  minutes.
  If the full test run turns out to be annoying or grow slow, we disable
  or limit it to a subset of tests.
- run tests with `-j10` parallelism. It results in the fastest runs,
  based on tests.
- to avoid the MSBuild test breaker heuristics, and to improve
  performance, run tests by directly invoking `runtests.pl` (not via
  CMake -> MSBuild -> `runtests.pl`).
  It saves 10-40 seconds per full test run.
- when running directly via `runtests.pl`, exclude test 1119 and 1167.
  It's not compatible with Visual Studio generator builds.
- run the artifact upload in parallel with running tests.

Running Windows tests in multiple environments makes it more likely they
can run on local machines, too, also making them easier to debug.
AppVeyor also supports remote access via RDP, which may help debugging
notorious Windows issues live, with some luck of reproducing it in a run
with RDP access explicitly enabled beforehand.

Fixes/improvements via this PR, merged separately:

dc99e12 #23467 processhelp.pm: improve task info in trace output (Windows)
70f3f85 #23471 test1488: drop unused C preprocessor logic
af9d2dd #23336 cmake: fix preconditions for option `CURL_STATIC_CRT=ON`
adf8b78 #23428 setopt: fix setting `CURLWS_NOAUTOPONG` with compilers lacking C99 bool type
780405b #23416 tests: add `--dump-module-paths` debug option (Windows)
bc22977 #23400 msvc: replace debug CRT GUI popups with stderr output
87a1dc7 #23396 appveyor: minor improvements
67f3510 #23381 runtests: add `-S` option to show success logs
e9af987 #23378 tests/server: fix crashing with VS2013 and earlier
8cdee8a #23377 lib557: exclude three floating point test cases for VS2013 and earlier
1aac64a #23375 test1119, 1167: disable MSYS2 argument conversion narrowly
49f003f #23337 unit1664: add workaround for VS2019 16.3 - VS2022 17.4 x64 miscompile
b8f71d6 #23345 test428: skip when running on older MSYS2 versions
2f3f99d #23339 test1119, 1167: disable MSYS2 argument conversion
098d3a0 #23332 runtests: unset `CURL_MEMDEBUG` for curl requests made to the CI API
d3e7caf #23335 GHA/windows: drop unused `-ac` runtests options
2874cc6 #23317 mqttd: work around bogus VS2019 32-bit compiler warning
e8adc72 #23315 schannel: fix guard for old MSVC workaround

Follow-up to 41198e0 #20390

Closes #23306
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build CI Continuous Integration MQTT tests Windows Windows-specific

Development

Successfully merging this pull request may close these issues.

1 participant