This is the mail archive of the gdb-patches@sourceware.org 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 v3 06/15] Write status to CTF and read.


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. :-)


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