diff mbox

C/C++ PATCH to change {cp,}build_unary_op's parameter

Message ID 20160914132212.GQ19950@redhat.com
State New
Headers show

Commit Message

Marek Polacek Sept. 14, 2016, 1:22 p.m. UTC
I promised I'd do the int -> bool conversion for build_unary_op (and so
even for cp_build_unary_op), so here it is.

Bootstrapped/regtested on x86_64-linux and ppc64-linux, ok for trunk?

2016-09-14  Marek Polacek  <polacek@redhat.com>

	* c-common.c (c_common_truthvalue_conversion): Use false instead of 0.
	* c-common.h (build_unary_op): Change a parameter type to bool.
	* c-omp.c (c_finish_omp_atomic): Use false instead of 0.

	* 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 a parameter type to bool, use true/false
	instead of 1/0.
	(build_binary_op): Use true instead of 1.

	* cp-tree.h (cp_build_unary_op): Change a parameter type to bool.
	* decl2.c (one_static_initialization_or_destruction): Use true instead
	of 1.
	* init.c (build_vec_init): Use false instead of 0.
	* pt.c (tsubst_copy_and_build): Likewise.
	* semantics.c (simplify_loop_decl_cond): Likewise.
	* typeck.c (rationalize_conditional_expr): Likewise.
	(cp_build_binary_op): Use true instead of 1.
	(cp_build_unary_op): Change a parameter type to bool.  Use true instead
	of 1.
	(build_unary_op): Change a parameter type to bool.
	(unary_complex_lvalue): Use false instead of 0.


	Marek

Comments

Jason Merrill Sept. 14, 2016, 2:58 p.m. UTC | #1
On Wed, Sep 14, 2016 at 9:22 AM, Marek Polacek <polacek@redhat.com> wrote:
>         * c-common.h (build_unary_op): Change a parameter type to bool.
>         (build_unary_op): Change a parameter type to bool, use true/false
>         (cp_build_unary_op): Change a parameter type to bool.  Use true instead
>         (build_unary_op): Change a parameter type to bool.

It would be more useful if these said "noconvert parameter" rather
than "a parameter".  OK with that change.

Jason
Marek Polacek Sept. 14, 2016, 3:05 p.m. UTC | #2
On Wed, Sep 14, 2016 at 10:58:39AM -0400, Jason Merrill wrote:
> On Wed, Sep 14, 2016 at 9:22 AM, Marek Polacek <polacek@redhat.com> wrote:
> >         * c-common.h (build_unary_op): Change a parameter type to bool.
> >         (build_unary_op): Change a parameter type to bool, use true/false
> >         (cp_build_unary_op): Change a parameter type to bool.  Use true instead
> >         (build_unary_op): Change a parameter type to bool.
> 
> It would be more useful if these said "noconvert parameter" rather
> than "a parameter".  OK with that change.

Committed with that fixed, thanks.

	Marek
diff mbox

Patch

diff --git gcc/c-family/c-common.c gcc/c-family/c-common.c
index 1132a03..b561f9f 100644
--- gcc/c-family/c-common.c
+++ gcc/c-family/c-common.c
@@ -4599,7 +4599,7 @@  c_common_truthvalue_conversion (location_t location, tree expr)
 	     : truthvalue_false_node;
 
     case FUNCTION_DECL:
-      expr = build_unary_op (location, ADDR_EXPR, expr, 0);
+      expr = build_unary_op (location, ADDR_EXPR, expr, false);
       /* Fall through.  */
 
     case ADDR_EXPR:
@@ -4739,10 +4739,10 @@  c_common_truthvalue_conversion (location_t location, tree expr)
 		? TRUTH_OR_EXPR : TRUTH_ORIF_EXPR),
 	c_common_truthvalue_conversion
 	       (location,
-		build_unary_op (location, REALPART_EXPR, t, 0)),
+		build_unary_op (location, REALPART_EXPR, t, false)),
 	c_common_truthvalue_conversion
 	       (location,
-		build_unary_op (location, IMAGPART_EXPR, t, 0)),
+		build_unary_op (location, IMAGPART_EXPR, t, false)),
 	       0));
       goto ret;
     }
diff --git gcc/c-family/c-common.h gcc/c-family/c-common.h
index 2e211c4..5bbf951 100644
--- gcc/c-family/c-common.h
+++ gcc/c-family/c-common.h
@@ -964,7 +964,7 @@  extern tree build_real_imag_expr (location_t, enum tree_code, tree);
 /* These functions must be defined by each front-end which implements
    a variant of the C language.  They are used in c-common.c.  */
 
