[swift-evolution] Make non-void functions @warn_unused_result by default
Chris Lattner
clattner at apple.com
Thu Dec 10 19:31:34 CST 2015
> On Dec 10, 2015, at 4:49 PM, Dmitri Gribenko via swift-evolution <swift-evolution at swift.org> wrote:
>
> On Thu, Dec 10, 2015 at 4:47 PM, Adrian Kashivskyy
> <adrian.kashivskyy at me.com> wrote:
>> I'm sure there are plenty of methods in Foundation that return a value which
>> can be ignored. However, as Joe noticed, such functions are generally in
>> minority.
>>
>> I'd rather see a couple of `@allow_unused_result` than a dozen of
>> `@warn_unused_result`.
>
> We are interested in seeing the actual data.
FWIW, if there was a widespread problem, we could have the importer slap @suppress_unused_result on all imported decls (at least, ones that didn’t have the clang warn_unused_result attribute).
This would allow swift code to have the “right” default policy without causing a ton of noise from imported APIs.
-Chris
More information about the swift-evolution
mailing list