Suppress __COUNTER__ pedantic warning on Clang#3079
Open
iamtgiri wants to merge 2 commits intocatchorg:develfrom
Open
Suppress __COUNTER__ pedantic warning on Clang#3079iamtgiri wants to merge 2 commits intocatchorg:develfrom
iamtgiri wants to merge 2 commits intocatchorg:develfrom
Conversation
Clang 22 with -pedantic-errors treats __COUNTER__ as a C2y extension and emits an error. Wrap the __COUNTER__ usage with diagnostic pragmas to suppress the warning on Clang. Fixes catchorg#3076
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## devel #3079 +/- ##
==========================================
- Coverage 91.38% 91.37% -0.01%
==========================================
Files 204 204
Lines 8899 8899
==========================================
- Hits 8132 8131 -1
- Misses 767 768 +1 🚀 New features to boost your workflow:
|
Older Clang versions (< 22) do not recognize -Wc2y-extensions and emit an error for the unknown warning group. Suppress -Wunknown-warning-option first so older Clang versions silently ignore the unrecognized warning name.
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.
Description
Clang 22 with
-pedantic-errorstreats__COUNTER__as a C2yextension and emits a hard error on every
TEST_CASE()usage.This fix wraps the
__COUNTER__usage incatch_unique_name.hppwith Clang-specific diagnostic pragmas to suppress
-Wc2y-extensionslocally, without affecting any other compiler or warning.
GitHub Issues
Closes #3076