Skip to content

A variadic setter's store fits the callback role when it is proven to be the first argument read under its case; a facts file states a variadic function's cases (D213, #3124) - #3556

Merged
ehartford merged 1 commit into
mainfrom
variadic-callback-store
Nov 23, 2026

Conversation

@ehartford

Copy link
Copy Markdown
Contributor

D213 as amended by Eric on 2026-11-22 after reading libcurl 8.23.0. The words are already in the spec (v7.84); this is the implementation.

The shape. curl_easy_setopt(handle, option, ...) hands its argument list and option to Curl_vsetopt, which passes both unchanged to setopt_func, where case CURLOPT_DEBUGFUNCTION: s->fdebug = va_arg(param, curl_debug_callback); stores the next argument.

The rule. That store fits field F of R is callback when all of these are proven; otherwise the field is undecided and the contract says what stopped it:

  • it is the first variadic argument read under case K of a switch on a parameter (the selector), at the field's own type;
  • the list and the selector reach the storing function unchanged from every function that can reach it: a read from the list on a path that reaches the call counts, a read inside a return in a sibling branch does not (Curl_vsetopt reads the list in its other branches);
  • each function that starts such a list is a variadic function a header declares, whose facts state case K as a callback;
  • every call of such a function from inside the package with selector K passes null or the same field of another record. A package function passed there contradicts the role and names the call.

How. The scanner records three kinds of line per function: fv (a store of the next variadic argument: record, field, list, selector, case labels, type, first or later), vc (a call that hands on a va_list: where the list and each argument came from, and whether the list was read on the way), vk (a call of a variadic function: its constant arguments and what its first variadic argument is). ci_va_store_verdict walks the vc edges up to the entries and judges them.

Facts files. variadic param V selected by param S: and its case K: … lines are read and carried into the drafted contract. §31 already allowed them (facts = … item+); the reader did not. A variadic function whose cases the registry states is judged like any other function instead of being reported as unmodeled.

Tests: conan_facade_callback_variadic_test (fits; the package calls its own setter with the same field; with its own function, a contradiction; a read before the list is passed on; facts that state no case), and the older test's variadic case, whose store sits under an if.

#3124 stays open for libcurl's own facts file.

Battery green (530 s); self-audit and :release-checks green.

… be the first argument read under its case; a facts file states a variadic function's cases (D213, #3124)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant