Skip to content

vquic: silence -Wmissing-field-initializers for nghttp3/ngtcp2 callback tables - #22400

Closed
vszakats wants to merge 1 commit into
curl:masterfrom
vszakats:nginitwarn
Closed

vquic: silence -Wmissing-field-initializers for nghttp3/ngtcp2 callback tables#22400
vszakats wants to merge 1 commit into
curl:masterfrom
vszakats:nginitwarn

Conversation

@vszakats

@vszakats vszakats commented Jul 26, 2026

Copy link
Copy Markdown
Member

To avoid a breakage in CI and curl-for-win builds on upstream updates
extending the callback lists. Each such breakage needed patching curl,
rolling these patches into curl-for-win, and doing it in near real-time,
to keep CI and builds working (and still causing some red CI jobs).

Bring calmness here by suppressing the warnings and allowing time to
extend the callback tables as/if needed and at a convenient moment.


Also explored the option to dynamically setup the the callbacks, but
the libraries need a static callback table before nghttp3 v1.11.0+ and
ngctp2 v1.14.0+ which made this unnecessarily complex.

nghttp3 1.18.0 causing two pytests to fail.
Possibly due to ngtcp2/nghttp3#539. → PR #22402

Copilot AI review requested due to automatic review settings July 26, 2026 14:58
@github-actions github-actions Bot added the HTTP/3 h3 or quic related label Jul 26, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR reduces build noise in the HTTP/3 (QUIC) implementation by locally suppressing -Wmissing-field-initializers warnings triggered by nghttp3/ngtcp2 callback table initializers, using the existing CURL_HAVE_DIAG-guarded diagnostic pragmas.

Changes:

  • Wrap nghttp3_callbacks initializer in cf-ngtcp2.c with #pragma GCC diagnostic push/pop and ignore -Wmissing-field-initializers when supported.
  • Apply the same suppression to the nghttp3 proxy callback table in cf-ngtcp2-proxy.c.
  • Apply the same suppression to the ngtcp2 callback table in cf-ngtcp2-cmn.c.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
lib/vquic/cf-ngtcp2.c Silences -Wmissing-field-initializers around the nghttp3 callback table initialization (guarded by CURL_HAVE_DIAG).
lib/vquic/cf-ngtcp2-proxy.c Silences -Wmissing-field-initializers around the nghttp3 proxy callback table initialization (guarded by CURL_HAVE_DIAG).
lib/vquic/cf-ngtcp2-cmn.c Silences -Wmissing-field-initializers around the ngtcp2 callback table initialization (guarded by CURL_HAVE_DIAG).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@vszakats
vszakats marked this pull request as draft July 26, 2026 15:06
@vszakats

Copy link
Copy Markdown
Member Author

Trying a different approach.

@testclutch

This comment was marked as outdated.

Copilot AI review requested due to automatic review settings July 26, 2026 16:03

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

Comment thread lib/vquic/cf-ngtcp2-cmn.c Outdated
Copilot AI review requested due to automatic review settings July 26, 2026 16:17
@vszakats vszakats changed the title vquic: silence -Wmissing-field-initializers for nghttp3/ngtcp2 callback tables vquic: avoid -Wmissing-field-initializers when setting up callback tables Jul 26, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

Comment thread lib/vquic/cf-ngtcp2-cmn.c Outdated
Copilot AI review requested due to automatic review settings July 26, 2026 16:44

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

Comment thread lib/vquic/cf-ngtcp2.c
Comment thread lib/vquic/cf-ngtcp2-proxy.c
Comment thread lib/vquic/cf-ngtcp2-cmn.c Outdated
Copilot AI review requested due to automatic review settings July 26, 2026 17:35

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (3)

lib/vquic/cf-ngtcp2.c:397

  • cb is a function-scope static callbacks struct that is written to on every call. If multiple nghttp3 connections are initialized concurrently from different threads, these writes race on shared state (undefined behavior), even though the assigned function pointers are constant.

Consider keeping the callbacks immutable (initialized once and never modified) or storing the callbacks struct in the per-connection ctx so each connection has its own instance and there are no shared writes.

  static nghttp3_callbacks cb = { 0 };
  int rc;

  if(ngtcp2_conn_get_streams_uni_left(ctx->qconn) < 3) {
    failf(data, "QUIC connection lacks 3 uni streams to run HTTP/3");

lib/vquic/cf-ngtcp2-proxy.c:612

  • cb is a function-scope static callbacks struct that is written to on every call. If multiple nghttp3 connections are initialized concurrently from different threads, these writes race on shared state (undefined behavior), even though the assigned function pointers are constant.

Consider keeping the callbacks immutable (initialized once and never modified) or storing the callbacks struct in the per-connection ctx so each connection has its own instance and there are no shared writes.

  static nghttp3_callbacks cb = { 0 };
  int rc;

  if(ngtcp2_conn_get_streams_uni_left(ctx->qconn) < 3) {
    failf(data, "QUIC connection lacks 3 uni streams to run HTTP/3");

lib/vquic/cf-ngtcp2-cmn.c:891

  • cb is a function-scope static callbacks struct that is written to on every call. If multiple QUIC connections are created concurrently from different threads, these writes race on shared state (undefined behavior), even though the assigned function pointers are constant.

Consider making the callbacks table immutable (initialized once and never modified) or storing it per-connection (in ctx) to avoid shared mutable state.

  static ngtcp2_callbacks cb = { 0 };
  static const struct alpn_spec ALPN_SPEC_H3 = { { "h3", "h3-29" }, 2 };

  DEBUGASSERT(ctx->initialized);
  ctx->dcid.datalen = NGTCP2_MAX_CIDLEN;

@vszakats vszakats changed the title vquic: avoid -Wmissing-field-initializers when setting up callback tables vquic: avoid -Wmissing-field-initializers on callback table init Jul 26, 2026
Copilot AI review requested due to automatic review settings July 26, 2026 18:46

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.

@vszakats vszakats changed the title vquic: avoid -Wmissing-field-initializers on callback table init vquic: silence -Wmissing-field-initializers for callback tables Jul 26, 2026
Copilot AI review requested due to automatic review settings July 26, 2026 19:04
@vszakats
vszakats marked this pull request as ready for review July 26, 2026 19:05

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.

@vszakats vszakats changed the title vquic: silence -Wmissing-field-initializers for callback tables vquic: silence -Wmissing-field-initializers for nghttp3/ngtcp2 callback tables Jul 26, 2026
@vszakats vszakats closed this in e90c439 Jul 27, 2026
@vszakats
vszakats deleted the nginitwarn branch July 27, 2026 08:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

HTTP/3 h3 or quic related

Development

Successfully merging this pull request may close these issues.

3 participants