Hi,

We have two annotations that can be used to prevent missing return value
checks:

- MOZ_MUST_USE for C++ functions where the return type indicates
success/failure, e.g. nsresult, bool (in some instances), and some other
types.

- [must_use] for IDL methods and properties where the nsresult value should
be checked.

We have *many* functions/methods/properties for which these annotations are
appropriate, and *many* missing return value checks. Unfortunately, trying
to fix these proactively is a frustrating and thankless task, because it's
difficult to know in advance which missing checks are likely to cause
problems in advance, and adding missing checks is not always
straightforward.

However, if you do see clearly buggy behaviour (e.g. a crash) caused by a
missing return value, please take the opportunity to retroactively add the
annotation(s) in that case!
https://bugzilla.mozilla.org/show_bug.cgi?id=1331619 is a good example of
such a bug, and https://bugzilla.mozilla.org/show_bug.cgi?id=1332453 is the
follow-up to add the annotations.

Nick
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to