diff options
author | Jason Merrill <jason@redhat.com> | 2003-07-24 16:48:13 -0400 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2003-07-24 16:48:13 -0400 |
commit | de7df9ebdc66ea3a978327f5a039d939a9523a72 (patch) | |
tree | d426fb98d29071f56b15614831aba8bebbb69f6c /gcc/c-decl.c | |
parent | 6907ddd3babc97c39c88ef55b7d8da4f5d439d56 (diff) | |
download | gcc-de7df9ebdc66ea3a978327f5a039d939a9523a72.zip gcc-de7df9ebdc66ea3a978327f5a039d939a9523a72.tar.gz gcc-de7df9ebdc66ea3a978327f5a039d939a9523a72.tar.bz2 |
tree.h (boolean_type_node): Move from C/C++/Java frontends.
* tree.h (boolean_type_node): Move from C/C++/Java frontends.
(boolean_true_node, boolean_false_node): Likewise.
(enum tree_index): Add TI_BOOLEAN_{TYPE,FALSE,TRUE}.
* tree.c (build_common_tree_nodes): Init boolean_type_node.
(build_common_tree_nodes_2): Init boolean_{true,false}_node.
* stor-layout.c (set_sizetype): Handle an early BOOLEAN_TYPE.
* c-common.h (truthvalue_type_node): Renamed from boolean_type_node.
(truthvalue_true_node): Renamed from boolean_true_node.
(truthvalue_false_node): Renamed from boolean_false_node.
* c-decl.c: Just set truthvalue_* to integer_*.
* c-*.[ch]: s/boolean/truthvalue/. s/c_bool/boolean/.
* cp/decl.c: Just set truthvalue_* to boolean_*.
* java/java-tree.h: Move boolean_type_node et al to the back end.
From-SVN: r69758
Diffstat (limited to 'gcc/c-decl.c')
-rw-r--r-- | gcc/c-decl.c | 25 |
1 files changed, 9 insertions, 16 deletions
diff --git a/gcc/c-decl.c b/gcc/c-decl.c index 9f84f44..5506ac8 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -2295,21 +2295,14 @@ c_init_decl_processing (void) c_common_nodes_and_builtins (); - boolean_type_node = integer_type_node; - boolean_true_node = integer_one_node; - boolean_false_node = integer_zero_node; - - c_bool_type_node = make_unsigned_type (BOOL_TYPE_SIZE); - TREE_SET_CODE (c_bool_type_node, BOOLEAN_TYPE); - TYPE_MAX_VALUE (c_bool_type_node) = build_int_2 (1, 0); - TREE_TYPE (TYPE_MAX_VALUE (c_bool_type_node)) = c_bool_type_node; - TYPE_PRECISION (c_bool_type_node) = 1; + /* In C, comparisons and TRUTH_* expressions have type int. */ + truthvalue_type_node = integer_type_node; + truthvalue_true_node = integer_one_node; + truthvalue_false_node = integer_zero_node; + + /* Even in C99, which has a real boolean type. */ pushdecl (build_decl (TYPE_DECL, get_identifier ("_Bool"), - c_bool_type_node)); - c_bool_false_node = build_int_2 (0, 0); - TREE_TYPE (c_bool_false_node) = c_bool_type_node; - c_bool_true_node = build_int_2 (1, 0); - TREE_TYPE (c_bool_true_node) = c_bool_type_node; + boolean_type_node)); endlink = void_list_node; ptr_ftype_void = build_function_type (ptr_type_node, endlink); @@ -5033,7 +5026,7 @@ finish_struct (tree t, tree fieldlist, tree attributes) if (DECL_INITIAL (x) && pedantic && TYPE_MAIN_VARIANT (TREE_TYPE (x)) != integer_type_node && TYPE_MAIN_VARIANT (TREE_TYPE (x)) != unsigned_type_node - && TYPE_MAIN_VARIANT (TREE_TYPE (x)) != c_bool_type_node + && TYPE_MAIN_VARIANT (TREE_TYPE (x)) != boolean_type_node /* Accept an enum that's equivalent to int or unsigned int. */ && !(TREE_CODE (TREE_TYPE (x)) == ENUMERAL_TYPE && (TYPE_PRECISION (TREE_TYPE (x)) @@ -5046,7 +5039,7 @@ finish_struct (tree t, tree fieldlist, tree attributes) if (DECL_INITIAL (x)) { int max_width - = (TYPE_MAIN_VARIANT (TREE_TYPE (x)) == c_bool_type_node + = (TYPE_MAIN_VARIANT (TREE_TYPE (x)) == boolean_type_node ? CHAR_TYPE_SIZE : TYPE_PRECISION (TREE_TYPE (x))); if (tree_int_cst_sgn (DECL_INITIAL (x)) < 0) |