fix -Wextra-semi warning when BOOST_SML_CFG_DISABLE_MIN_SIZE is set (#519)#672
Merged
kris-jusiak merged 1 commit intoMay 24, 2026
Conversation
8bfba91 to
c6f50b2
Compare
…oost-ext#519) When BOOST_SML_CFG_DISABLE_MIN_SIZE is defined, __BOOST_SML_ZERO_SIZE_ARRAY expanded to nothing. The ten call sites in struct bodies all end with a semicolon: __BOOST_SML_ZERO_SIZE_ARRAY(byte); so the preprocessed output contained a bare ';' inside a struct definition. Clang 14+ (and any build using -Werror -Wextra-semi) rejected this with 'extra ';' after member declaration'. Fix: expand the empty branches to 'static_assert(true)' instead of nothing. 'static_assert(true);' is a well-formed member-declaration in C++17 and has no run-time effect, but it consumes the trailing semicolon so no extra ';' appears in the struct body. Applied consistently to all four compiler branches (Clang, GCC, MSVC, IAR) that previously produced the empty expansion. Fixes boost-ext#519.
7325e1f to
000c4fe
Compare
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.
Problem
When
BOOST_SML_CFG_DISABLE_MIN_SIZEis defined,__BOOST_SML_ZERO_SIZE_ARRAYexpands to nothing. The ten call sites in struct bodies all end with a semicolon:The preprocessed output contains a bare
;inside a struct definition. Clang 14+ (and any build with-Werror -Wextra-semi) rejects this with:Fix
Expand the empty branches to
static_assert(true)instead of nothing:static_assert(true);is a well-formed member-declaration in C++17, has no run-time effect, and consumes the trailing semicolon so no extra;appears in the struct body. Applied consistently to all four compiler branches (Clang, GCC, MSVC, IAR) that previously produced the empty expansion.Verification
Compiles cleanly. Full test suite passes with no regressions.
Fixes #519.