This is the mail archive of the mailing list for the GDB project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 09/10] Class-ify lm_info_darwin

On 04/28/2017 10:13 PM, Simon Marchi wrote:
> On 2017-04-28 12:00, Pedro Alves wrote:
>> On 04/26/2017 11:51 PM, Simon Marchi wrote:
>>> This patch makes lm_info_darwin a "real" class.  It initializes the
>>> field and replaces XCNEW/xfree with new/delete.
>>> I believe the cleanup in darwin_current_sos can be removed, I don't see
>>> anything that can throw after the allocation and the call to
>>> discard_cleanups.
>> Agreed.
>> LGTM but ...
>>> --- a/gdb/solib-darwin.c
>>> +++ b/gdb/solib-darwin.c
>>> @@ -41,6 +41,8 @@
>>>  #include "mach-o.h"
>>>  #include "mach-o/external.h"
>>> +#include <memory>
>> ... this doesn't look necessary?  (it was not in the ChangeLog.)
> Ah, the comment in the commit log and this include is a leftover.  While
> doing the preparatory patch for darwin (01/10), I had put an xfree
> cleanup for the lm_info_darwin structure, but I later removed it.
> Should we expect that the "new" operator can throw if memory allocation
> fails?  In that case we can't get rid of the cleanup for newobj.

Yeah, pedantically new can throw here.

Pedro Alves

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]