On Fri, Jan 20, 2017 at 9:29 AM, Eric Rescorla <e...@rtfm.com> wrote:
> What would actually be very helpful would be a way to selectively turn on > checking of > *all* return values in a given file/subdirectory. Is there some > mechanism/plan for that? > Not that I know of, other than manually annotating them. As someone who's spent some time adding these annotations, I think this idea sounds great in theory but turns out to be impractical. There are lots of functions where not checking the return value is reasonable, such as close(). And there are lots of functions that have a return value due to interface constraints, but it doesn't need to be checked, such as many XPIDL methods. And yes, you can use mozilla::Unused to mark functions that don't need checking, but that gets annoying quickly. If you want to be ambitious and avoid piecemeal approaches, I suggest using the new mozilla::Result type, which has the MOZ_MUST_USE_TYPE annotation on it that means static analysis builds will fail if results aren't checked. Doing this stuff in new code is easier than retrofitting old code. Nick _______________________________________________ dev-platform mailing list dev-platform@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-platform