fix: Drop the anonymous namespace from the benchmark URI - #56
Open
chfast wants to merge 1 commit into
Open
Conversation
The namespace was extracted from __PRETTY_FUNCTION__ and rejected only when
spelled '(anonymous namespace)', as clang does, so with GCC, which spells it
'{anonymous}', it ended up in the URI: file.cpp::{anonymous}::bench[…]. Strip the
segment instead of bailing out, for both spellings, so the rest of the namespace
path is kept and no error is reported for a construct that is merely unnameable.
Greptile SummaryThis PR normalizes benchmark namespace extraction across GCC and Clang by removing compiler-specific anonymous-namespace segments instead of rejecting them.
Confidence Score: 5/5The PR appears safe to merge with no actionable correctness or security issues identified. The normalization removes only compiler-generated strings that cannot be valid C++ namespace identifiers, while retaining the source-file and named-namespace portions used to identify benchmarks.
|
| Filename | Overview |
|---|---|
| core/src/uri.cpp | Anonymous namespace markers are consistently removed while preserving source-file and named-namespace components of benchmark URIs. |
Reviews (1): Last reviewed commit: "fix: Drop the anonymous namespace from t..." | Re-trigger Greptile
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.
Related to #40.
extract_lambda_namespace()rejects a namespace containing(anonymous namespace), which is how clang spells it, but GCC spells it{anonymous}and that spelling passes the check unnoticed. The benchmarks registered inside an anonymous namespace therefore end up reported asfile.cpp::{anonymous}::bench[…]with GCC, and asfile.cpp::bench[…]plus an[ERROR] Anonymous namespace not supportedline per benchmark with clang.Since an anonymous namespace is not part of any identifier a benchmark can be referred to by, this strips the segment instead of bailing out, handling both spellings. The rest of the namespace path is preserved, so
{anonymous}::outer::becomesouter::, and nothing is reported for a construct that is merely unnameable rather than unsupported.