Conversation
clang 23 adds -Wunused-but-set-global, a subgroup of the
-Wunused-but-set-variable that -Wall already enables, and configure
adds -Werror. It fails the build on nxt_vars:
src/nxt_var.c:75:29: error: variable 'nxt_vars' set but not used
The diagnostic is right. nxt_vars is a file-static pointer that
nxt_var_index_init() fills and nothing reads; the history of nxt_var.c
never had a reader. So the whole function is dead at startup: it
allocates a 64-byte aligned array of every registered variable, copies
the hash into it, stores the pointer and returns. nxt_var_count exists
only to size that array.
Remove the index, its counter, the prototype and the call from
nxt_runtime_create(). The remaining nxt_var_register() failure path is
unchanged. No behaviour changes; the startup allocation goes away.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
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.
Problem
The scheduled "Build (Fedora/Alpine · GCC/Clang)" workflow fails on both clang legs since the images moved to clang 23 (Alpine clang 23.1.1, Fedora clang 23.1.0); the gcc legs pass:
https://github.com/freeunitorg/freeunit/actions/runs/35585942071
The last green run (https://github.com/freeunitorg/freeunit/actions/runs/33384248955, 2026-08-31) used Alpine clang 22.1.8; the first red one (https://github.com/freeunitorg/freeunit/actions/runs/34830122484, 2026-09-14) was already on 23.x. No source change is involved. The clang 23 release notes add
-Wunused-but-set-globalas a new subgroup of-Wunused-but-set-variable(in-Wall) covering file-scope statics; configure adds-Werror, so the new warning is fatal.Fix
The diagnostic is right, so delete the dead code rather than suppress the flag.
nxt_varsis a file-static pointer written once bynxt_var_index_init()and never read;git log -S nxt_vars -- src/nxt_var.cshows no reader in the whole history of the file. That makesnxt_var_index_init()dead at startup: itnxt_memalign(64, …)s an array of every registered variable, copies the hash into it, stores the pointer and returns.nxt_var_countexists only to size that array. Remove the index, the counter, the prototype innxt_var.hand the call innxt_runtime_create(); the surroundinggoto failchain is unchanged.No user-visible change, so no CHANGES / changes.xml entry.
Verification
origin/masterinalpine:edgewith clang 23.1.1 (./configure --cc=clang --openssl --tests && make unitd); withmake -kit is the only error in the tree, so no other file trips the new warning.unitdcleanly;unitd --versionreports 1.36.1 and a--no-daemonstart brings up controller and router and exits cleanly on SIGTERM.make unitd), plusmake testsunder clang 21 with the C test binary passing.🤖 Generated with Claude Code