aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/decl.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2016-10-04 17:32:31 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2016-10-04 17:32:31 +0200
commitbfecd57cd46ac368213f55fc4a3ff67c8c59c5ea (patch)
tree67b42e486b9999f08c29028115ba5ebbee98254b /gcc/cp/decl.c
parentfe8b1e839ca91a61440288049a868944346eef4b (diff)
downloadgcc-bfecd57cd46ac368213f55fc4a3ff67c8c59c5ea.zip
gcc-bfecd57cd46ac368213f55fc4a3ff67c8c59c5ea.tar.gz
gcc-bfecd57cd46ac368213f55fc4a3ff67c8c59c5ea.tar.bz2
extend.texi (Java Exceptions): Remove.
* doc/extend.texi (Java Exceptions): Remove. (java_interface): Remove. cp/ * cp-tree.h (enum cp_tree_index): Remove CPTI_JAVA_*, CPTI_LANG_NAME_JAVA and CPTI_JCLASS. (java_byte_type_node, java_short_type_node, java_int_type_node, java_long_type_node, java_float_type_node, java_double_type_node, java_char_type_node, java_boolean_type_node, lang_name_java, jclass_node): Remove. (enum languages): Remove lang_java. (TYPE_FOR_JAVA): Remove. (struct lang_type_class): Remove java_interface bit-field. (TYPE_JAVA_INTERFACE): Remove. (pragma_java_exceptions): Remove. (check_java_method, build_java_class_ref): Remove prototypes. * name-lookup.c (pushtag_1): Don't set TYPE_FOR_JAVA. * decl2.c (acceptable_java_type, check_java_method): Remove. (import_export_decl): Remove TYPE_FOR_JAVA handling. (build_java_method_aliases): Remove. (c_parse_final_cleanups): Don't call build_java_method_aliases. (possibly_inlined_p): Don't test pragma_java_exceptions. * init.c (build_new_1): Remove TYPE_FOR_JAVA handling. (build_java_class_ref): Remove. * pt.c (maybe_new_partial_specialization, lookup_template_class_1, instantiate_class_template_1): Don't copy TYPE_FOR_JAVA. * except.c (eh_type_info): Remove java type handling. (decl_is_java_type, choose_personality_routine): Remove. (initialize_handler_parm): Don't call choose_personality_routine. (expand_start_catch_block): Don't handle java types. (build_throw): Likewise. * cp-lang.c (cp_eh_personality): Don't handle pragma_java_exceptions. * typeck.c (structural_comptypes): Don't compare TYPE_FOR_JAVA. * call.c (build_over_call): Don't handle TYPE_JAVA_INTERFACE. (java_iface_lookup_fn): Remove. (build_java_interface_fn_ref): Remove. * tree.c (cxx_attribute_table): Remove java_interface. (handle_java_interface_attribute): Remove. * lex.c (pragma_java_exceptions): Remove. (init_cp_pragma): Don't register GCC java_exceptions pragma. (handle_pragma_java_exceptions): Remove. (retrofit_lang_decl): Don't handle lang_name_java. * method.c (implicitly_declare_fn): Don't handle TYPE_FOR_JAVA. * error.c (language_to_string): Don't handle lang_java. * decl.c (record_builtin_java_type): Remove. (initialize_predefined_identifiers): Remove Java. (cxx_init_decl_processing): Remove java_*_type_node. (cp_finish_decl): Don't handle TYPE_FOR_JAVA. (grokfndecl): Likewise. (check_special_function_return_type): Likewise. (grokdeclarator): Don't set TYPE_FOR_JAVA. (grokparms): Don't handle TYPE_FOR_JAVA. (xref_basetypes): Likewise. (check_function_type): Likewise. (finish_constructor_body): Likewise. * mangle.c (write_builtin_type): Don't handle TYPE_FOR_JAVA and java_*_type_node. (write_bare_function_type): Don't handle TYPE_FOR_JAVA. (write_java_integer_type_codes): Remove. * class.c (add_method): Don't handle TYPE_FOR_JAVA. (add_implicitly_declared_members, determine_key_method, finish_struct_1): Likewise. (push_lang_context): Don't handle lang_name_java. testsuite/ * g++.dg/other/java3.C: Remove. * g++.dg/other/java1.C: Remove. * g++.dg/other/error12.C: Remove. * g++.dg/other/java2.C: Remove. * g++.dg/warn/Wnvdtor.C: Remove. * g++.dg/lookup/java1.C: Remove. * g++.dg/lookup/java2.C: Remove. * g++.dg/ext/pr34829.C: Remove. * g++.dg/ext/java-3.C: Remove. * g++.dg/ext/java-1.C: Remove. * g++.dg/ext/java-2.C: Remove. * g++.old-deja/g++.oliva/dwarf2.C: Remove. From-SVN: r240750
Diffstat (limited to 'gcc/cp/decl.c')
-rw-r--r--gcc/cp/decl.c129
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));