re PR c/35441 (pretty-printer cannot handle some expressions)
PR c/35441 * c-pretty-print.c (c_pretty_printer::expression): Handle MAX_EXPR, MIN_EXPR, EXACT_DIV_EXPR, RDIV_EXPR, LROTATE_EXPR, RROTATE_EXPR. (c_pretty_printer::postfix_expression): Handle MAX_EXPR, MIN_EXPR. (c_pretty_printer::multiplicative_expression): Handle EXACT_DIV_EXPR, RDIV_EXPR. (pp_c_shift_expression): Handle LROTATE_EXPR, RROTATE_EXPR. * gcc.dg/pr35441.c: New test. From-SVN: r247810
This commit is contained in:
parent
731f2c8acb
commit
31c2d57d4a
4 changed files with 62 additions and 1 deletions
|
@ -1,3 +1,13 @@
|
|||
2017-05-09 Volker Reichelt <v.reichelt@netcologne.de>
|
||||
|
||||
PR c/35441
|
||||
* c-pretty-print.c (c_pretty_printer::expression): Handle MAX_EXPR,
|
||||
MIN_EXPR, EXACT_DIV_EXPR, RDIV_EXPR, LROTATE_EXPR, RROTATE_EXPR.
|
||||
(c_pretty_printer::postfix_expression): Handle MAX_EXPR, MIN_EXPR.
|
||||
(c_pretty_printer::multiplicative_expression): Handle EXACT_DIV_EXPR,
|
||||
RDIV_EXPR.
|
||||
(pp_c_shift_expression): Handle LROTATE_EXPR, RROTATE_EXPR.
|
||||
|
||||
2017-05-09 Marek Polacek <polacek@redhat.com>
|
||||
|
||||
PR c/80525
|
||||
|
|
|
@ -1551,6 +1551,14 @@ c_pretty_printer::postfix_expression (tree e)
|
|||
: "__builtin_islessgreater");
|
||||
goto two_args_fun;
|
||||
|
||||
case MAX_EXPR:
|
||||
pp_c_ws_string (this, "max");
|
||||
goto two_args_fun;
|
||||
|
||||
case MIN_EXPR:
|
||||
pp_c_ws_string (this, "min");
|
||||
goto two_args_fun;
|
||||
|
||||
two_args_fun:
|
||||
pp_c_left_paren (this);
|
||||
expression (TREE_OPERAND (e, 0));
|
||||
|
@ -1829,6 +1837,8 @@ c_pretty_printer::multiplicative_expression (tree e)
|
|||
case MULT_EXPR:
|
||||
case TRUNC_DIV_EXPR:
|
||||
case TRUNC_MOD_EXPR:
|
||||
case EXACT_DIV_EXPR:
|
||||
case RDIV_EXPR:
|
||||
multiplicative_expression (TREE_OPERAND (e, 0));
|
||||
pp_c_whitespace (this);
|
||||
if (code == MULT_EXPR)
|
||||
|
@ -1890,9 +1900,13 @@ pp_c_shift_expression (c_pretty_printer *pp, tree e)
|
|||
{
|
||||
case LSHIFT_EXPR:
|
||||
case RSHIFT_EXPR:
|
||||
case LROTATE_EXPR:
|
||||
case RROTATE_EXPR:
|
||||
pp_c_shift_expression (pp, TREE_OPERAND (e, 0));
|
||||
pp_c_whitespace (pp);
|
||||
pp_string (pp, code == LSHIFT_EXPR ? "<<" : ">>");
|
||||
pp_string (pp, code == LSHIFT_EXPR ? "<<" :
|
||||
code == RSHIFT_EXPR ? ">>" :
|
||||
code == LROTATE_EXPR ? "<<<" : ">>>");
|
||||
pp_c_whitespace (pp);
|
||||
pp_c_additive_expression (pp, TREE_OPERAND (e, 1));
|
||||
break;
|
||||
|
@ -2186,6 +2200,8 @@ c_pretty_printer::expression (tree e)
|
|||
case UNLT_EXPR:
|
||||
case UNGE_EXPR:
|
||||
case UNGT_EXPR:
|
||||
case MAX_EXPR:
|
||||
case MIN_EXPR:
|
||||
case ABS_EXPR:
|
||||
case CONSTRUCTOR:
|
||||
case COMPOUND_LITERAL_EXPR:
|
||||
|
@ -2217,11 +2233,15 @@ c_pretty_printer::expression (tree e)
|
|||
case MULT_EXPR:
|
||||
case TRUNC_MOD_EXPR:
|
||||
case TRUNC_DIV_EXPR:
|
||||
case EXACT_DIV_EXPR:
|
||||
case RDIV_EXPR:
|
||||
multiplicative_expression (e);
|
||||
break;
|
||||
|
||||
case LSHIFT_EXPR:
|
||||
case RSHIFT_EXPR:
|
||||
case LROTATE_EXPR:
|
||||
case RROTATE_EXPR:
|
||||
pp_c_shift_expression (this, e);
|
||||
break;
|
||||
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
2017-05-09 Volker Reichelt <v.reichelt@netcologne.de>
|
||||
|
||||
PR c/35441
|
||||
* gcc.dg/pr35441.c: New test.
|
||||
|
||||
2017-05-09 Martin Sebor <msebor@redhat.com>
|
||||
|
||||
PR testsuite/80643
|
||||
|
|
26
gcc/testsuite/gcc.dg/pr35441.c
Normal file
26
gcc/testsuite/gcc.dg/pr35441.c
Normal file
|
@ -0,0 +1,26 @@
|
|||
/* PR c/35441 */
|
||||
/* { dg-do compile } */
|
||||
/* { dg-options "-fno-diagnostics-show-caret" } */
|
||||
/* { dg-bogus "not supported by" "" { target *-*-* } 0 } */
|
||||
|
||||
void foo1(char **p, char **q)
|
||||
{
|
||||
(p - q)(); /* { dg-error "is not a function" } */
|
||||
}
|
||||
|
||||
void foo2(double x, double y)
|
||||
{
|
||||
(x/y)(); /* { dg-error "is not a function" } */
|
||||
}
|
||||
|
||||
void foo3(unsigned i, int j)
|
||||
{
|
||||
(i << j | i >> (32 - j))(); /* { dg-error "is not a function" } */
|
||||
(i >> j | i << (32 - j))(); /* { dg-error "is not a function" } */
|
||||
}
|
||||
|
||||
void foo4(char *p, char *q)
|
||||
{
|
||||
(p < q ? p : q)(); /* { dg-error "is not a function" } */
|
||||
(p > q ? p : q)(); /* { dg-error "is not a function" } */
|
||||
}
|
Loading…
Add table
Reference in a new issue