This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFA] gdb/14288
- From: Joel Brobecker <brobecker at adacore dot com>
- To: Keith Seitz <keiths at redhat dot com>
- Cc: "gdb-patches at sourceware dot org ml" <gdb-patches at sourceware dot org>
- Date: Wed, 17 Oct 2012 08:09:04 -0700
- Subject: Re: [RFA] gdb/14288
- References: <50393610.7060302@redhat.com>
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