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: [RFA] gdb/14288


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


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