Split redefine_extname out of -Wpragmas
Nobody has claimed this yet.
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
Right now, many warnings are controlled by -Wpragmas itself, but #pragma redefine_extname's warning can over-occur in code bases easily.
#pragma redefine_extname foo bar
// ...
namespace x {
void foo() {}
}
prints:
<source>:6:10: warning: #pragma redefine_extname is applicable to external C declarations only; not applied to function 'foo' [-Wpragmas]
6 | void foo() {}
| ^
See https://godbolt.org/z/hGsdhaWWM.
When this is intentional, the only way to turn off the warning is to turn the warning down (from a -Werror starting point) at the definition site of foo using:
#pragma GCC diagnostic warning "-Wpragmas"
However, this requires touching the definition sites, which don't even have pragmas, so this is kinda weird.
But as I personally do not even see a point in this warning (we intend to only affect external C symbols after all), I would like to turn it off (or down from error to warning) without affecting all the rest in -Wpragmas. So best would be getting a specific flag for just this one.
A slightly different option would be if the warning could be "back-dated" to the #pragma redefine_extname line (and also be affected by the pushed/popped diagnostics state from there). Then we could disable it in a targeted manner without affecting everything else.
Any ideas?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing how Clang handles #pragma redefine_extname diagnostics and how that warning is grouped under -Wpragmas. Compare the separate-warning and back-dated-diagnostic options described in the issue; done means one targeted behavior is implemented and covered by relevant compiler diagnostic tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100