-extern tree build_unary_op (location_t, enum tree_code, tree, int);
+extern tree build_unary_op (location_t, enum tree_code, tree, bool);
 extern tree build_binary_op (location_t, enum tree_code, tree, tree, int);
 extern tree perform_integral_promotions (tree);
 
diff --git gcc/c-family/c-omp.c gcc/c-family/c-omp.c
index 3b131ed..5ccb62e 100644
--- gcc/c-family/c-omp.c
+++ gcc/c-family/c-omp.c
@@ -212,7 +212,7 @@  c_finish_omp_atomic (location_t loc, enum tree_code code,
 
   /* Take and save the address of the lhs.  From then on we'll reference it
      via indirection.  */
-  addr = build_unary_op (loc, ADDR_EXPR, lhs, 0);
+  addr = build_unary_op (loc, ADDR_EXPR, lhs, false);
   if (addr == error_mark_node)
     return error_mark_node;
   if (!test)
@@ -303,14 +303,14 @@  c_finish_omp_atomic (location_t loc, enum tree_code code,
 			     loc, x, NULL_TREE);
       if (rhs1 && rhs1 != lhs)
 	{
-	  tree rhs1addr = build_unary_op (loc, ADDR_EXPR, rhs1, 0);
+	  tree rhs1addr = build_unary_op (loc, ADDR_EXPR, rhs1, false);
 	  if (rhs1addr == error_mark_node)
 	    return error_mark_node;
 	  x = omit_one_operand_loc (loc, type, x, rhs1addr);
 	}
       if (lhs1 && lhs1 != lhs)
 	{
-	  tree lhs1addr = build_unary_op (loc, ADDR_EXPR, lhs1, 0);
+	  tree lhs1addr = build_unary_op (loc, ADDR_EXPR, lhs1, false);
 	  if (lhs1addr == error_mark_node)
 	    return error_mark_node;
 	  if (code == OMP_ATOMIC_CAPTURE_OLD)
@@ -325,7 +325,7 @@  c_finish_omp_atomic (location_t loc, enum tree_code code,
     }
   else if (rhs1 && rhs1 != lhs)
     {
-      tree rhs1addr = build_unary_op (loc, ADDR_EXPR, rhs1, 0);
+      tree rhs1addr = build_unary_op (loc, ADDR_EXPR, rhs1, false);
       if (rhs1addr == error_mark_node)
 	return error_mark_node;
       x = omit_one_operand_loc (loc, type, x, rhs1addr);
diff --git gcc/c/c-array-notation.c gcc/c/c-array-notation.c
index c7cf66a..ce60911 100644
--- gcc/c/c-array-notation.c
+++ 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 gcc/c/c-decl.c gcc/c/c-decl.c
index 8f49c35..d15b8f8 100644
--- gcc/c/c-decl.c
+++ 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 gcc/c/c-parser.c gcc/c/c-parser.c
index e71c0d5..58424a9 100644
--- gcc/c/c-parser.c
+++ 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 gcc/c/c-typeck.c gcc/c/c-typeck.c
index 8c7f895..4dec397 100644
--- gcc/c/c-typeck.c
+++ 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:
diff --git gcc/cp/cp-tree.h gcc/cp/cp-tree.h
index d4bfb26..f403340 100644
--- gcc/cp/cp-tree.h
+++ gcc/cp/cp-tree.h
@@ -6673,7 +6673,7 @@  extern tree build_x_unary_op			(location_t,
 						 enum tree_code, cp_expr,
                                                  tsubst_flags_t);
 extern tree cp_build_addr_expr			(tree, tsubst_flags_t);
-extern tree cp_build_unary_op                   (enum tree_code, tree, int, 
+extern tree cp_build_unary_op                   (enum tree_code, tree, bool,
                                                  tsubst_flags_t);
 extern tree unary_complex_lvalue		(enum tree_code, tree);
 extern tree build_x_conditional_expr		(location_t, tree, tree, tree, 
diff --git gcc/cp/decl2.c gcc/cp/decl2.c
index a320f92..4bdac94a 100644
--- gcc/cp/decl2.c
+++ gcc/cp/decl2.c
@@ -3775,7 +3775,7 @@  one_static_initialization_or_destruction (tree decl, tree init, bool initp)
 				EQ_EXPR,
 				cp_build_unary_op (PREINCREMENT_EXPR,
 						   guard,
-						   /*noconvert=*/1,
+						   /*noconvert=*/true,
 						   tf_warning_or_error),
 				integer_one_node,
 				tf_warning_or_error);
@@ -3785,7 +3785,7 @@  one_static_initialization_or_destruction (tree decl, tree init, bool initp)
 				EQ_EXPR,
 				cp_build_unary_op (PREDECREMENT_EXPR,
 						   guard,
-						   /*noconvert=*/1,
+						   /*noconvert=*/true,
 						   tf_warning_or_error),
 				integer_zero_node,
 				tf_warning_or_error);
diff --git gcc/cp/init.c gcc/cp/init.c
index 5bb7f29..e869542 100644
--- gcc/cp/init.c
+++ gcc/cp/init.c
@@ -4096,13 +4096,14 @@  build_vec_init (tree base, tree maxindex, tree init,
 	    finish_expr_stmt (one_init);
 	  current_stmt_tree ()->stmts_are_full_exprs_p = 0;
 
-	  one_init = cp_build_unary_op (PREINCREMENT_EXPR, base, 0, complain);
+	  one_init = cp_build_unary_op (PREINCREMENT_EXPR, base, false,
+					complain);
 	  if (one_init == error_mark_node)
 	    errors = true;
 	  else
 	    finish_expr_stmt (one_init);
 
-	  one_init = cp_build_unary_op (PREDECREMENT_EXPR, iterator, 0,
+	  one_init = cp_build_unary_op (PREDECREMENT_EXPR, iterator, false,
 					complain);
 	  if (one_init == error_mark_node)
 	    errors = true;
@@ -4155,7 +4156,7 @@  build_vec_init (tree base, tree maxindex, tree init,
       finish_for_cond (build2 (GT_EXPR, boolean_type_node, iterator,
 			       build_int_cst (TREE_TYPE (iterator), -1)),
 		       for_stmt, false);
-      elt_init = cp_build_unary_op (PREDECREMENT_EXPR, iterator, 0,
+      elt_init = cp_build_unary_op (PREDECREMENT_EXPR, iterator, false,
 				    complain);
       if (elt_init == error_mark_node)
 	errors = true;
@@ -4272,10 +4273,10 @@  build_vec_init (tree base, tree maxindex, tree init,
 	finish_expr_stmt (elt_init);
       current_stmt_tree ()->stmts_are_full_exprs_p = 0;
 
-      finish_expr_stmt (cp_build_unary_op (PREINCREMENT_EXPR, base, 0,
+      finish_expr_stmt (cp_build_unary_op (PREINCREMENT_EXPR, base, false,
                                            complain));
       if (base2)
-	finish_expr_stmt (cp_build_unary_op (PREINCREMENT_EXPR, base2, 0,
+	finish_expr_stmt (cp_build_unary_op (PREINCREMENT_EXPR, base2, false,
                                              complain));
 
       finish_for_stmt (for_stmt);
diff --git gcc/cp/pt.c gcc/cp/pt.c
index b0f0664..29d8beb 100644
--- gcc/cp/pt.c
+++ gcc/cp/pt.c
@@ -16257,7 +16257,7 @@  tsubst_copy_and_build (tree t,
 
     case FIX_TRUNC_EXPR:
       RETURN (cp_build_unary_op (FIX_TRUNC_EXPR, RECUR (TREE_OPERAND (t, 0)),
-				 0, complain));
+				 false, complain));
 
     case ADDR_EXPR:
       op1 = TREE_OPERAND (t, 0);
diff --git gcc/cp/semantics.c gcc/cp/semantics.c
index 9ab8439..e415732 100644
--- gcc/cp/semantics.c
+++ gcc/cp/semantics.c
@@ -588,7 +588,7 @@  simplify_loop_decl_cond (tree *cond_p, tree body)
   *cond_p = boolean_true_node;
 
   if_stmt = begin_if_stmt ();
-  cond = cp_build_unary_op (TRUTH_NOT_EXPR, cond, 0, tf_warning_or_error);
+  cond = cp_build_unary_op (TRUTH_NOT_EXPR, cond, false, tf_warning_or_error);
   finish_if_stmt_cond (cond, if_stmt);
   finish_break_stmt ();
   finish_then_clause (if_stmt);
diff --git gcc/cp/typeck.c gcc/cp/typeck.c
index a591d29..c51d6d0 100644
--- gcc/cp/typeck.c
+++ gcc/cp/typeck.c
@@ -2208,16 +2208,16 @@  rationalize_conditional_expr (enum tree_code code, tree t,
 						   op1, TREE_CODE (op1),
 						   /*overload=*/NULL,
 						   complain),
-                                cp_build_unary_op (code, op0, 0, complain),
-                                cp_build_unary_op (code, op1, 0, complain),
+                                cp_build_unary_op (code, op0, false, complain),
+                                cp_build_unary_op (code, op1, false, complain),
                                 complain);
     }
 
   return
     build_conditional_expr (loc, TREE_OPERAND (t, 0),
-			    cp_build_unary_op (code, TREE_OPERAND (t, 1), 0,
+			    cp_build_unary_op (code, TREE_OPERAND (t, 1), false,
                                                complain),
-			    cp_build_unary_op (code, TREE_OPERAND (t, 2), 0,
+			    cp_build_unary_op (code, TREE_OPERAND (t, 2), false,
                                                complain),
                             complain);
 }
@@ -5036,8 +5036,8 @@  cp_build_binary_op (location_t location,
 	  if (first_complex)
 	    {
 	      op0 = save_expr (op0);
-	      real = cp_build_unary_op (REALPART_EXPR, op0, 1, complain);
-	      imag = cp_build_unary_op (IMAGPART_EXPR, op0, 1, complain);
+	      real = cp_build_unary_op (REALPART_EXPR, op0, true, complain);
+	      imag = cp_build_unary_op (IMAGPART_EXPR, op0, true, complain);
 	      switch (code)
 		{
 		case MULT_EXPR:
@@ -5056,8 +5056,8 @@  cp_build_binary_op (location_t location,
 	  else
 	    {
 	      op1 = save_expr (op1);
-	      real = cp_build_unary_op (REALPART_EXPR, op1, 1, complain);
-	      imag = cp_build_unary_op (IMAGPART_EXPR, op1, 1, complain);
+	      real = cp_build_unary_op (REALPART_EXPR, op1, true, complain);
+	      imag = cp_build_unary_op (IMAGPART_EXPR, op1, true, complain);
 	      switch (code)
 		{
 		case MULT_EXPR:
@@ -5784,11 +5784,10 @@  cp_build_addr_expr_strict (tree arg, tsubst_flags_t complain)
    from aggregates to types we don't yet know we want?  (Or are those
    cases typically errors which should be reported?)
 
-   NOCONVERT nonzero suppresses the default promotions
-   (such as from short to int).  */
+   NOCONVERT suppresses the default promotions (such as from short to int).  */
 
 tree
-cp_build_unary_op (enum tree_code code, tree xarg, int noconvert, 
+cp_build_unary_op (enum tree_code code, tree xarg, bool noconvert,
                    tsubst_flags_t complain)
 {
   /* No default_conversion here.  It causes trouble for ADDR_EXPR.  */
@@ -5920,9 +5919,9 @@  cp_build_unary_op (enum tree_code code, tree xarg, int noconvert,
 	  tree real, imag;
 
 	  arg = cp_stabilize_reference (arg);
-	  real = cp_build_unary_op (REALPART_EXPR, arg, 1, complain);
-	  imag = cp_build_unary_op (IMAGPART_EXPR, arg, 1, complain);
-	  real = cp_build_unary_op (code, real, 1, complain);
+	  real = cp_build_unary_op (REALPART_EXPR, arg, true, complain);
+	  imag = cp_build_unary_op (IMAGPART_EXPR, arg, true, complain);
+	  real = cp_build_unary_op (code, real, true, complain);
 	  if (real == error_mark_node || imag == error_mark_node)
 	    return error_mark_node;
 	  return build2 (COMPLEX_EXPR, TREE_TYPE (arg),
@@ -6076,7 +6075,7 @@  cp_build_unary_op (enum tree_code code, tree xarg, int noconvert,
 /* Hook for the c-common bits that build a unary op.  */
 tree
 build_unary_op (location_t /*location*/,
-		enum tree_code code, tree xarg, int noconvert)
+		enum tree_code code, tree xarg, bool noconvert)
 {
   return cp_build_unary_op (code, xarg, noconvert, tf_warning_or_error);
 }
@@ -6100,7 +6099,7 @@  unary_complex_lvalue (enum tree_code code, tree arg)
   /* Handle (a, b) used as an "lvalue".  */
   if (TREE_CODE (arg) == COMPOUND_EXPR)
     {
-      tree real_result = cp_build_unary_op (code, TREE_OPERAND (arg, 1), 0,
+      tree real_result = cp_build_unary_op (code, TREE_OPERAND (arg, 1), false,
                                             tf_warning_or_error);
       return build2 (COMPOUND_EXPR, TREE_TYPE (real_result),
 		     TREE_OPERAND (arg, 0), real_result);
@@ -6134,7 +6133,7 @@  unary_complex_lvalue (enum tree_code code, tree arg)
   if (TREE_CODE (arg) == MODIFY_EXPR
       || TREE_CODE (arg) == INIT_EXPR)
     {
-      tree real_result = cp_build_unary_op (code, TREE_OPERAND (arg, 0), 0,
+      tree real_result = cp_build_unary_op (code, TREE_OPERAND (arg, 0), false,
                                             tf_warning_or_error);
       arg = build2 (COMPOUND_EXPR, TREE_TYPE (real_result),
 		    arg, real_result);