Backport to 9.x: fix build-SITL-Mac VLA-folding-constant error in log.c - #11724
Backport to 9.x: fix build-SITL-Mac VLA-folding-constant error in log.c#11724MakeSomeFakeNews wants to merge 1 commit into
Conversation
_logBufferHex() sized a stack buffer using two `const size_t` locals (charsPerByte, maxBytes). In C, const-qualified objects are not integer constant expressions, so the array size expression was technically a variable-length array; recent AppleClang treats reliance on its extension that folds such expressions back to a constant as an error under -Werror -Wgnu-folding-constant, breaking build-SITL-Mac. Replace the const locals with a local enum, whose members are genuine integer constant expressions in C. The buffer size and behavior are unchanged (13 + 5*8 + 1 = 54 bytes either way). (cherry picked from commit 87ed42b)
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
|
Closing — maintenance-9.x is not an actively maintained target branch right now (we're working from |
Cherry-pick of 87ed42b from
masterontomaintenance-9.x(original author credited in the commit).build-SITL-Maccurrently fails on every PR targetingmaintenance-9.x:src/main/common/log.c:210sizes a stack buffer withconst size_tlocals, which clang on the macOS runners now rejects under-Werror,-Wgnu-folding-constant. Replacing the locals with anenum(as already done on master) makes the array size a true constant expression.Example of an affected PR: #11723 (all jobs pass except
build-SITL-Mac).