fix: rename reserved __BOOST_SML_* macros and args__ identifiers (issue #220)#683
Open
PavelGuzenfeld wants to merge 2 commits into
Open
fix: rename reserved __BOOST_SML_* macros and args__ identifiers (issue #220)#683PavelGuzenfeld wants to merge 2 commits into
PavelGuzenfeld wants to merge 2 commits into
Conversation
082cc98 to
4b8c3e6
Compare
Contributor
Author
|
Branch rebased onto current master (which merged PRs #672, #673, #676, #677, #678, #679). Conflict resolution: PR #678 added a doc comment above the Additional fix: |
…t-ext#220) Identifiers beginning with double-underscore (__) are reserved by the C++ standard for any use by the implementation (ISO C++ [lex.name]). Using them in a library header is undefined behaviour. Renames (no behaviour change): __BOOST_SML_UNUSED -> BOOST_SML_DETAIL_UNUSED __BOOST_SML_VT_INIT -> BOOST_SML_DETAIL_VT_INIT __BOOST_SML_ZERO_SIZE_ARRAY -> BOOST_SML_DETAIL_ZERO_SIZE_ARRAY __BOOST_SML_ZERO_SIZE_ARRAY_CREATE -> BOOST_SML_DETAIL_ZERO_SIZE_ARRAY_CREATE __BOOST_SML_TEMPLATE_KEYWORD -> BOOST_SML_DETAIL_TEMPLATE_KEYWORD __BOOST_SML_REQUIRES -> BOOST_SML_DETAIL_REQUIRES __BOOST_SML_DEFINED_HAS_BUILTIN -> BOOST_SML_DETAIL_DEFINED_HAS_BUILTIN args1__ (internal identifier) -> args1_ args__ (internal identifier) -> args_ The __has_builtin macro is intentionally left unchanged: SML defines it only to emulate the compiler's own feature-test macro on platforms that lack it, and the name must match the compiler convention. A matching #undef BOOST_SML_DETAIL_REQUIRES is added to the cleanup section at the end of the header (the old __BOOST_SML_REQUIRES was not previously undef'd). All public user-facing macros (BOOST_SML_CFG_*, BOOST_SML_CREATE_*, BOOST_SML_NAMESPACE_*) are unchanged — only implementation-detail macros are affected.
fecd811 to
760fe90
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
The C++ standard (ISO C++ [lex.name]) reserves all identifiers that begin with two consecutive underscores (
__) for any use by the implementation. Using them in a library header is undefined behaviour.SML's
include/boost/sml.hppcontained seven such macros and two reserved C++ identifiers:__BOOST_SML_UNUSEDBOOST_SML_DETAIL_UNUSED__BOOST_SML_VT_INITBOOST_SML_DETAIL_VT_INIT__BOOST_SML_ZERO_SIZE_ARRAYBOOST_SML_DETAIL_ZERO_SIZE_ARRAY__BOOST_SML_ZERO_SIZE_ARRAY_CREATEBOOST_SML_DETAIL_ZERO_SIZE_ARRAY_CREATE__BOOST_SML_TEMPLATE_KEYWORDBOOST_SML_DETAIL_TEMPLATE_KEYWORD__BOOST_SML_REQUIRESBOOST_SML_DETAIL_REQUIRES__BOOST_SML_DEFINED_HAS_BUILTINBOOST_SML_DETAIL_DEFINED_HAS_BUILTINargs1__(C++ identifier)args1_args__(C++ identifier)args___has_builtinis intentionally left unchanged — SML defines it only on platforms where the compiler doesn't provide it, and the name must match the compiler convention.Notes
BOOST_SML_CFG_*,BOOST_SML_CREATE_*,BOOST_SML_NAMESPACE_*) are unaffected.__BOOST_SML_*macros (the double-underscore prefix explicitly signals implementation detail).#undef BOOST_SML_DETAIL_REQUIRESis added to the cleanup section at the end of the header; the previous__BOOST_SML_REQUIRESwas missing its#undef.Closes #220