On Fri, Mar 23, 2018 at 02:16:32PM +0100, Marek Polacek wrote: > > So, I think you want: > > 1) in cxx_pretty_printer::multiplicative_expression add > > EXACT_DIV_EXPR and (like you did) RDIV_EXPR, and change the pp_slash > > condition to code != TRUNC_MOD_EXPR > > 2) in cxx_pretty_printer::expression above the multiplicative_expression > > call add case EXACT_DIV_EXPR: and case RDIV_EXPR > > 3) in c_pretty_printer::multiplicative_expression change the > > code == TRUNC_DIV_EXPR condition to code != TRUNC_MOD_EXPR. > > Done. > > > 4) see if you can reproduce the c-pretty-print.c bug in some C testcase, > > whether you get really % instead of / printed for floating point division. > > I've found one, though it's quite bizzare. But it showed that we were > printing > "a % b" despite the user code having "a / b". > > Bootstrapped/regtested on x86_64-linux, ok for trunk? > > 2018-03-23 Marek Polacek <pola...@redhat.com> > > PR c++/85045 > * c-pretty-print.c (c_pretty_printer::multiplicative_expression) > <case RDIV_EXPR>: Tweak condition. > > * cxx-pretty-print.c (cxx_pretty_printer::multiplicative_expression): > Handle EXACT_DIV_EXPR and RDIV_EXPR. Tweak condition. > (cxx_pretty_printer::expression): Handle EXACT_DIV_EXPR and RDIV_EXPR. > > * g++.dg/cpp0x/Wnarrowing5.C: New test. > * gcc.dg/pr85045.c: New test.
Ok, thanks. Jakub