https://bugs.llvm.org/show_bug.cgi?id=47923
Bug ID: 47923
Summary: __attribute__((warn_result_unused)) broken for ObjC
Methods in Macros
Product: clang
Version: unspecified
Hardware: All
OS: All
Status: NEW
Severity: enhancement
Priority: P
Component: -New Bugs
Assignee: unassignedclangb...@nondot.org
Reporter: dmacl...@gmail.com
CC: htmldevelo...@gmail.com, llvm-bugs@lists.llvm.org,
neeil...@live.com, richard-l...@metafoo.co.uk
Overview:
An Objective C call in a macro has its warning about unused results suppressed
which is different than a C function call. I would expect these to be
equivalent in this regard.
```
#import <Foundation/Foundation.h>
__attribute__((warn_unused_result)) static id ReturnSomethingC() { return nil;
}
@interface TestClass : NSObject
+ (id)returnSomething __attribute__((warn_unused_result));
@end
@implementation TestClass
+ (id)returnSomething { return nil; }
@end
#define DOSOMETHING_OBJC [TestClass returnSomething]
#define DOSOMETHING_C ReturnSomethingC()
int main(int argc, const char * argv[]) {
@autoreleasepool {
[TestClass returnSomething]; // <-- Here I get the warning
ReturnSomethingC(); // <-- Here I get the warning
DOSOMETHING_C; // <-- Here I get the warning
DOSOMETHING_OBJC; // <-- How do I get a warning here?
}
return 0;
}
```
it appears that Objc Messages are considered after suppression
https://github.com/llvm/llvm-project/blob/89f7ccea6f6488c443655880229c54db1f180153/clang/lib/Sema/SemaStmt.cpp#L324
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs