diff options
Diffstat (limited to 'gcc/c')
-rw-r--r-- | gcc/c/ChangeLog | 15 | ||||
-rw-r--r-- | gcc/c/c-array-notation.c | 4 | ||||
-rw-r--r-- | gcc/c/c-decl.c | 2 | ||||
-rw-r--r-- | gcc/c/c-parser.c | 8 | ||||
-rw-r--r-- | gcc/c/c-typeck.c | 46 |
5 files changed, 46 insertions, 29 deletions
diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index 4a9881d..46c2969 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,18 @@ +2016-09-14 Marek Polacek <polacek@redhat.com> + + * c-array-notation.c (create_cmp_incr): Use false instead of 0. + (fix_array_notation_expr): Likewise. + * c-decl.c (finish_decl): Likewise. + * c-parser.c (c_parser_postfix_expression_after_primary): Likewise. + * c-typeck.c (array_to_pointer_conversion): Use true instead of 1. + (function_to_pointer_conversion): Use false instead of 0. + (convert_lvalue_to_rvalue): Likewise. + (parser_build_unary_op): Likewise. + (build_atomic_assign): Likewise. + (build_unary_op): Change nonconvert parameter type to bool, use + true/false instead of 1/0. + (build_binary_op): Use true instead of 1. + 2016-09-13 David Malcolm <dmalcolm@redhat.com> * c-parser.c (c_parser_declaration_or_fndef): Update for renaming diff --git a/gcc/c/c-array-notation.c b/gcc/c/c-array-notation.c index c7cf66a..ce60911 100644 --- a/gcc/c/c-array-notation.c +++ b/gcc/c/c-array-notation.c @@ -104,7 +104,7 @@ create_cmp_incr (location_t loc, vec<an_loop_parts> *node, size_t rank, { tree var = (*node)[ii].var; tree length = an_info[0][ii].length; - (*node)[ii].incr = build_unary_op (loc, POSTINCREMENT_EXPR, var, 0); + (*node)[ii].incr = build_unary_op (loc, POSTINCREMENT_EXPR, var, false); (*node)[ii].cmp = build2 (LT_EXPR, boolean_type_node, var, length); } } @@ -1088,7 +1088,7 @@ fix_array_notation_expr (location_t location, enum tree_code code, arg = default_function_array_read_conversion (location, arg); if (code == POSTINCREMENT_EXPR || code == POSTDECREMENT_EXPR) - arg.value = build_unary_op (location, code, arg.value, 0); + arg.value = build_unary_op (location, code, arg.value, false); else if (code == PREINCREMENT_EXPR || code == PREDECREMENT_EXPR) arg = parser_build_unary_op (location, code, arg); diff --git a/gcc/c/c-decl.c b/gcc/c/c-decl.c index 8f49c35..d15b8f8 100644 --- a/gcc/c/c-decl.c +++ b/gcc/c/c-decl.c @@ -5102,7 +5102,7 @@ finish_decl (tree decl, location_t init_loc, tree init, vec<tree, va_gc> *v; /* Build "cleanup(&decl)" for the destructor. */ - cleanup = build_unary_op (input_location, ADDR_EXPR, decl, 0); + cleanup = build_unary_op (input_location, ADDR_EXPR, decl, false); vec_alloc (v, 1); v->quick_push (cleanup); cleanup = c_build_function_call_vec (DECL_SOURCE_LOCATION (decl), diff --git a/gcc/c/c-parser.c b/gcc/c/c-parser.c index e71c0d5..58424a9 100644 --- a/gcc/c/c-parser.c +++ b/gcc/c/c-parser.c @@ -8478,8 +8478,8 @@ c_parser_postfix_expression_after_primary (c_parser *parser, else { expr = default_function_array_read_conversion (expr_loc, expr); - expr.value = build_unary_op (op_loc, - POSTINCREMENT_EXPR, expr.value, 0); + expr.value = build_unary_op (op_loc, POSTINCREMENT_EXPR, + expr.value, false); } set_c_expr_source_range (&expr, start, finish); expr.original_code = ERROR_MARK; @@ -8497,8 +8497,8 @@ c_parser_postfix_expression_after_primary (c_parser *parser, else { expr = default_function_array_read_conversion (expr_loc, expr); - expr.value = build_unary_op (op_loc, - POSTDECREMENT_EXPR, expr.value, 0); + expr.value = build_unary_op (op_loc, POSTDECREMENT_EXPR, + expr.value, false); } set_c_expr_source_range (&expr, start, finish); expr.original_code = ERROR_MARK; diff --git a/gcc/c/c-typeck.c b/gcc/c/c-typeck.c index 8c7f8954..4dec397 100644 --- a/gcc/c/c-typeck.c +++ b/gcc/c/c-typeck.c @@ -1880,7 +1880,7 @@ array_to_pointer_conversion (location_t loc, tree exp) "is ill-formed in C++"); } - adr = build_unary_op (loc, ADDR_EXPR, exp, 1); + adr = build_unary_op (loc, ADDR_EXPR, exp, true); return convert (ptrtype, adr); } @@ -1897,7 +1897,7 @@ function_to_pointer_conversion (location_t loc, tree exp) if (TREE_NO_WARNING (orig_exp)) TREE_NO_WARNING (exp) = 1; - return build_unary_op (loc, ADDR_EXPR, exp, 0); + return build_unary_op (loc, ADDR_EXPR, exp, false); } /* Mark EXP as read, not just set, for set but not used -Wunused @@ -2042,7 +2042,7 @@ convert_lvalue_to_rvalue (location_t loc, struct c_expr exp, vec<tree, va_gc> *params; tree nonatomic_type, tmp, tmp_addr, fndecl, func_call; tree expr_type = TREE_TYPE (exp.value); - tree expr_addr = build_unary_op (loc, ADDR_EXPR, exp.value, 0); + tree expr_addr = build_unary_op (loc, ADDR_EXPR, exp.value, false); tree seq_cst = build_int_cst (integer_type_node, MEMMODEL_SEQ_CST); gcc_assert (TYPE_ATOMIC (expr_type)); @@ -2055,7 +2055,7 @@ convert_lvalue_to_rvalue (location_t loc, struct c_expr exp, create the VAL temp variable to hold the RHS. */ nonatomic_type = build_qualified_type (expr_type, TYPE_UNQUALIFIED); tmp = create_tmp_var_raw (nonatomic_type); - tmp_addr = build_unary_op (loc, ADDR_EXPR, tmp, 0); + tmp_addr = build_unary_op (loc, ADDR_EXPR, tmp, false); TREE_ADDRESSABLE (tmp) = 1; TREE_NO_WARNING (tmp) = 1; @@ -3575,7 +3575,7 @@ parser_build_unary_op (location_t loc, enum tree_code code, struct c_expr arg) } else { - result.value = build_unary_op (loc, code, arg.value, 0); + result.value = build_unary_op (loc, code, arg.value, false); if (TREE_OVERFLOW_P (result.value) && !TREE_OVERFLOW_P (arg.value)) overflow_warning (loc, result.value); @@ -3872,7 +3872,7 @@ build_atomic_assign (location_t loc, tree lhs, enum tree_code modifycode, tree loop_label, loop_decl, done_label, done_decl; tree lhs_type = TREE_TYPE (lhs); - tree lhs_addr = build_unary_op (loc, ADDR_EXPR, lhs, 0); + tree lhs_addr = build_unary_op (loc, ADDR_EXPR, lhs, false); tree seq_cst = build_int_cst (integer_type_node, MEMMODEL_SEQ_CST); tree rhs_type = TREE_TYPE (rhs); @@ -3909,7 +3909,7 @@ build_atomic_assign (location_t loc, tree lhs, enum tree_code modifycode, if (modifycode == NOP_EXPR) { /* Build __atomic_store (&lhs, &val, SEQ_CST) */ - rhs = build_unary_op (loc, ADDR_EXPR, val, 0); + rhs = build_unary_op (loc, ADDR_EXPR, val, false); fndecl = builtin_decl_explicit (BUILT_IN_ATOMIC_STORE); params->quick_push (lhs_addr); params->quick_push (rhs); @@ -4014,12 +4014,12 @@ build_atomic_assign (location_t loc, tree lhs, enum tree_code modifycode, cas_loop: /* Create the variables and labels required for the op= form. */ old = create_tmp_var_raw (nonatomic_lhs_type); - old_addr = build_unary_op (loc, ADDR_EXPR, old, 0); + old_addr = build_unary_op (loc, ADDR_EXPR, old, false); TREE_ADDRESSABLE (old) = 1; TREE_NO_WARNING (old) = 1; newval = create_tmp_var_raw (nonatomic_lhs_type); - newval_addr = build_unary_op (loc, ADDR_EXPR, newval, 0); + newval_addr = build_unary_op (loc, ADDR_EXPR, newval, false); TREE_ADDRESSABLE (newval) = 1; TREE_NO_WARNING (newval) = 1; @@ -4112,17 +4112,17 @@ cas_loop: /* Construct and perhaps optimize a tree representation for a unary operation. CODE, a tree_code, specifies the operation and XARG is the operand. - For any CODE other than ADDR_EXPR, NOCONVERT nonzero suppresses - the default promotions (such as from short to int). - For ADDR_EXPR, the default promotions are not applied; NOCONVERT nonzero - allows non-lvalues; this is only used to handle conversion of non-lvalue - arrays to pointers in C99. + For any CODE other than ADDR_EXPR, NOCONVERT suppresses the default + promotions (such as from short to int). + For ADDR_EXPR, the default promotions are not applied; NOCONVERT allows + non-lvalues; this is only used to handle conversion of non-lvalue arrays + to pointers in C99. LOCATION is the location of the operator. */ tree build_unary_op (location_t location, enum tree_code code, tree xarg, - int noconvert) + bool noconvert) { /* No default_conversion here. It causes trouble for ADDR_EXPR. */ tree arg = xarg; @@ -4324,9 +4324,11 @@ build_unary_op (location_t location, enum tree_code code, tree xarg, if (!atomic_op) { arg = stabilize_reference (arg); - real = build_unary_op (EXPR_LOCATION (arg), REALPART_EXPR, arg, 1); - imag = build_unary_op (EXPR_LOCATION (arg), IMAGPART_EXPR, arg, 1); - real = build_unary_op (EXPR_LOCATION (arg), code, real, 1); + real = build_unary_op (EXPR_LOCATION (arg), REALPART_EXPR, arg, + true); + imag = build_unary_op (EXPR_LOCATION (arg), IMAGPART_EXPR, arg, + true); + real = build_unary_op (EXPR_LOCATION (arg), code, real, true); if (real == error_mark_node || imag == error_mark_node) return error_mark_node; ret = build2 (COMPLEX_EXPR, TREE_TYPE (arg), @@ -11513,9 +11515,9 @@ build_binary_op (location_t location, enum tree_code code, { op0 = c_save_expr (op0); real = build_unary_op (EXPR_LOCATION (orig_op0), REALPART_EXPR, - op0, 1); + op0, true); imag = build_unary_op (EXPR_LOCATION (orig_op0), IMAGPART_EXPR, - op0, 1); + op0, true); switch (code) { case MULT_EXPR: @@ -11535,9 +11537,9 @@ build_binary_op (location_t location, enum tree_code code, { op1 = c_save_expr (op1); real = build_unary_op (EXPR_LOCATION (orig_op1), REALPART_EXPR, - op1, 1); + op1, true); imag = build_unary_op (EXPR_LOCATION (orig_op1), IMAGPART_EXPR, - op1, 1); + op1, true); switch (code) { case MULT_EXPR: |