Prefix public bitfield macros with LBT_ to avoid namespace pollution#177
Merged
Conversation
`src/libblastrampoline.h` is the public header, but it defined the unprefixed
macros `BF_CHUNK`, `BF_MASK`, and `BITFIELD_{GET,SET,CLEAR}` into every
consumer's namespace. `BF_MASK` in particular is a likely collision.
Rename them to `LBT_`-prefixed names (`LBT_BF_CHUNK`, `LBT_BF_MASK`,
`LBT_BITFIELD_{GET,SET,CLEAR}`) and update the in-tree usages. The three
documented public macros (`BITFIELD_{GET,SET,CLEAR}`, referenced from the
`active_forwards` docstring) are kept as backwards-compatible aliases so
existing consumers don't break; `BF_CHUNK`/`BF_MASK` were internal helpers and
are renamed without aliases.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
ViralBShah
commented
Jun 6, 2026
Per review discussion, remove the backwards-compatible `BITFIELD_{GET,SET,CLEAR}`
aliases and keep only the `LBT_`-prefixed macros. These are compile-time-only
helper macros (not exported symbols), so removing them does not affect the ABI /
soversion — no major version bump required.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
What
src/libblastrampoline.his the public header, yet it leaked the unprefixed macrosBF_CHUNK,BF_MASK, andBITFIELD_{GET,SET,CLEAR}into every consumer's preprocessor namespace.BF_MASKespecially is a plausible collision.This renames them to
LBT_-prefixed names:LBT_BF_CHUNK,LBT_BF_MASK(internal helpers — renamed, no alias)LBT_BITFIELD_{GET,SET,CLEAR}and updates the in-tree usages (
config.c,libblastrampoline.c) plus theactive_forwardsdocstring.Backwards compatibility
The three macros documented for consumers (used to read the public
active_forwardsbitfield) keep unprefixed aliases:so existing code keeps compiling. Builds cleanly.
Possible follow-up (not done here)
The header also defines platform macros (
_OS_LINUX_, etc.) that leak into consumers. Confining those is a larger, riskier change (they gateLBT_DLLEXPORT), so it's deliberately left out of this PR.Draft for review.