Skip to content

Modify compiler flags to suppress variable length array error#2052

Open
peternewman wants to merge 4 commits into
OpenLightingProject:masterfrom
peternewman:0.11-plugfest-fixes
Open

Modify compiler flags to suppress variable length array error#2052
peternewman wants to merge 4 commits into
OpenLightingProject:masterfrom
peternewman:0.11-plugfest-fixes

Conversation

@peternewman
Copy link
Copy Markdown
Member

@peternewman peternewman commented May 30, 2026

Added -Wno-error=vla to COMMON_CXXFLAGS and COMMON_TESTING_FLAGS to prevent fatal warnings for variable-length arrays.

Plus other minor tidying.

Added -Wno-error=vla to COMMON_CXXFLAGS and COMMON_TESTING_FLAGS to prevent fatal warnings for variable-length arrays.
@peternewman peternewman added this to the 0.11.0 milestone May 30, 2026
@DaAwesomeP
Copy link
Copy Markdown
Member

In the future I think we should move to std::vector or similar. VLAs are not supported by some platforms (I think Windows is one of these?).

@peternewman
Copy link
Copy Markdown
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.

Copy link
Copy Markdown
Contributor

@aroffringa aroffringa left a comment

Choose a reason for hiding this comment

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

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)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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);

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.

3 participants