-
Notifications
You must be signed in to change notification settings - Fork 535
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix build with clang v18 [-Wvla-cxx-extension] #1813
Conversation
kinkie
commented
May 18, 2024
•
edited by rousskov
Loading
edited by rousskov
Variable length arrays are legal in C, but not part of the C++ standard. Current clang versions emit a warning if these are used, failing the build in Rock.
Landing this PR is a requirement for us to start CI testing on |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please share clang version and the warning text.
Versions:
From failed build attempt:
|
We probably want to switch to constexpr in some contexts (possibly including this one) but not others. And that switching may require other adjustments (e.g., removing "static"). Let's not bring that separate issue into this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for providing information about the error and fixing the list of affected environments. I moved that info into PR title/description and used it to make one small code adjustment (see commit 9edef1f for details) which I have tested with clang v18.
If you are OK with the current PR state, let's merge this fix!
@rousskov, fixed whitespace - please redo your approval to fast-track |
In hope to work around a seemingly spurious Jenkins failure, I am asking Jenkins to retest this please. |
Disk full on a node. On it |
src/fs/rock/RockRebuild.cc:356:17: error: variable length arrays in C++ are a Clang extension [-Werror,-Wvla-cxx-extension] char hdrBuf[SwapDir::HeaderSize]; note: initializer of 'HeaderSize' is unknown
src/fs/rock/RockRebuild.cc:356:17: error: variable length arrays in C++ are a Clang extension [-Werror,-Wvla-cxx-extension] char hdrBuf[SwapDir::HeaderSize]; note: initializer of 'HeaderSize' is unknown
queued for backport to v6 |
src/fs/rock/RockRebuild.cc:356:17: error: variable length arrays in C++ are a Clang extension [-Werror,-Wvla-cxx-extension] char hdrBuf[SwapDir::HeaderSize]; note: initializer of 'HeaderSize' is unknown Co-authored-by: Francesco Chemolli <5175948+kinkie@users.noreply.github.com>
src/fs/rock/RockRebuild.cc:356:17: error: variable length arrays in C++ are a Clang extension [-Werror,-Wvla-cxx-extension] char hdrBuf[SwapDir::HeaderSize]; note: initializer of 'HeaderSize' is unknown
src/fs/rock/RockRebuild.cc:356:17: error: variable length arrays in C++ are a Clang extension [-Werror,-Wvla-cxx-extension] char hdrBuf[SwapDir::HeaderSize]; note: initializer of 'HeaderSize' is unknown
src/fs/rock/RockRebuild.cc:356:17: error: variable length arrays in C++ are a Clang extension [-Werror,-Wvla-cxx-extension] char hdrBuf[SwapDir::HeaderSize]; note: initializer of 'HeaderSize' is unknown