diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 0bf44b49de8..ed1fdabac03 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,19 +1,3 @@ -2000-06-09 Mark Mitchell - - * cp-tree.h (cp_tree_index): Remove Java types. - (java_fundamental_type_kind): New enumeration type. - (java_fundamental_types): New array. - * class.c (push_lang_context): Use java_fundamental_types. - * decl.c (java_fundamental_types): Define it. - (initialize_java_fundamental_types): New function. - (init_decl_processing): Call it - * mangle.c (integer_type_codes): Make it const. - (java_fundamental_type_codes): New variable. - (write_source_name_from_string): New function. - (write_identifier): Constify. - (write_builtin_type): Handle Java types. Use same_type_p for type - comparison. - 2000-06-09 Jason Merrill * semantics.c (expand_body): Push to TV_EXPAND. @@ -22,137 +6,6 @@ * tinfo2.cc: Just declare abort. -2000-06-08 Mark Mitchell - - Remove old ABI mangling code. - * cp-tree.h (cp_tree_index): Remove CPTI_TINFO_DECL_ID and - CPTI_TINFO_VAR_ID. - (tinfo_decl_id): Remove. - (tinfo_var_id): Likewise. - (name_mangling_version): Likewise. - (flag_do_squangling): Likewise. - (get_vtt_name): Likewise. - (init_method): Likewise. - (build_overload_name): Likewise. - (build_static_name): Likewise. - (build_decl_overload_real): Likewise. - (build_overload_with_type): Likewise. - (build_destructor_name): Likewise. - (get_id_2): Likewise. - (get_ctor_vtbl_name): Likewise. - (mangle_typeinfo_fn_for_type): New function. - (mangle_java_reflection_var_for_type): Likewise. - * call.c (build_new_method_call): Use mangle_vtt_for_type. - * class.c (get_vtable_name): Remove. - (get_vtt_name): Remove. - (get_vtable_decl): Use mangle_vtbl_for_type. - (build_vtt): Likewise. - (build_ctor_vtbl_group): Remove old ABI mangling support. - * decl.c (pushtag): Likewise. - (maybe_commonize_var): Use set_mangled_name_for_decl. - (grokfndecl): Remove old ABI mangling support. - (grokvardecl): Likewise. - (grokdeclarator): Likewise. - (grok_op_properties): Adjust use of DEF_OPERATOR. - * decl2.c (name_mangling_version): Remove. - (lang_f_options): Remove squangle. - (unsupported_options): Add squangle. - (lang_decode_options): Don't set flag_do_squangling. Issue a - warning for -fname-mangling-version. - (grokclassfn): Remove old ABI mangling support. - (finish_static_data_member_decl): Likewise. - (grokfield): Likewise. - (grokoptypename): Likewise. - (get_sentry): Likewise. - * init.c (build_java_class_ref): Use - mangle_java_reflection_var_for_type. - * lex.c (init_operators): Adjust use of DEF_OPERATOR. - (init_parse): Call init_mangle, not init_method. - * mangle.c (write_special_name_constructor): Handle - maybe-in-charge constructors. - (write_special_name_destructor): Handle - maybe-in-charge destructors. - (write_expression): Tweak code to handle non-type template - arguments with reference type. - (mangle_typeinfo_fn_for_type): New function. - (mangle_java_reflection_var_for_type): Likewise. - (mangle_conv_op_name_for_type): Don't use a name that the user - could type. - * method.c (enum mangling_flags): Remove. - (mangling_flags): Likewise. - (obstack_chunk_alloc): Likewise. - (obstack_chunk_free): Likewise. - (OB_INIT): Likewise. - (OB_PUTC): Likewise. - (OB_PUTC2): Likewise. - (OB_PUTS): Likewise. - (OB_PUTID): Likewise. - (OB_PUTCP): Likewise. - (OB_FINISH): Likewise. - (OB_LAST): Likewise. - (btypelist): Likewise. - (ktypelist): Likewise. - (maxbtype): Likewise. - (maxktype): Likewise. - (typevec): Likewise. - (maxtype): Likewise. - (init_method): Likewise. - (digit_buffer): Likewise. - (nofold): Likewise. - (start_squangling): Likewise. - (end_squangling): Likewise. - (icat): Likewise. - (dicat): Likewise. - (old_backref_index): Likewise. - (flush_repeats): Likewise. - (is_back_referenceable_type): Likewise. - (issue_nrepeats): Likewise. - (check_ktype): Likewise. - (issue_ktype): Likewise. - (build_overload_nested_name): Likewise. - (build_underscore_int): Likewise. - (build_overload_scope_ref): Likewise. - (mangle_expression): Likewise. - (build_overload_int): Likewise. - (mangled_C9x_name): Likewise. - (build_overload_value): Likewise. - (build_template_template_parm_names): Likewise. - (build_template_parm_names): Likewise. - (build_overload_identifier): Likewise. - (build_qualified_name): Likewise. - (build_mangled_name_for_type_with_Gcode): Likewise. - (build_mangled_name_for_type): Likewise. - (build_overload_name): Likewise. - (build_mangled_name): Likewise. - (process_modifiers): Likewise. - (check_btype): Likewise. - (process_overload_item): Likewise. - (build_static_name): Likewise. - (build_decl_overload_real): Likewise. - (set_mangled_name_for_decl): Remove old ABI mangling support. - (build_typename_overload): Remove. - (build_overload_with_type): Remove. - (get_id_2): Remove. - (get_ctor_vtbl_name): Remove. - (build_destructor_name): Likewise. - (set_mangled_name_for_decl): Likewise. - (make_thunk): Remove old ABI mangling support. - * operators.def: Likewise. - * pt.c (check_explicit_specialization): Don't call - set_mangled_name_for_template_decl. - (lookup_template_class): Remove old ABI mangling support. - (tsubst_friend_function): Update comment. - (tsubst_decl): Remove old ABI mangling support. - (tsubst_copy): Likewise. - (set_mangled_name_for_template_decl): Remove. - * rtti.c (init_rtti_processing): Use std_identifier. Don't set - tinfo_decl_id or tinfo_var_id. - (get_tinfo_var): Use mangle_typeinfo_for_type. - (tinfo_name): Remove old ABI mangling support. - (get_tinfo_decl): Likewise. - (tinfo_base_init): Likewise. - (create_real_tinfo_var): Use a name that the user can't type. - 2000-06-09 Gabriel Dos Reis * lex.c (DEF_OPERATOR): Say `operator@' -not- `operator @' diff --git a/gcc/cp/class.c b/gcc/cp/class.c index 27742c5bd92..77a5b7e6499 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -5642,16 +5642,20 @@ push_lang_context (name) } else if (name == lang_name_java) { - java_fundamental_type_kind jtk; - strict_prototype = strict_prototypes_lang_cplusplus; current_lang_name = name; /* DECL_IGNORED_P is initially set for these types, to avoid clutter. (See record_builtin_java_type in decl.c.) However, that causes incorrect debug entries if these types are actually used. So we re-enable debug output after extern "Java". */ - for (jtk = jtk_first; jtk < jtk_last; ++jtk) - DECL_IGNORED_P (java_fundamental_types[jtk]) = 0; + DECL_IGNORED_P (java_byte_type_node) = 0; + DECL_IGNORED_P (java_short_type_node) = 0; + DECL_IGNORED_P (java_int_type_node) = 0; + DECL_IGNORED_P (java_long_type_node) = 0; + DECL_IGNORED_P (java_float_type_node) = 0; + DECL_IGNORED_P (java_double_type_node) = 0; + DECL_IGNORED_P (java_char_type_node) = 0; + DECL_IGNORED_P (java_boolean_type_node) = 0; } else if (name == lang_name_c) { diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index 5f25f17febc..b9aea8667e5 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -599,6 +599,15 @@ enum cp_tree_index extern tree cp_global_trees[CPTI_MAX]; +#define java_byte_type_node cp_global_trees[CPTI_JAVA_BYTE_TYPE] +#define java_short_type_node cp_global_trees[CPTI_JAVA_SHORT_TYPE] +#define java_int_type_node cp_global_trees[CPTI_JAVA_INT_TYPE] +#define java_long_type_node cp_global_trees[CPTI_JAVA_LONG_TYPE] +#define java_float_type_node cp_global_trees[CPTI_JAVA_FLOAT_TYPE] +#define java_double_type_node cp_global_trees[CPTI_JAVA_DOUBLE_TYPE] +#define java_char_type_node cp_global_trees[CPTI_JAVA_CHAR_TYPE] +#define java_boolean_type_node cp_global_trees[CPTI_JAVA_BOOLEAN_TYPE] + #define void_zero_node cp_global_trees[CPTI_VOID_ZERO] #define wchar_decl_node cp_global_trees[CPTI_WCHAR_DECL] #define vtable_entry_type cp_global_trees[CPTI_VTABLE_ENTRY_TYPE] @@ -728,26 +737,6 @@ extern tree cp_global_trees[CPTI_MAX]; destructors. */ #define vtt_parm_type cp_global_trees[CPTI_VTT_PARM_TYPE] -/* The various kinds of fundamental Java types. */ - -typedef enum java_fundamental_type_kind -{ - jtk_first, /* Must be first. */ - jtk_byte = jtk_first, - jtk_short, - jtk_int, - jtk_long, - jtk_float, - jtk_double, - jtk_char, - jtk_boolean, - jtk_last /* Must be last */ -} java_fundamental_type_kind; - -/* The fundamental Java types. */ - -extern tree java_fundamental_types[jtk_last]; - /* Global state. */ struct stmt_tree { diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index a1b93614321..f9f52fac630 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -186,7 +186,6 @@ static tree start_cleanup_fn PARAMS ((void)); static void end_cleanup_fn PARAMS ((void)); static tree cp_make_fname_decl PARAMS ((tree, const char *, int)); static void initialize_predefined_identifiers PARAMS ((void)); -static void initialize_java_fundamental_types PARAMS ((void)); static tree check_special_function_return_type PARAMS ((special_function_kind, tree, tree, tree)); static tree push_cp_library_fn PARAMS ((enum tree_code, tree)); @@ -262,10 +261,6 @@ tree error_mark_list; tree cp_global_trees[CPTI_MAX]; -/* The fundamental Java types. */ - -tree java_fundamental_types[jtk_last]; - /* Indicates that there is a type value in some namespace, although that is not necessarily in scope at the moment. */ @@ -6147,9 +6142,9 @@ record_builtin_type (rid_index, name, type) } /* Record one of the standard Java types. - Declare it as having the given NAME. - If SIZE > 0, it is the size of one of the integral types; - otherwise it is the negative of the size of one of the other types. */ + * Declare it as having the given NAME. + * If SIZE > 0, it is the size of one of the integral types; + * otherwise it is the negative of the size of one of the other types. */ static tree record_builtin_java_type (name, size) @@ -6253,38 +6248,6 @@ initialize_predefined_identifiers () } } -/* Create nodes representing the fundamental Java types. */ - -static void -initialize_java_fundamental_types () -{ - typedef struct jft_info - { - /* The name of the type. */ - const char *name; - /* The number of bits in the type. */ - int size; - } jft_info; - - static jft_info jft_infos[jtk_last] = { - { "__java_byte", 8 }, - { "__java_short", 16 }, - { "__java_int", 32 }, - { "__java_long", 64 }, - { "__java_float", -32 }, - { "__java_double", -64 }, - { "__java_char", -16 }, - { "__java_boolean", -1 } - }; - - java_fundamental_type_kind jtk; - - for (jtk = jtk_first; jtk < jtk_last; ++jtk) - java_fundamental_types[jtk] - = record_builtin_java_type (jft_infos[jtk].name, - jft_infos[jtk].size); -} - /* Create the predefined scalar types of C, and some nodes representing standard constants (0, 1, (void *)0). Initialize the global binding level. @@ -6434,7 +6397,14 @@ init_decl_processing () build_common_tree_nodes_2 (flag_short_double); - initialize_java_fundamental_types (); + java_byte_type_node = record_builtin_java_type ("__java_byte", 8); + java_short_type_node = record_builtin_java_type ("__java_short", 16); + java_int_type_node = record_builtin_java_type ("__java_int", 32); + java_long_type_node = record_builtin_java_type ("__java_long", 64); + java_float_type_node = record_builtin_java_type ("__java_float", -32); + java_double_type_node = record_builtin_java_type ("__java_double", -64); + java_char_type_node = record_builtin_java_type ("__java_char", -16); + java_boolean_type_node = record_builtin_java_type ("__java_boolean", -1); integer_two_node = build_int_2 (2, 0); TREE_TYPE (integer_two_node) = integer_type_node; @@ -6686,8 +6656,6 @@ init_decl_processing () /* Add GC roots for all of our global variables. */ ggc_add_tree_root (c_global_trees, sizeof c_global_trees / sizeof(tree)); ggc_add_tree_root (cp_global_trees, sizeof cp_global_trees / sizeof(tree)); - ggc_add_tree_root (java_fundamental_types, - sizeof (java_fundamental_types) / sizeof (tree)); ggc_add_tree_root (&integer_three_node, 1); ggc_add_tree_root (&integer_two_node, 1); ggc_add_tree_root (&signed_size_zero_node, 1); diff --git a/gcc/cp/mangle.c b/gcc/cp/mangle.c index ff94433c4c7..2bba09f518b 100644 --- a/gcc/cp/mangle.c +++ b/gcc/cp/mangle.c @@ -120,7 +120,7 @@ static tree subst_identifiers[SUBID_MAX]; /* Single-letter codes for builtin integer types, defined in . These are indexed by integer_type_kind values. */ -static const char +static char integer_type_codes[itk_none] = { 'c', /* itk_char */ @@ -136,21 +136,6 @@ integer_type_codes[itk_none] = 'y' /* itk_unsigned_long_long */ }; -/* Manglings for the various builtin Java types. */ - -static const char * -java_fundamental_type_codes[jtk_last] = -{ - "jb", /* jtk_byte */ - "js", /* jtk_short */ - "ji", /* jtk_int */ - "jl", /* jtk_long */ - "jf", /* jtk_float */ - "jd", /* jtk_double */ - "jc", /* jtk_char */ - "jt" /* jtk_boolean */ -}; - /* Functions for handling substitutions. */ static inline tree canonicalize_for_substitution PARAMS ((tree)); @@ -171,11 +156,10 @@ static void write_prefix PARAMS ((tree)); static void write_template_prefix PARAMS ((tree)); static void write_component PARAMS ((tree)); static void write_unqualified_name PARAMS ((tree)); -static void write_source_name_from_string PARAMS ((const char *)); static void write_source_name PARAMS ((tree)); static void write_number PARAMS ((int, int)); static void write_integer_cst PARAMS ((tree)); -static void write_identifier PARAMS ((const char *)); +static void write_identifier PARAMS ((char *)); static void write_special_name_constructor PARAMS ((tree)); static void write_special_name_destructor PARAMS ((tree)); static void write_type PARAMS ((tree)); @@ -914,18 +898,6 @@ write_unqualified_name (decl) write_source_name (DECL_NAME (decl)); } -/* Non-termial . NAME is a NTBS. - - ::= */ - -static void -write_source_name_from_string (name) - const char *name; -{ - write_number (strlen (name), 10); - write_identifier (name); -} - /* Non-termial . IDENTIFIER is an IDENTIFIER_NODE. ::= */ @@ -997,7 +969,7 @@ write_integer_cst (cst) static void write_identifier (identifier) - const char *identifier; + char *identifier; { MANGLE_TRACE ("identifier", identifier); write_string (identifier); @@ -1335,24 +1307,6 @@ static void write_builtin_type (type) tree type; { - /* If this is a Java type, mangle it specially, as a vendor - extension. */ - if (TYPE_FOR_JAVA (type)) - { - java_fundamental_type_kind jtk; - - for (jtk = jtk_first; jtk < jtk_last; ++jtk) - if (same_type_p (type, java_fundamental_types[jtk])) - { - /* The `u' indicates a vendor extension. */ - write_char ('u'); - write_source_name_from_string (java_fundamental_type_codes[jtk]); - return; - } - - my_friendly_abort (20000609); - } - switch (TREE_CODE (type)) { case VOID_TYPE: @@ -1370,7 +1324,7 @@ write_builtin_type (type) /* TYPE may still be wchar_t, since that isn't in integer_type_nodes. */ - if (same_type_p (type, wchar_type_node)) + if (type == wchar_type_node) write_char ('w'); else { @@ -1378,7 +1332,7 @@ write_builtin_type (type) /* Assume TYPE is one of the shared integer type nodes. Find it in the array of these nodes. */ for (itk = 0; itk < itk_none; ++itk) - if (same_type_p (type, integer_types[itk])) + if (type == integer_types[itk]) { /* Print the corresponding single-letter code. */ write_char (integer_type_codes[itk]); @@ -1392,11 +1346,11 @@ write_builtin_type (type) break; case REAL_TYPE: - if (same_type_p (type, float_type_node)) + if (type == float_type_node) write_char ('f'); - else if (same_type_p (type, double_type_node)) + else if (type == double_type_node) write_char ('d'); - else if (same_type_p (type, long_double_type_node)) + else if (type == long_double_type_node) write_char ('e'); else my_friendly_abort (20000409);