[swift-evolution] clang auto-attaching @discardableResult attribute on imported declarations

Chris Lattner clattner at apple.com
Mon Oct 24 23:43:52 CDT 2016


> On Oct 21, 2016, at 4:55 AM, Pär Strindevall via swift-evolution <swift-evolution at swift.org> wrote:
> 
> Hey!
> 
> I got sick of having to assign unused results with _ = when using Objective-C dependencies so I decided to fork and fix the one I was using before finishing the line. When I searched for solutions to the problem I stumbled upon SE-0047 here: https://bugs.swift.org/browse/SR-1052 <https://bugs.swift.org/browse/SR-1052>
> 
> I noted that suggested patch 3 was to change the clang importer to attach @discardableResult automatically to imported declarations like the one I was using. Did this not happen? Is there any way for me to suppress the warnings that flood Xcode when not assigning unused results to nada if the dependency I’m bleep-blooping with is implemented in Objective-C?

Hi Pär,

I’m confused what you’re saying.  If I understand you correctly, you’re saying that you’re interfacing with ObjC code and getting a bunch of warnings saying that you’re ignoring the results of calls to these functions.  If that is the case, then there is certainly a compiler bug at work.  Can you provide an example that reproduces this behavior?  If I’m misunderstanding the situation, please clarify.  Thanks!

-Chris

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20161024/b118cb80/attachment.html>


More information about the swift-evolution mailing list