Skip to content

build: opt-in MSVC to C99-style verbose logging logic#20387

Closed
vszakats wants to merge 1 commit intocurl:masterfrom
vszakats:msvcvariadic
Closed

build: opt-in MSVC to C99-style verbose logging logic#20387
vszakats wants to merge 1 commit intocurl:masterfrom
vszakats:msvcvariadic

Conversation

@vszakats
Copy link
Member

@vszakats vszakats commented Jan 21, 2026

MSVC does not advertise itself as C99 via __STDC_VERSION__, but
supports variadic macros in all curl-supported versions. Fix by
explicitly enabling C99 verbose string logic for MSVC.

With verbose logging enabled (default), this makes logging perform
better, on par with clang/gcc (and other C99) builds. (With the cost
of extra binary size.) With verbose logging disabled, it excludes all
verbose logging related strings and code from the binary. Before this
patch, MSVC used the C89 fallback code in both configs, which used
a fixed function call, with the called function deciding to actually
log or not, while also retaining the verbose log string in both configs.

Size comparison (bytes), schannel, static, debug, VS2022, local build:
curl-before-verbose.exe 4,024,832
curl-before-noverbose.exe 4,013,056
curl-after-verbose.exe 4,117,504
curl-after-noverbose.exe 3,928,064

In CI with non-verbose:
Before:

3274240 bytes: ./_bld/lib/Debug/libcurl-d.dll

Ref: https://ci.appveyor.com/project/curlorg/curl/builds/53408629/job/htj7ps88q83ew9ww#L224

After:

3155968 bytes: ./_bld/lib/Debug/libcurl-d.dll

Ref: https://ci.appveyor.com/project/curlorg/curl/builds/53408771/job/tp9epgjpef098vsr#L224

Idea-by: Arnav Purushotam
Ref: #20367
Ref: #20341
Follow-up to 61093e2 #20353

@github-actions github-actions bot added the CI Continuous Integration label Jan 21, 2026
@vszakats vszakats marked this pull request as draft January 21, 2026 13:07
@testclutch

This comment was marked as outdated.

@vszakats vszakats changed the title build: add support to fully omit verbose strings with MSVC build: add support to omit verbose strings with MSVC Jan 21, 2026
vszakats added a commit that referenced this pull request Jan 21, 2026
- schannel: fix mixed-up declaration. (originally fenced infof for
  verbose, then changed to failf with the fence kept, then fence
  removed and variable marked as verbose, when in fact it's not, but
  not tested and caught in CI.
- fix two other fallouts.
- GHA/windows: disable verbose strings in a mingw job.
- appveyor: disable verbose strings in an MSVC job.
- appveyor: add way to pass any CMake option per-job.

Cherry-picked from #20387
Follow-up to 61093e2 #20353

Closes #20388
MSVC doesn't advertise itself as C99 via `__STDC_VERSION__`, but
supports variadic macros in all supported versions? CI will tell.

Suggested-by: Arnav Purushotam
Ref: curl#20367
Follow-up to 61093e2 curl#20353
@vszakats vszakats marked this pull request as ready for review January 21, 2026 14:40
@vszakats vszakats changed the title build: add support to omit verbose strings with MSVC build: opt-in MSVC to C99-style verbose string handling Jan 21, 2026
@vszakats vszakats changed the title build: opt-in MSVC to C99-style verbose string handling build: opt-in MSVC to C99-style verbose logging logic Jan 21, 2026
@vszakats vszakats closed this in dfef594 Jan 21, 2026
@vszakats vszakats deleted the msvcvariadic branch January 21, 2026 20:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build CI Continuous Integration logging performance Windows Windows-specific

Development

Successfully merging this pull request may close these issues.

2 participants