Commit cfc20ea
[Clang] FunctionEffects: Make a separate diagnostic group for redeclarations/overrides where effects are implicit. (#148690)
The current function effect diagnostics include these behaviors:
When you declare a function `nonblocking` (typically in a header) and
then omit the attribute on the implementation (or any other
redeclaration), Clang warns: attribute 'nonblocking' on function does
not match previous declaration.
But if a `nonblocking` function is a C++ virtual method, then overrides
are implicitly nonblocking; the attribute doesn't need to be explicitly
stated.
These behaviors are arguably inconsistent -- and also, both, more
pedantic than the rest of the function effect diagnostics.
This PR accomplishes two things:
- Separates the diagnostic on a redeclaration into a new group,
`-Wfunction-effect-redeclarations`, so it can be disabled independently.
- Adds a second diagnostic to this new group, for the case of an
override method missing the attribute. (This helps in a situation where
I'm trying to add `nonblocking` via a macro that does other things and I
want to know that the macro is missing on an override declaration.)
---------
Co-authored-by: Doug Wyatt <[email protected]>
Co-authored-by: Sirraide <[email protected]>1 parent a89e6f6 commit cfc20ea
File tree
5 files changed
+47
-15
lines changed- clang
- docs
- include/clang/Basic
- lib/Sema
- test/Sema
5 files changed
+47
-15
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
710 | 710 | | |
711 | 711 | | |
712 | 712 | | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
713 | 719 | | |
714 | 720 | | |
715 | 721 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1293 | 1293 | | |
1294 | 1294 | | |
1295 | 1295 | | |
| 1296 | + | |
1296 | 1297 | | |
1297 | 1298 | | |
1298 | 1299 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11530 | 11530 | | |
11531 | 11531 | | |
11532 | 11532 | | |
11533 | | - | |
11534 | | - | |
11535 | | - | |
11536 | | - | |
11537 | | - | |
11538 | | - | |
| 11533 | + | |
| 11534 | + | |
| 11535 | + | |
| 11536 | + | |
| 11537 | + | |
11539 | 11538 | | |
11540 | 11539 | | |
11541 | 11540 | | |
11542 | 11541 | | |
11543 | 11542 | | |
| 11543 | + | |
| 11544 | + | |
| 11545 | + | |
| 11546 | + | |
| 11547 | + | |
| 11548 | + | |
| 11549 | + | |
| 11550 | + | |
| 11551 | + | |
| 11552 | + | |
| 11553 | + | |
| 11554 | + | |
11544 | 11555 | | |
11545 | 11556 | | |
11546 | 11557 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18682 | 18682 | | |
18683 | 18683 | | |
18684 | 18684 | | |
18685 | | - | |
| 18685 | + | |
18686 | 18686 | | |
18687 | 18687 | | |
18688 | 18688 | | |
| |||
18695 | 18695 | | |
18696 | 18696 | | |
18697 | 18697 | | |
| 18698 | + | |
| 18699 | + | |
| 18700 | + | |
| 18701 | + | |
| 18702 | + | |
| 18703 | + | |
| 18704 | + | |
| 18705 | + | |
18698 | 18706 | | |
18699 | 18707 | | |
18700 | 18708 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | | - | |
| 1 | + | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| |||
127 | 127 | | |
128 | 128 | | |
129 | 129 | | |
130 | | - | |
| 130 | + | |
131 | 131 | | |
132 | 132 | | |
133 | 133 | | |
134 | 134 | | |
135 | | - | |
136 | | - | |
| 135 | + | |
| 136 | + | |
137 | 137 | | |
| 138 | + | |
138 | 139 | | |
139 | 140 | | |
140 | 141 | | |
141 | 142 | | |
142 | | - | |
143 | | - | |
| 143 | + | |
| 144 | + | |
144 | 145 | | |
145 | 146 | | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
146 | 152 | | |
147 | 153 | | |
148 | 154 | | |
149 | 155 | | |
150 | 156 | | |
151 | 157 | | |
152 | | - | |
| 158 | + | |
153 | 159 | | |
154 | 160 | | |
155 | 161 | | |
| |||
0 commit comments