Re: A reminder about MOZ_MUST_USE and [must_use]

2017-01-20 Thread ISHIKAWA,chiaki
On 2017/01/20 8:10, Nicholas Nethercote wrote: There are lots of functions where not checking the return value is reasonable, such as close(). A file opened for writing and is buffered will flush pending data to disk upon Close() and may encounter the error such as disk full AT THAT POINT,

Re: A reminder about MOZ_MUST_USE and [must_use]

2017-01-20 Thread Michael Layzell
It wouldn't be too hard to automatically generate Result wrapper methods automatically for all of our XPIDL interfaces. I had a prototype branch at one point which did this on the rust side, as part of my now-dead rust XPIDL bindings. That would convert a good number of our fallable

Re: A reminder about MOZ_MUST_USE and [must_use]

2017-01-20 Thread Ted Mielczarek
On Fri, Jan 20, 2017, at 08:19 AM, Nicolas B. Pierron wrote: > > The Rust case is helped by the fact that `Result` is the defacto type > > for returning success or error, and it's effectively `must_use`. We > > don't have a similar default convention in C++. > > We have > >

Re: A reminder about MOZ_MUST_USE and [must_use]

2017-01-20 Thread Nicolas B. Pierron
On 01/20/2017 12:00 PM, Ted Mielczarek wrote: On Thu, Jan 19, 2017, at 07:00 PM, gsquel...@mozilla.com wrote: I think the point is that it's not obvious that "must check the return value" is a sufficiently-dominant common case for arbitrary return values. FWIW, Rust took the [must_use] rather

Re: A reminder about MOZ_MUST_USE and [must_use]

2017-01-20 Thread Ted Mielczarek
On Thu, Jan 19, 2017, at 07:00 PM, gsquel...@mozilla.com wrote: > > I think the point is that it's not obvious that "must check the return > > value" is a sufficiently-dominant common case for arbitrary return values. > > FWIW, Rust took the [must_use] rather than [can_ignore] approach too. > >

Re: A reminder about MOZ_MUST_USE and [must_use]

2017-01-19 Thread gsquelart
On Friday, January 20, 2017 at 10:36:46 AM UTC+11, Bobby Holley wrote: > On Thu, Jan 19, 2017 at 3:26 PM, wrote: > > > On Friday, January 20, 2017 at 10:13:54 AM UTC+11, Nicholas Nethercote > > wrote: > > > On Fri, Jan 20, 2017 at 10:01 AM, wrote: > > >

Re: A reminder about MOZ_MUST_USE and [must_use]

2017-01-19 Thread Bobby Holley
On Thu, Jan 19, 2017 at 3:26 PM, wrote: > On Friday, January 20, 2017 at 10:13:54 AM UTC+11, Nicholas Nethercote > wrote: > > On Fri, Jan 20, 2017 at 10:01 AM, wrote: > > > > > And the next step would be to make must-use the default, and have > > >

Re: A reminder about MOZ_MUST_USE and [must_use]

2017-01-19 Thread Chris Peterson
On 1/19/2017 3:13 PM, Nicholas Nethercote wrote: On Fri, Jan 20, 2017 at 10:01 AM, wrote: > And the next step would be to make must-use the default, and have > MOZ_CAN_IGNORE for the rest. ;-) > I actually tried this with all XPIDL methods. After adding several hundred

Re: A reminder about MOZ_MUST_USE and [must_use]

2017-01-19 Thread gsquelart
On Friday, January 20, 2017 at 10:13:54 AM UTC+11, Nicholas Nethercote wrote: > On Fri, Jan 20, 2017 at 10:01 AM, wrote: > > > And the next step would be to make must-use the default, and have > > MOZ_CAN_IGNORE for the rest. ;-) > > > > I actually tried this with all XPIDL

Re: A reminder about MOZ_MUST_USE and [must_use]

2017-01-19 Thread Nicholas Nethercote
On Fri, Jan 20, 2017 at 9:29 AM, Eric Rescorla 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

Re: A reminder about MOZ_MUST_USE and [must_use]

2017-01-19 Thread gsquelart
And the next step would be to make must-use the default, and have MOZ_CAN_IGNORE for the rest. ;-) Gerald (who is not volunteering!) On Friday, January 20, 2017 at 9:30:13 AM UTC+11, Eric Rescorla wrote: > What would actually be very helpful would be a way to selectively turn on > checking of >

Re: A reminder about MOZ_MUST_USE and [must_use]

2017-01-19 Thread Eric Rescorla
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? Thanks, -Ekr On Thu, Jan 19, 2017 at 2:09 PM, Nicholas Nethercote wrote: > Hi, > > We have

A reminder about MOZ_MUST_USE and [must_use]

2017-01-19 Thread Nicholas Nethercote
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