Skip to content

Fix VLA warning in io_threads#3518

Merged
hpatro merged 1 commit intovalkey-io:unstablefrom
yang-z-o:fix-clang17-build-error
Apr 21, 2026
Merged

Fix VLA warning in io_threads#3518
hpatro merged 1 commit intovalkey-io:unstablefrom
yang-z-o:fix-clang17-build-error

Conversation

@yang-z-o
Copy link
Copy Markdown
Contributor

#3324 introduced BATCH_SIZE as a const int local variable and used it as an array bound. Clang 17 rejects this with:

io_threads.c:305:22: error: variable length array folded to constant array as an extension [-Werror,-Wgnu-folding-constant]
  305 |     void *batch_jobs[BATCH_SIZE];
      |                      ^~~~~~~~~~
1 error generated.
make[1]: *** [io_threads.o] Error 1
make: *** [all] Error 2

Old Clang versions do not emit this warning, maybe that is why the CI passed. Fix by promoting BATCH_SIZE to a file-scope #define.

Signed-off-by: Yang Zhao <zymy701@gmail.com>
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 16, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 76.62%. Comparing base (087280e) to head (113aefd).
⚠️ Report is 9 commits behind head on unstable.

Additional details and impacted files
@@             Coverage Diff              @@
##           unstable    #3518      +/-   ##
============================================
+ Coverage     76.47%   76.62%   +0.15%     
============================================
  Files           159      159              
  Lines         79840    79839       -1     
============================================
+ Hits          61060    61180     +120     
+ Misses        18780    18659     -121     
Files with missing lines Coverage Δ
src/io_threads.c 70.52% <ø> (-0.29%) ⬇️

... and 21 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@yang-z-o yang-z-o changed the title Fix Clang 17 build error Fix VLA warning in io_threads Apr 16, 2026
@yang-z-o
Copy link
Copy Markdown
Contributor Author

Found a similar fix #3439

Copy link
Copy Markdown
Member

@roshkhatri roshkhatri left a comment

Choose a reason for hiding this comment

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

LGTM

@hpatro hpatro merged commit fc00f7b into valkey-io:unstable Apr 21, 2026
59 checks passed
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.

5 participants