summaryrefslogtreecommitdiffstats
path: root/gcc/c-convert.c
diff options
context:
space:
mode:
authorjsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4>2000-11-13 14:14:44 +0000
committerjsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4>2000-11-13 14:14:44 +0000
commit4f9a1c9b3be3ca4cb4139419f6f50a65557f229b (patch)
treef2b5f8cbfe56d1d0cc94e1b89e38e9cb318f7ece /gcc/c-convert.c
parentfd39c7061c1c4ee70db69aeab96aea97db747af0 (diff)
downloadppe42-gcc-4f9a1c9b3be3ca4cb4139419f6f50a65557f229b.tar.gz
ppe42-gcc-4f9a1c9b3be3ca4cb4139419f6f50a65557f229b.zip
* c-common.c (boolean_increment): New function.
* c-common.h (enum c_tree_index): Add CTI_C_BOOL_TYPE, CTI_C_BOOL_TRUE and CTI_C_BOOL_FALSE. (c_bool_type_node, c_bool_true_node, c_bool_false_node): Define. (boolean_increment): Declare. * c-convert.c (convert): Allow for BOOLEAN_TYPE. * c-decl.c (init_decl_processing): Create boolean nodes. (finish_struct): Allow for _Bool bitfields. * c-parse.in (reswords): Add _Bool. (rid_to_yy): Allow for RID_BOOL. * c-typeck.c (default_conversion): Make booleans promote to int. (convert_arguments, build_unary_op, build_modify_expr, convert_for_assignment): Allow for booleans. * ginclude/stdbool.h: Make conforming to C99. cp: * typeck.c (build_unary_op): Use boolean_increment from c-common.c, moving the relevant code there. testsuite: * gcc.dg/c99-bool-1.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@37428 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c-convert.c')
-rw-r--r--gcc/c-convert.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/gcc/c-convert.c b/gcc/c-convert.c
index 5d7ea00f82b..7f57725b7c1 100644
--- a/gcc/c-convert.c
+++ b/gcc/c-convert.c
@@ -88,6 +88,8 @@ convert (type, expr)
#endif
if (code == INTEGER_TYPE || code == ENUMERAL_TYPE)
return fold (convert_to_integer (type, e));
+ if (code == BOOLEAN_TYPE)
+ return fold (build1 (NOP_EXPR, type, truthvalue_conversion (expr)));
if (code == POINTER_TYPE || code == REFERENCE_TYPE)
return fold (convert_to_pointer (type, e));
if (code == REAL_TYPE)
OpenPOWER on IntegriCloud