Move structs into unnamed namespaces #1398
Merged
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.
When the STL's separately compiled code needs helper structs, we often define them in unnamed namespaces. This is simpler to understand (making it clear that the helpers are specific to one translation unit), and cleaner for static linking (unnamed namespaces now grant internal linkage).
I noticed a few things that weren't following this convention - the recently-added XFG trampoline, and the
system_error
tables. This PR moves the structs (and the tables) into top-level unnamed namespaces. It additionally removesstatic
from the namespace-scopeconstexpr
tables, as that's super redundant.(We wouldn't need to use
_STD
forerrc
and_Execute_once_fp_t
if these were unnamed namespaces withinstd
. However, we appear to have generally avoided that, with the exception of someConcurrency::details::unnamed-namespace
code.)This does not attempt to move all such structs into unnamed namespaces; there some helper structs for iostreams that I consider way too scary to change.