Hi! The r265077 changes broke +FAIL: libstdc++-prettyprinters/cxx17.cc print p +FAIL: libstdc++-prettyprinters/cxx17.cc print p +FAIL: libstdc++-prettyprinters/cxx17.cc print q +FAIL: libstdc++-prettyprinters/cxx17.cc print q +FAIL: libstdc++-prettyprinters/cxx17.cc print wp +FAIL: libstdc++-prettyprinters/cxx17.cc print wp +FAIL: libstdc++-prettyprinters/cxx17.cc print wq +FAIL: libstdc++-prettyprinters/cxx17.cc print wq +FAIL: libstdc++-prettyprinters/shared_ptr.cc print sp1 +FAIL: libstdc++-prettyprinters/shared_ptr.cc print sp1 +FAIL: libstdc++-prettyprinters/shared_ptr.cc print wp1 +FAIL: libstdc++-prettyprinters/shared_ptr.cc print wp1 +FAIL: libstdc++-prettyprinters/shared_ptr.cc print wp2 +FAIL: libstdc++-prettyprinters/shared_ptr.cc print wp2 where GDB isn't able to cope with the enumerators rather than (enumerated_type) constant_integer e.g. in template arguments. While printing enumerators might be more user-friendly in diagnostics (though, if there are several enumerators with the same value, we don't really preserve which one has been used in the source, just the first matching one is printed), for debug info purposes I think the old way is more expressive, requires less work from the debugger to find out what exact value it has. We have other spots where we change the pretty printing decisions based on whether it is a debug info string (decl_as_dwarf_string or lang_decl_dwarf_name) or some other one.
Bootstrapped/regtested on x86_64-linux and i686-linux, fixes the above tests, ok for trunk? 2019-01-30 Jakub Jelinek <ja...@redhat.com> PR libstdc++/88170 * c-pretty-print.c (pp_c_enumeration_constant): Print always as a C cast in pp_c_flag_gnu_v3 mode. * cxx-pretty-print.c (pp_cxx_enumeration_constant): Print always as a C cast in pp_c_flag_gnu_v3 mode. --- gcc/c-family/c-pretty-print.c.jj 2019-01-01 12:37:51.297414807 +0100 +++ gcc/c-family/c-pretty-print.c 2019-01-30 15:18:14.687063006 +0100 @@ -976,14 +976,14 @@ static void pp_c_enumeration_constant (c_pretty_printer *pp, tree e) { tree type = TREE_TYPE (e); - tree value; + tree value = NULL_TREE; /* Find the name of this constant. */ - for (value = TYPE_VALUES (type); - value != NULL_TREE - && !tree_int_cst_equal (DECL_INITIAL (TREE_VALUE (value)), e); - value = TREE_CHAIN (value)) - ; + if ((pp->flags & pp_c_flag_gnu_v3) == 0) + for (value = TYPE_VALUES (type); value != NULL_TREE; + value = TREE_CHAIN (value)) + if (tree_int_cst_equal (DECL_INITIAL (TREE_VALUE (value)), e)) + break; if (value != NULL_TREE) pp->id_expression (TREE_PURPOSE (value)); --- gcc/cp/cxx-pretty-print.c.jj 2019-01-17 09:03:11.487787550 +0100 +++ gcc/cp/cxx-pretty-print.c 2019-01-30 15:22:00.867327307 +0100 @@ -309,14 +309,14 @@ static void pp_cxx_enumeration_constant (cxx_pretty_printer *pp, tree e) { tree type = TREE_TYPE (e); - tree value; + tree value = NULL_TREE; /* Find the name of this constant. */ - for (value = TYPE_VALUES (type); - value != NULL_TREE - && !tree_int_cst_equal (DECL_INITIAL (TREE_VALUE (value)), e); - value = TREE_CHAIN (value)) - ; + if ((pp->flags & pp_c_flag_gnu_v3) == 0) + for (value = TYPE_VALUES (type); value != NULL_TREE; + value = TREE_CHAIN (value)) + if (tree_int_cst_equal (DECL_INITIAL (TREE_VALUE (value)), e)) + break; if (value != NULL_TREE) { Jakub