<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - __attribute__((warn_result_unused)) broken for ObjC Methods in Macros"
href="https://bugs.llvm.org/show_bug.cgi?id=47923">47923</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>__attribute__((warn_result_unused)) broken for ObjC Methods in Macros
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Hardware</th>
<td>All
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>-New Bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>dmaclach@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org, neeilans@live.com, richard-llvm@metafoo.co.uk
</td>
</tr></table>
<p>
<div>
<pre>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
<a href="https://github.com/llvm/llvm-project/blob/89f7ccea6f6488c443655880229c54db1f180153/clang/lib/Sema/SemaStmt.cpp#L324">https://github.com/llvm/llvm-project/blob/89f7ccea6f6488c443655880229c54db1f180153/clang/lib/Sema/SemaStmt.cpp#L324</a></pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>