Modify compiler flags to suppress variable length array error#2052
Open
peternewman wants to merge 4 commits into
Open
Modify compiler flags to suppress variable length array error#2052peternewman wants to merge 4 commits into
peternewman wants to merge 4 commits into
Conversation
Added -Wno-error=vla to COMMON_CXXFLAGS and COMMON_TESTING_FLAGS to prevent fatal warnings for variable-length arrays.
Member
|
In the future I think we should move to |
Member
Author
|
I've created #2053 to track that. TBH I'd assumed extracting from argc/argv would be a bit of a pain, but it doesn't look too bad thankfully. |
aroffringa
reviewed
May 31, 2026
Contributor
aroffringa
left a comment
There was a problem hiding this comment.
Flag changes look fine. I added one suggestion for the cast for which you use NOLINT.
Comment on lines
+103
to
+105
| // Changing these to a static_cast breaks the tests at least | ||
| tr.tx_buf = (uint64_t) tx_buf; // NOLINT(readability/casting) | ||
| tr.rx_buf = (uint64_t) rx_buf; // NOLINT(readability/casting) |
Contributor
There was a problem hiding this comment.
I don't think a static_cast should even compile here; the C cast will behave like a reinterpret_cast in this case (but is more permissive). I think best would be to do an explicit reinterpret_cast:
Suggested change
| // Changing these to a static_cast breaks the tests at least | |
| tr.tx_buf = (uint64_t) tx_buf; // NOLINT(readability/casting) | |
| tr.rx_buf = (uint64_t) rx_buf; // NOLINT(readability/casting) | |
| tr.tx_buf = reinterpret_cast<uint64_t>(tx_buf); | |
| tr.rx_buf = reinterpret_cast<uint64_t>(rx_buf); |
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.
Added -Wno-error=vla to COMMON_CXXFLAGS and COMMON_TESTING_FLAGS to prevent fatal warnings for variable-length arrays.
Plus other minor tidying.