Conversation
verify-examples.pl invokes 'gcc', which on macOS is clang. With -Wall -Wextra... -Werror -pedantic, clang rejects two patterns that GNU gcc accepts: - passing a char * to %p without a cast (-Wformat-pedantic): the C standard says %p expects void *, so cast explicitly in the CURLOPT_PROGRESSDATA, CURLOPT_PROGRESSFUNCTION, CURLOPT_XFERINFODATA and CURLOPT_XFERINFOFUNCTION examples - returning CURLcode result from main() when curl_easy_init() returned NULL leaves it uninitialized (-Wsometimes-uninitialized) in the CURLINFO_TLS_SSL_PTR example: initialize it to CURLE_OK like other man pages already do
bagder
reviewed
Aug 22, 2026
Accidentally committed the temporary file generated by verify-examples.pl when running it locally. Spotted by bagder in review.
Contributor
Author
|
Yes, a leftover by mistake — |
bagder
approved these changes
Aug 22, 2026
Member
|
Thanks! |
2 tasks
vszakats
added a commit
that referenced
this pull request
Aug 26, 2026
… clang Verify example snippets with the picky warning options used when compiling curl core code and standalone example code. Also test with clang. Extract picky warnings available via a new, internal, CMake option. Also: - fix issues found. - tried reproducing #22638 in CI (specifically the casts for `%p`), turns out it needs apple clang 17, and no longer reproducing with apple clang 21. Follow-up to 5c61e16 #22638 Closes #22639
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Running
.github/scripts/verify-examples.pllocally on macOS fails with 5 errors, even though CI is green. The script invokesgcc, which on macOS is clang, and clang's-Wall -pedantic -Werroris stricter than GNU gcc in two spots:1. Passing
char *to%pwithout a cast (-Wformat-pedantic, C11 7.21.6.1: the argument for%pshall be a pointer tovoid):Fixed by casting to
(void *), matching what the code already does elsewhere (e.g.(SSL*)info->internalsstyle explicit casts in these same examples).2. Uninitialized
resultin CURLINFO_TLS_SSL_PTR example (-Wsometimes-uninitialized): ifcurl_easy_init()returns NULL,main()returns an uninitializedCURLcode result. Initialized it toCURLE_OK, a pattern already used by other man pages.After the change,
verify-examples.pl docs/libcurl/curl*.md docs/libcurl/opts/*.mdexits 0 with all 513 pages verified, both with Apple clang and (unchanged behavior) GNU gcc.