From: Doug Evans <dje@google.com>
To: Pedro Alves <palves@redhat.com>
Cc: Joel Brobecker <brobecker@adacore.com>,
gdb-patches <gdb-patches@sourceware.org>
Subject: Re: [RFA] Ensure result of make_cleanup is never NULL.
Date: Wed, 18 Apr 2012 14:32:00 -0000 [thread overview]
Message-ID: <CADPb22Td7tF8zDW54AYHa8bemPQAPr=QfkvLLZzz9k1N8HA=xw@mail.gmail.com> (raw)
In-Reply-To: <4F8ECE4F.1070004@redhat.com>
On Wed, Apr 18, 2012 at 7:23 AM, Pedro Alves <palves@redhat.com> wrote:
> On 04/18/2012 03:02 PM, Doug Evans wrote:
>
>> On Wed, Apr 18, 2012 at 2:26 AM, Pedro Alves <palves@redhat.com> wrote:
>>> On 04/18/2012 01:43 AM, Doug Evans wrote:
>>>
>>>> btw, I thought about making cleanup_sentinel const here, for a bit of
>>>> extra robustness.
>>>
>>>
>>> Won't that mean you'd need to cast the constness out in most, if
>>> not all places that use it?
>
>
> Well, aren't all places using the sentinel, using it throught the macro?
> What does this make more robust?
Any attempts to modify the sentinel will segv.
>>
>> --- cleanups.c= 2012-04-17 12:02:38.000000000 -0700
>> +++ cleanups.c 2012-04-18 06:59:46.000000000 -0700
>> @@ -50,10 +50,10 @@ struct cleanup
>> [though this won't catch errors that a value of, say,
>> ((struct cleanup *) -1) will]
>> - displays as something useful when printed in gdb. */
>> -static struct cleanup cleanup_sentinel;
>> +static const struct cleanup cleanup_sentinel;
>>
>> /* Handy macro to use when referring to cleanup_sentinel. */
>> -#define CLEANUP_SENTINEL (&cleanup_sentinel)
>> +#define CLEANUP_SENTINEL ((struct cleanup *) &cleanup_sentinel)
>>
>> /* Chain of cleanup actions established with make_cleanup,
>> to be executed if an error happens. */
next prev parent reply other threads:[~2012-04-18 14:32 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-16 5:01 Doug Evans
2012-04-16 10:58 ` Pedro Alves
2012-04-16 14:44 ` Joel Brobecker
2012-04-16 14:58 ` Jan Kratochvil
2012-04-16 15:03 ` Pedro Alves
2012-04-16 20:16 ` Tom Tromey
[not found] ` <CADPb22SfUk5s9JSSBvUTWVyhoiEqO4Gi+VNO-9MwH6rqW8qQ3g@mail.gmail.com>
2012-04-17 23:12 ` Doug Evans
2012-04-18 1:06 ` Doug Evans
2012-04-18 1:58 ` Joel Brobecker
2012-04-18 9:21 ` Pedro Alves
2012-04-18 9:29 ` Pedro Alves
2012-04-18 14:14 ` Doug Evans
2012-04-18 14:25 ` Pedro Alves
2012-04-18 14:32 ` Doug Evans [this message]
2012-04-18 14:36 ` Pedro Alves
2012-04-18 14:38 ` Tom Tromey
2012-04-19 19:24 ` Doug Evans
2012-04-18 9:26 ` Pedro Alves
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CADPb22Td7tF8zDW54AYHa8bemPQAPr=QfkvLLZzz9k1N8HA=xw@mail.gmail.com' \
--to=dje@google.com \
--cc=brobecker@adacore.com \
--cc=gdb-patches@sourceware.org \
--cc=palves@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox