Pretty print of C++11 scoped enums - request help towards a proper fix
Nathan Sidwell
nathan@acm.org
Mon Sep 24 19:53:00 GMT 2018
On 9/19/18 7:41 AM, will wray wrote:
> Re: "Pretty print of enumerator never prints the id,
> always falls back to C-style cast output"
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87364
>
> I have a fix which duplicates the code in pp_c_enumeration_constant
> to pp_cxx_enumeration_constant in cxx-pretty print, with modification
>
> if (value != NULL_TREE)
> {
> if (ENUM_IS_SCOPED (type))
> pp_cxx_nested_name_specifier (pp, type);
> pp->id_expression (TREE_PURPOSE (value));
> }
>
> This works in my testing so far, but
> - It duplicates code from c to cxx (not DRY 'Don't Repeat Yourself)
> - I didn't find a single function to print full nested, scoped id
> so had to check if ENUM_IS_SCOPED to output nested specifiers.
This seems a fine approach, given the code base.
nathan
--
Nathan Sidwell
More information about the Gcc
mailing list