This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH v3 06/15] Write status to CTF and read.
- From: Doug Evans <dje at google dot com>
- To: Yao Qi <yao at codesourcery dot com>
- Cc: gdb-patches <gdb-patches at sourceware dot org>
- Date: Fri, 29 Mar 2013 08:50:08 -0700
- Subject: Re: [PATCH v3 06/15] Write status to CTF and read.
- References: <1362800844-27940-1-git-send-email-yao at codesourcery dot com> <1362800844-27940-7-git-send-email-yao at codesourcery dot com> <20802 dot 4537 dot 197713 dot 506858 at ruffy2 dot mtv dot corp dot google dot com> <5155415C dot 4030309 at codesourcery dot com>
On Fri, Mar 29, 2013 at 12:23 AM, Yao Qi <yao@codesourcery.com> wrote:
> On 03/15/2013 02:06 AM, Doug Evans wrote:
>> > +#define SET_INT32_FIELD(EVENT, SCOPE, VAR, FIELD) \
>> > + VAR->FIELD = (int) bt_ctf_get_int64 (bt_ctf_get_field (EVENT, \
>> > + SCOPE, \
>> > + #FIELD))
>>
>> Macros like this should be in a do { } while (0).
>> do { \
>> ...; \
>> } while (0)
>>
>
> Do we really need do/while loop for this single-line macro?
Always IMO.
>> Plus wrap params in parens (except #FIELD of course).
>>
>
> Of course.
Look at it as wrapping the statement in a do/while is like wrapping
the params in parens. :-)