Jeff Law <l...@redhat.com> writes: > On 11/14/13 13:46, Richard Sandiford wrote: >> pp_c_character_constant only calls pp_p_char for values that fit into >> a HWI of the constant's signedness (i.e. an unsigned HWI if TYPE_UNSIGNED >> and a signed HWI otherwise). But pp_c_character_constant is only called by: >> >> case INTEGER_CST: >> { >> tree type = TREE_TYPE (e); >> ... >> else if (type == char_type_node) >> pp_c_character_constant (this, e); >> >> and in practice a character constant is always going to fit into a HWI. >> The current !host_integerp case simply truncates the constant to an >> unsigned int anyway. >> >> Maybe the type == wchar_type_node test is dead too, I'm not sure. >> I'm happy to remove it at the same time if that seems like the right >> thing to do. >> >> Tested on x86_64-linux-gnu. OK to install? >> >> Thanks, >> Richard >> >> >> gcc/c-family/ >> * c-pretty-print.c (pp_c_character_constant): Remove unnecessary >> host_integerp check. > Fine by me. Your call on the type == wchar_type_code.
Thanks. In the end I decided to get rid of it too. Retested on x86_64-linux-gnu and committed. Richard gcc/c-family/ * c-pretty-print.c (pp_c_character_constant): Remove unnecessary wchar_type and host_integerp checks. Index: gcc/c-family/c-pretty-print.c =================================================================== --- gcc/c-family/c-pretty-print.c 2013-11-14 20:26:04.079815938 +0000 +++ gcc/c-family/c-pretty-print.c 2013-11-15 14:47:41.739324275 +0000 @@ -950,14 +950,8 @@ pp_c_integer_constant (c_pretty_printer static void pp_c_character_constant (c_pretty_printer *pp, tree c) { - tree type = TREE_TYPE (c); - if (type == wchar_type_node) - pp_character (pp, 'L'); pp_quote (pp); - if (host_integerp (c, TYPE_UNSIGNED (type))) - pp_c_char (pp, tree_low_cst (c, TYPE_UNSIGNED (type))); - else - pp_scalar (pp, "\\x%x", (unsigned) TREE_INT_CST_LOW (c)); + pp_c_char (pp, (unsigned) TREE_INT_CST_LOW (c)); pp_quote (pp); }