================
@@ -302,27 +312,38 @@ void Sema::DiagnoseUnusedExprResult(const Stmt *S,
unsigned DiagID) {
if (const Decl *FD = CE->getCalleeDecl()) {
if (ShouldSuppress)
return;
- if (FD->hasAttr<PureAttr>()) {
+ if (const auto *A = FD->getAttr<PureAttr>()) {
Diag(Loc, diag::warn_unused_call) << R1 << R2 << "pure";
+ if (OffendingDecl && !OffendingDecl->getIdentifier()->getBuiltinID())
----------------
Mick235711 wrote:
That check on builtin is actually added after the test `Seme/enable-if.c` fails:
```cpp
int isdigit(int c) __attribute__((overloadable));
int isdigit(int c) __attribute__((overloadable)) // expected-note {{'isdigit'
has been explicitly marked unavailable here}}
__attribute__((enable_if(c <= -1 || c > 255, "'c' must have the value of an
unsigned char or EOF")))
__attribute__((unavailable("'c' must have the value of an unsigned char or
EOF")));
void test3(int c) {
isdigit(c); // expected-warning{{ignoring return value of function declared
with pure attribute}}
isdigit(10); // expected-warning{{ignoring return value of function declared
with pure attribute}}
#ifndef CODEGEN
isdigit(-10); // expected-error{{'isdigit' is unavailable: 'c' must have the
value of an unsigned char or EOF}}
#endif
}
```
In this part of the test, without the builtin test a note will be generated on
the first line ("`isdigit` has been explicitly marked pure here"), which is the
result of isdigit been assigned pure attribute as a builtin.
Though despite this, thinking it over now, it is still debatable on whether
generating note here on builtin is meaningful/useful... Do you think I should
remove the test?
https://github.com/llvm/llvm-project/pull/112289
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits