From: Joseph Myers Date: Thu, 4 Jan 2001 23:53:54 +0000 (+0000) Subject: c-common.c (SIZE_TYPE, WCHAR_TYPE): Define. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=eaa7c03f500d8d7b5d88c2b02d11513cc489226e;p=gcc.git c-common.c (SIZE_TYPE, WCHAR_TYPE): Define. * c-common.c (SIZE_TYPE, WCHAR_TYPE): Define. (flag_short_double, flag_short_wchar): Define. (c_common_nodes_and_builtins): Create many tree nodes shared between C and C++ here instead of in cp/decl.c and ... * c-decl.c (init_decl_processing): ... here. (SIZE_TYPE, WCHAR_TYPE): Don't define. (flag_short_double, flag_short_wchar): Don't define. (record_builtin_type): New function. (build_void_list_node): New function. * c-common.h (flag_short_double, flag_short_wchar, record_builtin_type, build_void_list_node): Declare. cp: * decl.c (SIZE_TYPE, PTRDIFF_TYPE, WCHAR_TYPE): Don't define. (record_builtin_type): Make non-static. (flag_short_double): Don't declare. (init_decl_processing): Remove the creation of many tree nodes now in c_common_nodes_and_builtins. (build_void_list_node): New function. * decl2.c (flag_short_double, flag_short_wchar): Don't define. * cp-tree.h (flag_short_wchar): Don't declare. From-SVN: r38695 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ac4f2e507a8..0bf3db3e750 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,17 @@ +2001-01-04 Joseph S. Myers + + * c-common.c (SIZE_TYPE, WCHAR_TYPE): Define. + (flag_short_double, flag_short_wchar): Define. + (c_common_nodes_and_builtins): Create many tree nodes shared + between C and C++ here instead of in cp/decl.c and ... + * c-decl.c (init_decl_processing): ... here. + (SIZE_TYPE, WCHAR_TYPE): Don't define. + (flag_short_double, flag_short_wchar): Don't define. + (record_builtin_type): New function. + (build_void_list_node): New function. + * c-common.h (flag_short_double, flag_short_wchar, + record_builtin_type, build_void_list_node): Declare. + Thu Jan 4 21:09:47 2001 J"orn Rennecke * integrate.c (expand_inline_function): Don't put a virtual diff --git a/gcc/c-common.c b/gcc/c-common.c index 71234b75bcb..577aa20c776 100644 --- a/gcc/c-common.c +++ b/gcc/c-common.c @@ -41,6 +41,20 @@ cpp_reader *parse_in; /* Declared in c-lex.h. */ #undef WCHAR_TYPE_SIZE #define WCHAR_TYPE_SIZE TYPE_PRECISION (wchar_type_node) +/* 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, + it would be best to do something here to figure out automatically + from other information what type to use. */ + +#ifndef SIZE_TYPE +#define SIZE_TYPE "long unsigned int" +#endif + +#ifndef WCHAR_TYPE +#define WCHAR_TYPE "int" +#endif + #ifndef PTRDIFF_TYPE #define PTRDIFF_TYPE "long int" #endif @@ -172,6 +186,14 @@ int flag_no_builtin; int flag_no_nonansi_builtin; +/* Nonzero means give `double' the same size as `float'. */ + +int flag_short_double; + +/* Nonzero means give `wchar_t' the same size as `short'. */ + +int flag_short_wchar; + /* If non-NULL, dump the tree structure for the entire translation unit to this file. */ @@ -5096,6 +5118,8 @@ lang_get_alias_set (t) void c_common_nodes_and_builtins () { + int wchar_type_size; + tree array_domain_type; tree temp; tree memcpy_ftype, memset_ftype, strlen_ftype; tree bzero_ftype, bcmp_ftype, puts_ftype, printf_ftype; @@ -5122,6 +5146,140 @@ c_common_nodes_and_builtins () tree va_list_ref_type_node; tree va_list_arg_type_node; + /* Define `int' and `char' first so that dbx will output them first. */ + record_builtin_type (RID_INT, NULL_PTR, integer_type_node); + record_builtin_type (RID_CHAR, "char", char_type_node); + + /* `signed' is the same as `int'. FIXME: the declarations of "signed", + "unsigned long", "long long unsigned" and "unsigned short" were in C++ + but not C. Are the conditionals here needed? */ + if (c_language == clk_cplusplus) + record_builtin_type (RID_SIGNED, NULL_PTR, integer_type_node); + record_builtin_type (RID_LONG, "long int", long_integer_type_node); + record_builtin_type (RID_UNSIGNED, "unsigned int", unsigned_type_node); + record_builtin_type (RID_MAX, "long unsigned int", + long_unsigned_type_node); + if (c_language == clk_cplusplus) + record_builtin_type (RID_MAX, "unsigned long", long_unsigned_type_node); + record_builtin_type (RID_MAX, "long long int", + long_long_integer_type_node); + record_builtin_type (RID_MAX, "long long unsigned int", + long_long_unsigned_type_node); + if (c_language == clk_cplusplus) + record_builtin_type (RID_MAX, "long long unsigned", + long_long_unsigned_type_node); + record_builtin_type (RID_SHORT, "short int", short_integer_type_node); + record_builtin_type (RID_MAX, "short unsigned int", + short_unsigned_type_node); + if (c_language == clk_cplusplus) + record_builtin_type (RID_MAX, "unsigned short", + short_unsigned_type_node); + + /* Define both `signed char' and `unsigned char'. */ + record_builtin_type (RID_MAX, "signed char", signed_char_type_node); + record_builtin_type (RID_MAX, "unsigned char", unsigned_char_type_node); + + /* These are types that type_for_size and type_for_mode use. */ + pushdecl (build_decl (TYPE_DECL, NULL_TREE, intQI_type_node)); + pushdecl (build_decl (TYPE_DECL, NULL_TREE, intHI_type_node)); + pushdecl (build_decl (TYPE_DECL, NULL_TREE, intSI_type_node)); + pushdecl (build_decl (TYPE_DECL, NULL_TREE, intDI_type_node)); +#if HOST_BITS_PER_WIDE_INT >= 64 + pushdecl (build_decl (TYPE_DECL, get_identifier ("__int128_t"), intTI_type_node)); +#endif + pushdecl (build_decl (TYPE_DECL, NULL_TREE, unsigned_intQI_type_node)); + pushdecl (build_decl (TYPE_DECL, NULL_TREE, unsigned_intHI_type_node)); + pushdecl (build_decl (TYPE_DECL, NULL_TREE, unsigned_intSI_type_node)); + pushdecl (build_decl (TYPE_DECL, NULL_TREE, unsigned_intDI_type_node)); +#if HOST_BITS_PER_WIDE_INT >= 64 + pushdecl (build_decl (TYPE_DECL, get_identifier ("__uint128_t"), unsigned_intTI_type_node)); +#endif + + /* Create the widest literal types. */ + widest_integer_literal_type_node + = make_signed_type (HOST_BITS_PER_WIDE_INT * 2); + pushdecl (build_decl (TYPE_DECL, NULL_TREE, + widest_integer_literal_type_node)); + + widest_unsigned_literal_type_node + = make_unsigned_type (HOST_BITS_PER_WIDE_INT * 2); + pushdecl (build_decl (TYPE_DECL, NULL_TREE, + widest_unsigned_literal_type_node)); + + /* `unsigned long' is the standard type for sizeof. + Note that stddef.h uses `unsigned long', + and this must agree, even if long and int are the same size. */ + c_size_type_node = + TREE_TYPE (identifier_global_value (get_identifier (SIZE_TYPE))); + signed_size_type_node = signed_type (c_size_type_node); + if (flag_traditional) + c_size_type_node = signed_size_type_node; + set_sizetype (c_size_type_node); + + build_common_tree_nodes_2 (flag_short_double); + + record_builtin_type (RID_FLOAT, NULL_PTR, float_type_node); + record_builtin_type (RID_DOUBLE, NULL_PTR, double_type_node); + record_builtin_type (RID_MAX, "long double", long_double_type_node); + + pushdecl (build_decl (TYPE_DECL, get_identifier ("complex int"), + complex_integer_type_node)); + pushdecl (build_decl (TYPE_DECL, get_identifier ("complex float"), + complex_float_type_node)); + pushdecl (build_decl (TYPE_DECL, get_identifier ("complex double"), + complex_double_type_node)); + pushdecl (build_decl (TYPE_DECL, get_identifier ("complex long double"), + complex_long_double_type_node)); + + record_builtin_type (RID_VOID, NULL_PTR, void_type_node); + + void_list_node = build_void_list_node (); + + /* Make a type to be the domain of a few array types + whose domains don't really matter. + 200 is small enough that it always fits in size_t + and large enough that it can hold most function names for the + initializations of __FUNCTION__ and __PRETTY_FUNCTION__. */ + array_domain_type = build_index_type (size_int (200)); + + /* Make a type for arrays of characters. + With luck nothing will ever really depend on the length of this + array type. */ + char_array_type_node + = build_array_type (char_type_node, array_domain_type); + + /* Likewise for arrays of ints. */ + int_array_type_node + = build_array_type (integer_type_node, array_domain_type); + +#ifdef MD_INIT_BUILTINS + MD_INIT_BUILTINS; +#endif + + /* This is special for C++ so functions can be overloaded. */ + wchar_type_node = get_identifier (flag_short_wchar + ? "short unsigned int" + : WCHAR_TYPE); + wchar_type_node = TREE_TYPE (identifier_global_value (wchar_type_node)); + wchar_type_size = TYPE_PRECISION (wchar_type_node); + if (c_language == clk_cplusplus) + { + if (TREE_UNSIGNED (wchar_type_node)) + wchar_type_node = make_unsigned_type (wchar_type_size); + else + wchar_type_node = make_signed_type (wchar_type_size); + record_builtin_type (RID_WCHAR, "wchar_t", wchar_type_node); + } + else + { + signed_wchar_type_node = signed_type (wchar_type_node); + unsigned_wchar_type_node = unsigned_type (wchar_type_node); + } + + /* This is for wide string constants. */ + wchar_array_type_node + = build_array_type (wchar_type_node, array_domain_type); + string_type_node = build_pointer_type (char_type_node); const_string_type_node = build_pointer_type (build_type_variant (char_type_node, 1, 0)); diff --git a/gcc/c-common.h b/gcc/c-common.h index a5e43e4d5dc..adee309ce3b 100644 --- a/gcc/c-common.h +++ b/gcc/c-common.h @@ -351,6 +351,14 @@ extern c_language_kind c_language; extern int flag_const_strings; +/* Nonzero means give `double' the same size as `float'. */ + +extern int flag_short_double; + +/* Nonzero means give `wchar_t' the same size as `short'. */ + +extern int flag_short_wchar; + /* Warn about *printf or *scanf format/argument anomalies. */ extern int warn_format; @@ -463,6 +471,9 @@ extern int warn_long_long; extern tree (*make_fname_decl) PARAMS ((tree, const char *, int)); extern tree identifier_global_value PARAMS ((tree)); +extern void record_builtin_type PARAMS ((enum rid, + const char *, tree)); +extern tree build_void_list_node PARAMS ((void)); extern void declare_function_name PARAMS ((void)); extern void decl_attributes PARAMS ((tree, tree, tree)); diff --git a/gcc/c-decl.c b/gcc/c-decl.c index 826608ba4c1..c813d3e42de 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -52,20 +52,6 @@ enum decl_context BITFIELD, /* Likewise but with specified width */ TYPENAME}; /* Typename (inside cast or sizeof) */ -/* 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, - it would be best to do something here to figure out automatically - from other information what type to use. */ - -#ifndef SIZE_TYPE -#define SIZE_TYPE "long unsigned int" -#endif - -#ifndef WCHAR_TYPE -#define WCHAR_TYPE "int" -#endif - /* Nonzero if we have seen an invalid cross reference to a struct, union, or enum, but not yet printed the message. */ @@ -304,14 +290,6 @@ static void c_expand_body PARAMS ((tree, int)); int flag_cond_mismatch; -/* Nonzero means give `double' the same size as `float'. */ - -int flag_short_double; - -/* Nonzero means give `wchar_t' the same size as `short'. */ - -int flag_short_wchar; - /* Nonzero means don't recognize the keyword `asm'. */ int flag_no_asm; @@ -2962,9 +2940,6 @@ init_decl_processing () { register tree endlink; tree ptr_ftype_void, ptr_ftype_ptr; - int wchar_type_size; - tree array_domain_type; - tree t; current_function_decl = NULL; named_labels = NULL; @@ -2977,96 +2952,7 @@ init_decl_processing () build_common_tree_nodes (flag_signed_char); - /* Define `int' and `char' first so that dbx will output them first. */ - pushdecl (build_decl (TYPE_DECL, ridpointers[(int) RID_INT], - integer_type_node)); - pushdecl (build_decl (TYPE_DECL, get_identifier ("char"), - char_type_node)); - pushdecl (build_decl (TYPE_DECL, get_identifier ("long int"), - long_integer_type_node)); - pushdecl (build_decl (TYPE_DECL, get_identifier ("unsigned int"), - unsigned_type_node)); - pushdecl (build_decl (TYPE_DECL, get_identifier ("long unsigned int"), - long_unsigned_type_node)); - pushdecl (build_decl (TYPE_DECL, get_identifier ("long long int"), - long_long_integer_type_node)); - pushdecl (build_decl (TYPE_DECL, get_identifier ("long long unsigned int"), - long_long_unsigned_type_node)); - pushdecl (build_decl (TYPE_DECL, get_identifier ("short int"), - short_integer_type_node)); - pushdecl (build_decl (TYPE_DECL, get_identifier ("short unsigned int"), - short_unsigned_type_node)); - pushdecl (build_decl (TYPE_DECL, get_identifier ("signed char"), - signed_char_type_node)); - pushdecl (build_decl (TYPE_DECL, get_identifier ("unsigned char"), - unsigned_char_type_node)); - pushdecl (build_decl (TYPE_DECL, NULL_TREE, intQI_type_node)); - pushdecl (build_decl (TYPE_DECL, NULL_TREE, intHI_type_node)); - pushdecl (build_decl (TYPE_DECL, NULL_TREE, intSI_type_node)); - pushdecl (build_decl (TYPE_DECL, NULL_TREE, intDI_type_node)); -#if HOST_BITS_PER_WIDE_INT >= 64 - pushdecl (build_decl (TYPE_DECL, NULL_TREE, intTI_type_node)); -#endif - pushdecl (build_decl (TYPE_DECL, NULL_TREE, unsigned_intQI_type_node)); - pushdecl (build_decl (TYPE_DECL, NULL_TREE, unsigned_intHI_type_node)); - pushdecl (build_decl (TYPE_DECL, NULL_TREE, unsigned_intSI_type_node)); - pushdecl (build_decl (TYPE_DECL, NULL_TREE, unsigned_intDI_type_node)); -#if HOST_BITS_PER_WIDE_INT >= 64 - pushdecl (build_decl (TYPE_DECL, NULL_TREE, unsigned_intTI_type_node)); -#endif - - /* `unsigned long' is the standard type for sizeof. - Traditionally, use a signed type. - Note that stddef.h uses `unsigned long', - and this must agree, even if long and int are the same size. */ - t = TREE_TYPE (IDENTIFIER_GLOBAL_VALUE (get_identifier (SIZE_TYPE))); - signed_size_type_node = signed_type (t); - if (flag_traditional && TREE_UNSIGNED (t)) - t = signed_type (t); - - c_size_type_node = t; - set_sizetype (t); - - /* Create the widest literal types. */ - widest_integer_literal_type_node - = make_signed_type (HOST_BITS_PER_WIDE_INT * 2); - widest_unsigned_literal_type_node - = make_unsigned_type (HOST_BITS_PER_WIDE_INT * 2); - pushdecl (build_decl (TYPE_DECL, NULL_TREE, - widest_integer_literal_type_node)); - pushdecl (build_decl (TYPE_DECL, NULL_TREE, - widest_unsigned_literal_type_node)); - - build_common_tree_nodes_2 (flag_short_double); - - pushdecl (build_decl (TYPE_DECL, ridpointers[(int) RID_FLOAT], - float_type_node)); - pushdecl (build_decl (TYPE_DECL, ridpointers[(int) RID_DOUBLE], - double_type_node)); - pushdecl (build_decl (TYPE_DECL, get_identifier ("long double"), - long_double_type_node)); - pushdecl (build_decl (TYPE_DECL, get_identifier ("complex int"), - complex_integer_type_node)); - pushdecl (build_decl (TYPE_DECL, get_identifier ("complex float"), - complex_float_type_node)); - pushdecl (build_decl (TYPE_DECL, get_identifier ("complex double"), - complex_double_type_node)); - pushdecl (build_decl (TYPE_DECL, get_identifier ("complex long double"), - complex_long_double_type_node)); - pushdecl (build_decl (TYPE_DECL, - ridpointers[(int) RID_VOID], void_type_node)); - -#ifdef MD_INIT_BUILTINS - MD_INIT_BUILTINS; -#endif - - wchar_type_node = get_identifier (flag_short_wchar - ? "short unsigned int" - : WCHAR_TYPE); - wchar_type_node = TREE_TYPE (IDENTIFIER_GLOBAL_VALUE (wchar_type_node)); - wchar_type_size = TYPE_PRECISION (wchar_type_node); - signed_wchar_type_node = signed_type (wchar_type_node); - unsigned_wchar_type_node = unsigned_type (wchar_type_node); + c_common_nodes_and_builtins (); boolean_type_node = integer_type_node; boolean_true_node = integer_one_node; @@ -3085,30 +2971,6 @@ init_decl_processing () c_bool_true_node = build_int_2 (1, 0); TREE_TYPE (c_bool_true_node) = c_bool_type_node; - /* Make a type to be the domain of a few array types - whose domains don't really matter. - 200 is small enough that it always fits in size_t - and large enough that it can hold most function names for the - initializations of __FUNCTION__ and __PRETTY_FUNCTION__. */ - array_domain_type = build_index_type (build_int_2 (200, 0)); - - /* make a type for arrays of characters. - With luck nothing will ever really depend on the length of this - array type. */ - char_array_type_node = build_array_type (char_type_node, array_domain_type); - - /* Likewise for arrays of ints. */ - int_array_type_node - = build_array_type (integer_type_node, array_domain_type); - - /* This is for wide string constants. */ - wchar_array_type_node - = build_array_type (wchar_type_node, array_domain_type); - - void_list_node = tree_cons (NULL_TREE, void_type_node, NULL_TREE); - - c_common_nodes_and_builtins (); - endlink = void_list_node; ptr_ftype_void = build_function_type (ptr_type_node, endlink); ptr_ftype_ptr @@ -7190,3 +7052,28 @@ identifier_global_value (t) { return IDENTIFIER_GLOBAL_VALUE (t); } + +/* Record a builtin type for C. If NAME is non-NULL, it is the name used; + otherwise the name is found in ridpointers from RID_INDEX. */ + +void +record_builtin_type (rid_index, name, type) + enum rid rid_index; + const char *name; + tree type; +{ + tree id; + if (name == 0) + id = ridpointers[(int) rid_index]; + else + id = get_identifier (name); + pushdecl (build_decl (TYPE_DECL, id, type)); +} + +/* Build the void_list_node (void_type_node having been created). */ +tree +build_void_list_node () +{ + tree t = build_tree_list (NULL_TREE, void_type_node); + return t; +} diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index e86de6119cb..73bf967bddf 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,14 @@ +2001-01-04 Joseph S. Myers + + * decl.c (SIZE_TYPE, PTRDIFF_TYPE, WCHAR_TYPE): Don't define. + (record_builtin_type): Make non-static. + (flag_short_double): Don't declare. + (init_decl_processing): Remove the creation of many tree nodes now + in c_common_nodes_and_builtins. + (build_void_list_node): New function. + * decl2.c (flag_short_double, flag_short_wchar): Don't define. + * cp-tree.h (flag_short_wchar): Don't declare. + 2001-01-04 Mark Mitchell * call.c (build_conv): Don't use build1 for USER_CONV. diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index 05318657a50..0da2283af77 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -1,6 +1,6 @@ /* Definitions for C++ parsing and type checking. - Copyright (C) 1987, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000 - Free Software Foundation, Inc. + Copyright (C) 1987, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, + 2000, 2001 Free Software Foundation, Inc. Contributed by Michael Tiemann (tiemann@cygnus.com) This file is part of GNU CC. @@ -1131,10 +1131,6 @@ extern int flag_default_inline; version 0. */ extern int name_mangling_version; -/* Nonzero if wchar_t should be `unsigned short' instead of whatever it - would normally be, for use with WINE. */ -extern int flag_short_wchar; - /* Nonzero if squashed mangling is to be performed. This uses the B and K codes to reference previously seen class types and class qualifiers. */ diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 902cdaf4688..636b50c43d6 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -62,24 +62,6 @@ extern int (*valid_lang_attribute) PARAMS ((tree, tree, tree, tree)); #endif #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, - it would be best to do something here to figure out automatically - from other information what type to use. */ - -#ifndef SIZE_TYPE -#define SIZE_TYPE "long unsigned int" -#endif - -#ifndef PTRDIFF_TYPE -#define PTRDIFF_TYPE "long int" -#endif - -#ifndef WCHAR_TYPE -#define WCHAR_TYPE "int" -#endif - static tree grokparms PARAMS ((tree)); static const char *redeclaration_error_message PARAMS ((tree, tree)); @@ -109,7 +91,6 @@ static tree lookup_tag PARAMS ((enum tree_code, tree, struct binding_level *, int)); static void set_identifier_type_value_with_scope PARAMS ((tree, tree, struct binding_level *)); -static void record_builtin_type PARAMS ((enum rid, const char *, tree)); static void record_unknown_type PARAMS ((tree, const char *)); static tree build_library_fn_1 PARAMS ((tree, enum tree_code, tree)); static int member_function_or_else PARAMS ((tree, tree, enum overload_flags)); @@ -334,10 +315,6 @@ int flag_hosted = 1; int flag_noniso_default_format_attributes = 1; -/* Nonzero means give `double' the same size as `float'. */ - -extern int flag_short_double; - /* Nonzero if we want to conserve space in the .o files. We do this by putting uninitialized data and runtime initialized data into .common instead of .data at the expense of not flagging multiple @@ -6153,7 +6130,7 @@ end_only_namespace_names () in the array RID_POINTERS. NAME is the name used when looking up the builtin type. TYPE is the _TYPE node for the builtin type. */ -static void +void record_builtin_type (rid_index, name, type) enum rid rid_index; const char *name; @@ -6309,8 +6286,6 @@ void init_decl_processing () { tree fields[20]; - int wchar_type_size; - tree array_domain_type; /* Check to see that the user did not specify an invalid combination of command-line options. */ @@ -6382,67 +6357,7 @@ init_decl_processing () pushdecl (fake_std_node); } - /* Define `int' and `char' first so that dbx will output them first. */ - record_builtin_type (RID_INT, NULL_PTR, integer_type_node); - record_builtin_type (RID_CHAR, "char", char_type_node); - - /* `signed' is the same as `int' */ - record_builtin_type (RID_SIGNED, NULL_PTR, integer_type_node); - record_builtin_type (RID_LONG, "long int", long_integer_type_node); - record_builtin_type (RID_UNSIGNED, "unsigned int", unsigned_type_node); - record_builtin_type (RID_MAX, "long unsigned int", - long_unsigned_type_node); - record_builtin_type (RID_MAX, "unsigned long", long_unsigned_type_node); - record_builtin_type (RID_MAX, "long long int", - long_long_integer_type_node); - record_builtin_type (RID_MAX, "long long unsigned int", - long_long_unsigned_type_node); - record_builtin_type (RID_MAX, "long long unsigned", - long_long_unsigned_type_node); - record_builtin_type (RID_SHORT, "short int", short_integer_type_node); - record_builtin_type (RID_MAX, "short unsigned int", - short_unsigned_type_node); - record_builtin_type (RID_MAX, "unsigned short", - short_unsigned_type_node); - - /* Define both `signed char' and `unsigned char'. */ - record_builtin_type (RID_MAX, "signed char", signed_char_type_node); - record_builtin_type (RID_MAX, "unsigned char", unsigned_char_type_node); - - /* `unsigned long' is the standard type for sizeof. - Note that stddef.h uses `unsigned long', - and this must agree, even if long and int are the same size. */ - c_size_type_node = - TREE_TYPE (IDENTIFIER_GLOBAL_VALUE (get_identifier (SIZE_TYPE))); - signed_size_type_node = signed_type (c_size_type_node); - set_sizetype (c_size_type_node); - - /* Create the widest literal types. */ - widest_integer_literal_type_node = make_signed_type (HOST_BITS_PER_WIDE_INT * 2); - pushdecl (build_decl (TYPE_DECL, NULL_TREE, - widest_integer_literal_type_node)); - - widest_unsigned_literal_type_node = make_unsigned_type (HOST_BITS_PER_WIDE_INT * 2); - pushdecl (build_decl (TYPE_DECL, NULL_TREE, - widest_unsigned_literal_type_node)); - - /* These are types that type_for_size and type_for_mode use. */ - pushdecl (build_decl (TYPE_DECL, NULL_TREE, intQI_type_node)); - pushdecl (build_decl (TYPE_DECL, NULL_TREE, intHI_type_node)); - pushdecl (build_decl (TYPE_DECL, NULL_TREE, intSI_type_node)); - pushdecl (build_decl (TYPE_DECL, NULL_TREE, intDI_type_node)); -#if HOST_BITS_PER_WIDE_INT >= 64 - pushdecl (build_decl (TYPE_DECL, get_identifier ("__int128_t"), intTI_type_node)); -#endif - pushdecl (build_decl (TYPE_DECL, NULL_TREE, unsigned_intQI_type_node)); - pushdecl (build_decl (TYPE_DECL, NULL_TREE, unsigned_intHI_type_node)); - pushdecl (build_decl (TYPE_DECL, NULL_TREE, unsigned_intSI_type_node)); - pushdecl (build_decl (TYPE_DECL, NULL_TREE, unsigned_intDI_type_node)); -#if HOST_BITS_PER_WIDE_INT >= 64 - pushdecl (build_decl (TYPE_DECL, get_identifier ("__uint128_t"), unsigned_intTI_type_node)); -#endif - - build_common_tree_nodes_2 (flag_short_double); + c_common_nodes_and_builtins (); java_byte_type_node = record_builtin_java_type ("__java_byte", 8); java_short_type_node = record_builtin_java_type ("__java_short", 16); @@ -6470,42 +6385,9 @@ init_decl_processing () TREE_TYPE (boolean_true_node) = boolean_type_node; signed_size_zero_node = build_int_2 (0, 0); - record_builtin_type (RID_FLOAT, NULL_PTR, float_type_node); - record_builtin_type (RID_DOUBLE, NULL_PTR, double_type_node); - record_builtin_type (RID_MAX, "long double", long_double_type_node); - - pushdecl (build_decl (TYPE_DECL, get_identifier ("complex int"), - complex_integer_type_node)); - pushdecl (build_decl (TYPE_DECL, get_identifier ("complex float"), - complex_float_type_node)); - pushdecl (build_decl (TYPE_DECL, get_identifier ("complex double"), - complex_double_type_node)); - pushdecl (build_decl (TYPE_DECL, get_identifier ("complex long double"), - complex_long_double_type_node)); - TREE_TYPE (signed_size_zero_node) = make_signed_type (TYPE_PRECISION (sizetype)); - record_builtin_type (RID_VOID, NULL_PTR, void_type_node); - void_list_node = build_tree_list (NULL_TREE, void_type_node); - TREE_PARMLIST (void_list_node) = 1; - empty_except_spec = build_tree_list (NULL_TREE, NULL_TREE); - /* Make a type to be the domain of a few array types - whose domains don't really matter. - 200 is small enough that it always fits in size_t. */ - array_domain_type = build_index_type (size_int (200)); - - /* Make a type for arrays of characters. - With luck nothing will ever really depend on the length of this - array type. */ - char_array_type_node - = build_array_type (char_type_node, array_domain_type); - - /* Likewise for arrays of ints. */ - int_array_type_node - = build_array_type (integer_type_node, array_domain_type); - - c_common_nodes_and_builtins (); #if 0 record_builtin_type (RID_MAX, NULL_PTR, string_type_node); @@ -6529,10 +6411,6 @@ init_decl_processing () void_ftype_ptr = build_exception_variant (void_ftype_ptr, empty_except_spec); -#ifdef MD_INIT_BUILTINS - MD_INIT_BUILTINS; -#endif - /* C++ extensions */ unknown_type_node = make_node (UNKNOWN_TYPE); @@ -6548,22 +6426,6 @@ init_decl_processing () TYPE_POINTER_TO (unknown_type_node) = unknown_type_node; TYPE_REFERENCE_TO (unknown_type_node) = unknown_type_node; - /* This is special for C++ so functions can be overloaded. */ - wchar_type_node = get_identifier (flag_short_wchar - ? "short unsigned int" - : WCHAR_TYPE); - wchar_type_node = TREE_TYPE (IDENTIFIER_GLOBAL_VALUE (wchar_type_node)); - wchar_type_size = TYPE_PRECISION (wchar_type_node); - if (TREE_UNSIGNED (wchar_type_node)) - wchar_type_node = make_unsigned_type (wchar_type_size); - else - wchar_type_node = make_signed_type (wchar_type_size); - record_builtin_type (RID_WCHAR, "wchar_t", wchar_type_node); - - /* This is for wide string constants. */ - wchar_array_type_node - = build_array_type (wchar_type_node, array_domain_type); - if (flag_vtable_thunks) { /* Make sure we get a unique function type, so we can give @@ -14661,6 +14523,15 @@ identifier_global_value (t) return IDENTIFIER_GLOBAL_VALUE (t); } +/* Build the void_list_node (void_type_node having been created). */ +tree +build_void_list_node () +{ + tree t = build_tree_list (NULL_TREE, void_type_node); + TREE_PARMLIST (t) = 1; + return t; +} + static int cp_missing_noreturn_ok_p (decl) tree decl; diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index 9b4daa04832..1a38f4488ff 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -1,6 +1,6 @@ /* Process declarations and variables for C compiler. Copyright (C) 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998, - 1999, 2000 Free Software Foundation, Inc. + 1999, 2000, 2001 Free Software Foundation, Inc. Hacked by Michael Tiemann (tiemann@cygnus.com) This file is part of GNU CC. @@ -144,10 +144,6 @@ static tree decl_namespace_list; int flag_cond_mismatch; -/* Nonzero means give `double' the same size as `float'. */ - -int flag_short_double; - /* Nonzero means don't recognize the keyword `asm'. */ int flag_no_asm; @@ -453,11 +449,6 @@ int max_tinst_depth = 50; arguments. */ int name_mangling_version = 2; -/* Nonzero if wchar_t should be `unsigned short' instead of whatever it - would normally be, for use with WINE. */ - -int flag_short_wchar; - /* Nonzero if squashed mangling is to be performed. This uses the B and K codes to reference previously seen class types and class qualifiers. */