[llvm-bugs] [Bug 47923] New: __attribute__((warn_result_unused)) broken for ObjC Methods in Macros
via llvm-bugs
llvm-bugs at lists.llvm.org
Tue Oct 20 13:10:12 PDT 2020
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: unassignedclangbugs at nondot.org
Reporter: dmaclach at gmail.com
CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org,
neeilans at live.com, richard-llvm at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20201020/bf79a921/attachment.html>
More information about the llvm-bugs
mailing list