[RFA] gdb/14288
Joel Brobecker
brobecker@adacore.com
Wed Oct 17 15:09:00 GMT 2012
Hi Keith,
> In the end, it reminded me too much of linespecs, so I decided to
> rewrite this code.
Nice :)
> +#define NEXT_ELEMENT VEC_index (converted_character_d, chars, idx++)
> +#define OUTPUT_COMMA \
> + do \
> + { \
> + if (last != START) \
> + obstack_grow_wstr (obstack, LCST (", ")); \
> + } \
> + while (0)
> +#define OUTPUT_CHARACTER \
> + do \
> + { \
> + if (elem->result == wchar_iterate_ok) \
> + print_wchar (elem->chars[0], elem->buf, elem->buflen, width, \
> + byte_order, obstack, quote_char, &need_escape); \
> + else \
> + print_wchar (gdb_WEOF, elem->buf, elem->buflen, width, \
> + byte_order, obstack, quote_char, &need_escape); \
> + } \
> + while (0)
> +#define OUTPUT_QUOTE(USE_QUOTE_CHAR) \
> + do \
> + { \
> + if ((USE_QUOTE_CHAR)) \
> + { \
> + if (options->inspect_it) \
> + obstack_grow_wstr (obstack, LCST ("\\")); \
> + obstack_grow (obstack, &wide_quote_char, sizeof (gdb_wchar_t)); \
> + } \
> + else \
> + obstack_grow_wstr (obstack, LCST ("'")); \
Is there any way we could avoid the use of macros? macros like that
make it much harder to debug the code; that's OK when the code is
straightforward, but I think it's borderline in this case.
It's not an objection, and if there are enough reasons for the macros
to stay, then no problem...
Thanks!
--
Joel
More information about the Gdb-patches
mailing list