From: jakub Date: Thu, 31 Jan 2019 07:37:34 +0000 (+0000) Subject: PR libstdc++/88170 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=abb9ae6662a81a4914cd49f4a204330644495dac;p=thirdparty%2Fgcc.git 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@268413 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index 3c55209ef340..25c5323f6dbe 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,9 @@ +2019-01-31 Jakub Jelinek + + PR libstdc++/88170 + * c-pretty-print.c (pp_c_enumeration_constant): Print always as + a C cast in pp_c_flag_gnu_v3 mode. + 2019-01-29 Jakub Jelinek PR c/86125 diff --git a/gcc/c-family/c-pretty-print.c b/gcc/c-family/c-pretty-print.c index 46db469e29a8..3e25624d3a3a 100644 --- a/gcc/c-family/c-pretty-print.c +++ b/gcc/c-family/c-pretty-print.c @@ -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)); diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 29d874223692..884f09c3b440 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2019-01-31 Jakub Jelinek + + PR libstdc++/88170 + * cxx-pretty-print.c (pp_cxx_enumeration_constant): Print always as + a C cast in pp_c_flag_gnu_v3 mode. + 2019-01-30 Jakub Jelinek PR c++/88988 diff --git a/gcc/cp/cxx-pretty-print.c b/gcc/cp/cxx-pretty-print.c index a114d6654e91..a0088a257a20 100644 --- a/gcc/cp/cxx-pretty-print.c +++ b/gcc/cp/cxx-pretty-print.c @@ -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) {