aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorMarek Polacek <polacek@redhat.com>2016-09-14 15:05:00 +0000
committerMarek Polacek <mpolacek@gcc.gnu.org>2016-09-14 15:05:00 +0000
commite51fbec3ff5028d8aa7925f894444fd7920f13ae (patch)
tree9a8fc4f1bf815bc44e908dbd081d93aca40edd84 /gcc/cp
parent13cddbc115038975a531abe3a0aed739307258db (diff)
downloadgcc-e51fbec3ff5028d8aa7925f894444fd7920f13ae.zip
gcc-e51fbec3ff5028d8aa7925f894444fd7920f13ae.tar.gz
gcc-e51fbec3ff5028d8aa7925f894444fd7920f13ae.tar.bz2
c-common.c (c_common_truthvalue_conversion): Use false instead of 0.
* c-common.c (c_common_truthvalue_conversion): Use false instead of 0. * c-common.h (build_unary_op): Change nonconvert 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 nonconvert 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 nonconvert 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 nonconvert parameter type to bool. Use true instead of 1. (build_unary_op): Change nonconvert parameter type to bool. (unary_complex_lvalue): Use false instead of 0. From-SVN: r240137
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog16
-rw-r--r--gcc/cp/cp-tree.h2
-rw-r--r--gcc/cp/decl2.c4
-rw-r--r--gcc/cp/init.c11
-rw-r--r--gcc/cp/pt.c2
-rw-r--r--gcc/cp/semantics.c2
-rw-r--r--gcc/cp/typeck.c33
7 files changed, 43 insertions, 27 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 97e9cda..df4655e 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,19 @@
+2016-09-14 Marek Polacek <polacek@redhat.com>
+
+ * cp-tree.h (cp_build_unary_op): Change nonconvert 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 nonconvert parameter type to bool. Use true
+ instead of 1.
+ (build_unary_op): Change nonconvert parameter type to bool.
+ (unary_complex_lvalue): Use false instead of 0.
+
2016-09-13 Jakub Jelinek <jakub@redhat.com>
Implement P0028R4, C++17 using attribute namespaces without repetition
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index d4bfb26..f403340 100644
--- a/gcc/cp/cp-tree.h
+++ b/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 a/gcc/cp/decl2.c b/gcc/cp/decl2.c
index a320f92..4bdac94a 100644
--- a/gcc/cp/decl2.c
+++ b/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 a/gcc/cp/init.c b/gcc/cp/init.c
index 5bb7f29..e869542 100644
--- a/gcc/cp/init.c
+++ b/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 a/gcc/cp/pt.c b/gcc/cp/pt.c
index b0f0664..29d8beb 100644
--- a/gcc/cp/pt.c
+++ b/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 a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index 9ab8439..e415732 100644
--- a/gcc/cp/semantics.c
+++ b/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 a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index a591d29..c51d6d0 100644
--- a/gcc/cp/typeck.c
+++ b/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);