diff options
Diffstat (limited to 'gcc/cp/decl.c')
-rw-r--r-- | gcc/cp/decl.c | 129 |
1 files changed, 10 insertions, 119 deletions
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 65966f8..c8f7666 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -77,7 +77,6 @@ static void bad_specifiers (tree, enum bad_spec_place, int, int, int, int, int); static void check_for_uninitialized_const_var (tree); static tree local_variable_p_walkfn (tree *, int *, void *); -static tree record_builtin_java_type (const char *, int); static const char *tag_name (enum tag_types); static tree lookup_and_check_tag (enum tag_types, tree, tag_scope, bool); static int walk_namespaces_r (tree, walk_namespaces_fn, void *); @@ -3892,53 +3891,6 @@ record_builtin_type (enum rid rid_index, debug_hooks->type_decl (tdecl, 0); } -/* 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. */ - -static tree -record_builtin_java_type (const char* name, int size) -{ - tree type, decl; - if (size > 0) - { - type = build_nonstandard_integer_type (size, 0); - type = build_distinct_type_copy (type); - } - else if (size > -32) - { - tree stype; - /* "__java_char" or ""__java_boolean". */ - type = build_nonstandard_integer_type (-size, 1); - type = build_distinct_type_copy (type); - /* Get the signed type cached and attached to the unsigned type, - so it doesn't get garbage-collected at "random" times, - causing potential codegen differences out of different UIDs - and different alias set numbers. */ - stype = build_nonstandard_integer_type (-size, 0); - stype = build_distinct_type_copy (stype); - TREE_CHAIN (type) = stype; - /*if (size == -1) TREE_SET_CODE (type, BOOLEAN_TYPE);*/ - } - else - { /* "__java_float" or ""__java_double". */ - type = make_node (REAL_TYPE); - TYPE_PRECISION (type) = - size; - layout_type (type); - } - record_builtin_type (RID_MAX, name, type); - decl = TYPE_NAME (type); - - /* Suppress generate debug symbol entries for these types, - since for normal C++ they are just clutter. - However, push_lang_context undoes this if extern "Java" is seen. */ - DECL_IGNORED_P (decl) = 1; - - TYPE_FOR_JAVA (type) = 1; - return type; -} - /* Push a type into the namespace so that the back ends ignore it. */ static void @@ -3979,7 +3931,6 @@ initialize_predefined_identifiers (void) static const predefined_identifier predefined_identifiers[] = { { "C++", &lang_name_cplusplus, 0 }, { "C", &lang_name_c, 0 }, - { "Java", &lang_name_java, 0 }, /* Some of these names have a trailing space so that it is impossible for them to conflict with names written by users. */ { "__ct ", &ctor_identifier, 1 }, @@ -4051,15 +4002,6 @@ cxx_init_decl_processing (void) 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); - 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_cst (NULL_TREE, 2); record_builtin_type (RID_BOOL, "bool", boolean_type_node); @@ -6962,20 +6904,6 @@ cp_finish_decl (tree decl, tree init, bool init_const_expr_p, is *not* defined. */ && (!DECL_EXTERNAL (decl) || init)) { - if (TYPE_FOR_JAVA (type) && MAYBE_CLASS_TYPE_P (type)) - { - tree jclass - = IDENTIFIER_GLOBAL_VALUE (get_identifier ("jclass")); - /* Allow libjava/prims.cc define primitive classes. */ - if (init != NULL_TREE - || jclass == NULL_TREE - || TREE_CODE (jclass) != TYPE_DECL - || !POINTER_TYPE_P (TREE_TYPE (jclass)) - || !same_type_ignoring_top_level_qualifiers_p - (type, TREE_TYPE (TREE_TYPE (jclass)))) - error ("Java object %qD not allocated with %<new%>", decl); - init = NULL_TREE; - } cleanups = make_tree_vector (); init = check_initializer (decl, init, flags, &cleanups); @@ -7019,9 +6947,6 @@ cp_finish_decl (tree decl, tree init, bool init_const_expr_p, so that we can decide later to emit debug info for them. */ record_types_used_by_current_var_decl (decl); } - else if (TREE_CODE (decl) == FIELD_DECL - && TYPE_FOR_JAVA (type) && MAYBE_CLASS_TYPE_P (type)) - error ("non-static data member %qD has Java class type", decl); /* Add this declaration to the statement-tree. This needs to happen after the call to check_initializer so that the DECL_EXPR for a @@ -8384,9 +8309,7 @@ grokfndecl (tree ctype, check_main_parameter_types (decl); } - if (ctype != NULL_TREE - && (! TYPE_FOR_JAVA (ctype) || check_java_method (decl)) - && check) + if (ctype != NULL_TREE && check) { tree old_decl = check_classfn (ctype, decl, (processing_template_decl @@ -9236,7 +9159,7 @@ check_special_function_return_type (special_function_kind sfk, error_at (smallest_type_quals_location (type_quals, locations), "qualifiers are not allowed on constructor declaration"); - if (targetm.cxx.cdtor_returns_this () && !TYPE_FOR_JAVA (optype)) + if (targetm.cxx.cdtor_returns_this ()) type = build_pointer_type (optype); else type = void_type_node; @@ -9250,10 +9173,8 @@ check_special_function_return_type (special_function_kind sfk, "qualifiers are not allowed on destructor declaration"); /* We can't use the proper return type here because we run into - problems with ambiguous bases and covariant returns. - Java classes are left unchanged because (void *) isn't a valid - Java type, and we don't want to change the Java ABI. */ - if (targetm.cxx.cdtor_returns_this () && !TYPE_FOR_JAVA (optype)) + problems with ambiguous bases and covariant returns. */ + if (targetm.cxx.cdtor_returns_this ()) type = build_pointer_type (void_type_node); else type = void_type_node; @@ -10826,11 +10747,6 @@ grokdeclarator (const cp_declarator *declarator, { tree decl; - /* Note that the grammar rejects storage classes - in typenames, fields or parameters. */ - if (current_lang_name == lang_name_java) - TYPE_FOR_JAVA (type) = 1; - /* This declaration: typedef void f(int) const; @@ -11898,16 +11814,6 @@ grokparms (tree parmlist, tree *parms) TREE_TYPE (decl) = error_mark_node; } - if (type != error_mark_node - && TYPE_FOR_JAVA (type) - && MAYBE_CLASS_TYPE_P (type)) - { - error ("parameter %qD has Java class type", decl); - type = error_mark_node; - TREE_TYPE (decl) = error_mark_node; - init = NULL_TREE; - } - if (type != error_mark_node) { if (deprecated_state != DEPRECATED_SUPPRESS) @@ -13108,21 +13014,14 @@ xref_basetypes (tree ref, tree base_list) } if (max_bases > 1) - { - if (TYPE_FOR_JAVA (ref)) - error ("Java class %qT cannot have multiple bases", ref); - else - warning (OPT_Wmultiple_inheritance, - "%qT defined with multiple direct bases", ref); - } + warning (OPT_Wmultiple_inheritance, + "%qT defined with multiple direct bases", ref); if (max_vbases) { vec_alloc (CLASSTYPE_VBASECLASSES (ref), max_vbases); - if (TYPE_FOR_JAVA (ref)) - error ("Java class %qT cannot have virtual bases", ref); - else if (max_dvbases) + if (max_dvbases) warning (OPT_Wvirtual_inheritance, "%qT defined with direct virtual base", ref); } @@ -13147,9 +13046,6 @@ xref_basetypes (tree ref, tree base_list) goto dropped_base; } - if (TYPE_FOR_JAVA (basetype) && (current_lang_depth () == 0)) - TYPE_FOR_JAVA (ref) = 1; - base_binfo = NULL_TREE; if (CLASS_TYPE_P (basetype) && !dependent_scope_p (basetype)) { @@ -13924,15 +13820,11 @@ check_function_type (tree decl, tree current_function_parms) if (dependent_type_p (return_type) || type_uses_auto (return_type)) return; - if (!COMPLETE_OR_VOID_TYPE_P (return_type) - || (TYPE_FOR_JAVA (return_type) && MAYBE_CLASS_TYPE_P (return_type))) + if (!COMPLETE_OR_VOID_TYPE_P (return_type)) { tree args = TYPE_ARG_TYPES (fntype); - if (!COMPLETE_OR_VOID_TYPE_P (return_type)) - error ("return type %q#T is incomplete", return_type); - else - error ("return type has Java class type %q#T", return_type); + error ("return type %q#T is incomplete", return_type); /* Make it return void instead. */ if (TREE_CODE (fntype) == METHOD_TYPE) @@ -14587,8 +14479,7 @@ finish_constructor_body (void) tree val; tree exprstmt; - if (targetm.cxx.cdtor_returns_this () - && (! TYPE_FOR_JAVA (current_class_type))) + if (targetm.cxx.cdtor_returns_this ()) { /* Any return from a constructor will end up here. */ add_stmt (build_stmt (input_location, LABEL_EXPR, cdtor_label)); |