aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Merrill <jason@phydeaux.cygnus.com>1995-01-21 10:14:41 +0000
committerJason Merrill <merrill@gnu.org>1995-01-21 10:14:41 +0000
commit255512c1d394f11d902c54f0258d0a4b81023bb4 (patch)
tree94a33dc6617ca2a2beb65949e2cc4a3222715188
parent2aec5b7a12f06b0ec4c5b7969ad5eb02c19ce3ff (diff)
downloadgcc-255512c1d394f11d902c54f0258d0a4b81023bb4.zip
gcc-255512c1d394f11d902c54f0258d0a4b81023bb4.tar.gz
gcc-255512c1d394f11d902c54f0258d0a4b81023bb4.tar.bz2
bool changes
From-SVN: r8788
-rw-r--r--gcc/cp/ChangeLog16
-rw-r--r--gcc/cp/decl.c20
-rw-r--r--gcc/cp/parse.y10
-rw-r--r--gcc/cp/typeck.c14
4 files changed, 40 insertions, 20 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 5fa2f83..7574f80 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,19 @@
+Tue Jan 17 14:12:00 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * cvt.c (cp_convert): Just call truthvalue_conversion to convert to
+ bool.
+
+Mon Jan 16 13:28:48 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * various: Use boolean_type_node, boolean_true_node,
+ boolean_false_node.
+
+Sun Jan 15 22:17:32 1995 Jason Merrill <jason@phydeaux.cygnus.com>
+
+ * decl.c (BOOL_TYPE_SIZE): Defaults to BITS_PER_WORD.
+ (init_decl_processing): Use BOOL_TYPE_SIZE instead of CHAR_TYPE_SIZE
+ for bool.
+
Fri Dec 30 12:22:29 1994 Mike Stump <mrs@cygnus.com>
* decl.c (n_incomplete): Bump n_incomplete up to int to match C
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index f573994..8a6c6ea 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -93,6 +93,10 @@ static struct stack_level *decl_stack;
#define LONG_DOUBLE_TYPE_SIZE (BITS_PER_WORD * 2)
#endif
+#ifndef BOOL_TYPE_SIZE
+#define BOOL_TYPE_SIZE BITS_PER_WORD
+#endif
+
/* We let tm.h override the types used here, to handle trivial differences
such as the choice of unsigned int or long unsigned int for size_t.
When machines start needing nontrivial differences in the size type,
@@ -207,7 +211,7 @@ tree int_array_type_node;
tree wchar_array_type_node;
/* The bool data type, and constants */
-tree bool_type_node, true_node, false_node;
+tree boolean_type_node, boolean_true_node, boolean_false_node;
/* type `int ()' -- used for implicit declaration of functions. */
@@ -4378,13 +4382,13 @@ init_decl_processing ()
integer_three_node = build_int_2 (3, 0);
TREE_TYPE (integer_three_node) = integer_type_node;
- bool_type_node = make_unsigned_type (CHAR_TYPE_SIZE);
- TREE_SET_CODE (bool_type_node, BOOLEAN_TYPE);
- record_builtin_type (RID_BOOL, "bool", bool_type_node);
- false_node = build_int_2 (0, 0);
- TREE_TYPE (false_node) = bool_type_node;
- true_node = build_int_2 (1, 0);
- TREE_TYPE (true_node) = bool_type_node;
+ boolean_type_node = make_unsigned_type (BOOL_TYPE_SIZE);
+ TREE_SET_CODE (boolean_type_node, BOOLEAN_TYPE);
+ record_builtin_type (RID_BOOL, "bool", boolean_type_node);
+ boolean_false_node = build_int_2 (0, 0);
+ TREE_TYPE (boolean_false_node) = boolean_type_node;
+ boolean_true_node = build_int_2 (1, 0);
+ TREE_TYPE (boolean_true_node) = boolean_type_node;
/* These are needed by stor-layout.c. */
size_zero_node = size_int (0);
diff --git a/gcc/cp/parse.y b/gcc/cp/parse.y
index 49dc832..345e31b 100644
--- a/gcc/cp/parse.y
+++ b/gcc/cp/parse.y
@@ -937,7 +937,7 @@ paren_expr_or_null:
cond_stmt_keyword);
$$ = integer_zero_node; }
| '(' expr ')'
- { $$ = build1 (CLEANUP_POINT_EXPR, bool_type_node,
+ { $$ = build1 (CLEANUP_POINT_EXPR, boolean_type_node,
bool_truthvalue_conversion ($2)); }
;
@@ -947,7 +947,7 @@ paren_cond_or_null:
cond_stmt_keyword);
$$ = integer_zero_node; }
| '(' condition ')'
- { $$ = build1 (CLEANUP_POINT_EXPR, bool_type_node,
+ { $$ = build1 (CLEANUP_POINT_EXPR, boolean_type_node,
bool_truthvalue_conversion ($2)); }
;
@@ -955,7 +955,7 @@ xcond:
/* empty */
{ $$ = NULL_TREE; }
| condition
- { $$ = build1 (CLEANUP_POINT_EXPR, bool_type_node,
+ { $$ = build1 (CLEANUP_POINT_EXPR, boolean_type_node,
bool_truthvalue_conversion ($$)); }
| error
{ $$ = NULL_TREE; }
@@ -1664,9 +1664,9 @@ delete: DELETE
boolean.literal:
CXX_TRUE
- { $$ = true_node; }
+ { $$ = boolean_true_node; }
| CXX_FALSE
- { $$ = false_node; }
+ { $$ = boolean_false_node; }
;
/* Produces a STRING_CST with perhaps more STRING_CSTs chained onto it. */
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index ae9f193..60cb4f4 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -2740,7 +2740,7 @@ build_binary_op (code, arg1, arg2, convert_p)
types[0] = type1; types[1] = type2;
if (code == TRUTH_ANDIF_EXPR || code == TRUTH_ORIF_EXPR)
- try = build_type_conversion (code, bool_type_node,
+ try = build_type_conversion (code, boolean_type_node,
args[convert_index], 1);
else
{
@@ -2975,7 +2975,7 @@ build_binary_op_nodefault (code, orig_op0, orig_op1, error_code)
case TRUTH_ORIF_EXPR:
case TRUTH_AND_EXPR:
case TRUTH_OR_EXPR:
- result_type = bool_type_node;
+ result_type = boolean_type_node;
op0 = bool_truthvalue_conversion (op0);
op1 = bool_truthvalue_conversion (op1);
converted = 1;
@@ -3059,7 +3059,7 @@ build_binary_op_nodefault (code, orig_op0, orig_op1, error_code)
case EQ_EXPR:
case NE_EXPR:
- result_type = bool_type_node;
+ result_type = boolean_type_node;
converted = 1;
if ((code0 == INTEGER_TYPE || code0 == REAL_TYPE)
&& (code1 == INTEGER_TYPE || code1 == REAL_TYPE))
@@ -3251,7 +3251,7 @@ build_binary_op_nodefault (code, orig_op0, orig_op1, error_code)
case GE_EXPR:
case LT_EXPR:
case GT_EXPR:
- result_type = bool_type_node;
+ result_type = boolean_type_node;
if ((code0 == INTEGER_TYPE || code0 == REAL_TYPE)
&& (code1 == INTEGER_TYPE || code1 == REAL_TYPE))
short_compare = 1;
@@ -3437,8 +3437,8 @@ build_binary_op_nodefault (code, orig_op0, orig_op1, error_code)
tree val
= shorten_compare (&xop0, &xop1, &xresult_type, &xresultcode);
if (val != 0)
- return convert (bool_type_node, val);
- op0 = xop0, op1 = xop1, result_type = bool_type_node;
+ return convert (boolean_type_node, val);
+ op0 = xop0, op1 = xop1, result_type = boolean_type_node;
resultcode = xresultcode;
}
@@ -3776,7 +3776,7 @@ bool_truthvalue_conversion (expr)
/* We really want to preform the optimizations in truthvalue_conversion
but, not this way. */
/* expr = truthvalue_conversion (expr); */
- return convert (bool_type_node, expr);
+ return convert (boolean_type_node, expr);
}
/* C++: Must handle pointers to members.