On 8/22/2016 9:28 PM, Nicholas Nethercote wrote:
> On Tue, Aug 23, 2016 at 9:39 AM, R Kent James <k...@caspia.com> wrote:
>> On 8/21/2016 9:14 PM, Nicholas Nethercote wrote:
>>> I strongly encourage people to do likewise on
>>> any IDL files with which they are familiar. Adding appropriate checks isn't
>>> always easy
>> Exactly, and I hope that you and others restrain your exuberance a
>> little bit for this reason. A warning would be one thing, but a hard
>> failure that forces developers to drop what they are doing and think
>> hard about an appropriate check is just having you set YOUR priorities
>> for people rather than letting people do what might be much more
>> important work.
> I see that I've caused several Thunderbird breakages with the changes
> I've been making. I apologize for not giving you advance warning about
> this.
>
> I have several desires here.
>
> - I want to greatly increase the use of MOZ_MUST_USE/[must_use] in Gecko.
>
> - I don't want to make Thunderbird developers' lives more difficult.
>
> - I don't want to have to modify comm-central when I add new uses of
> MOZ_MUST_USE/[must_use] to mozilla-central.
>
> The best solution I can see is to insert -Wno-unused-result or
> -Wno-error=unused-result in the appropriate place(s) in comm-central.
>
> Nick

Thanks for the suggestions. Generally though Thunderbird accepts that we
need to fix these breakages, so I am not discouraging you from moving
forward for our sake.

I would still encourage you though to be a little careful about forcing
checks when they are not needed. Just as an example, in nsIPipe we now have:

|[must_use] readonly attribute nsIAsyncInputStream inputStream;|

A common programming pattern that I would use, when I don't really care
about why something failed, is:

nsCOMPtr<nsIAsyncInputStream> inputStream;

pipe.GetInputStream(getter_AddRefs(inputStream));

if (!inputStream) {

  ... take action

}

If I understand the must_use correctly, you are specifically not
allowing that pattern. Why? If you have good reasons, OK fine do it. Hey
I'm a hack, maybe my example sucks and you really do want to discourage
it. But I would like to understand the reasoning for this, as from my
perspective this is just code churn where your over-exuberance is
creating unneeded work (with associated risk of regressions).

Please consider this a general question and not Thunderbird-specific.

:rkent


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

Reply via email to