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 v2] sim: avoid TRACE redefine warnings


On Tue, Mar 16, 2010 at 9:06 AM, Joel Brobecker <brobecker@adacore.com> wrote:
>> 2010-03-15 ?Mike Frysinger ?<vapier@gentoo.org>
>>
>> ? ? ? * hw-ports.c (TRACE): Delete.
>> ? ? ? * hw-properties.c (TRACE): Delete.
>> ? ? ? (hw_find_ihandle_runtime_property): Change TRACE to HW_TRACE.
>> ? ? ? (hw_find_integer_property): Likewise.
>> ? ? ? (hw_find_integer_array_property): Likewise.
>> ? ? ? (hw_add_duplicate_property): Likewise.
>
> This looks good to me. I don't understand why people use two parentheses
> in the call to HW_TRACE:
>
> ? ?HW_TRACE ((me, [...], property))
>
> But it looks like it's the style being used, so OK.

For reference sake,
It's not style, it's correctness.
Having two parens  allows for variadic macros in the absence of
explicit support from the language.

void hw_trace
(struct hw *me,
 const char *fmt,
 ...) __attribute__ ((format (printf, 2, 3)));

#define HW_TRACE(ARGS) \
do { \
  if (hw_trace_p (me)) \
    { \
      hw_trace ARGS; \
    } \
} while (0)


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