aboutsummaryrefslogtreecommitdiff
path: root/gcc/objc
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@google.com>2009-05-11 01:02:40 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2009-05-11 01:02:40 +0000
commit24b97832e7fdb1be20e493105798dac42999c34a (patch)
tree6b70d6a26b24127001f8d3a73561028aafd73246 /gcc/objc
parent76a5dd01ebb7570ee186acf68fb7943101495536 (diff)
downloadgcc-24b97832e7fdb1be20e493105798dac42999c34a.zip
gcc-24b97832e7fdb1be20e493105798dac42999c34a.tar.gz
gcc-24b97832e7fdb1be20e493105798dac42999c34a.tar.bz2
basic-block.h (enum profile_status): Break out of struct control_flow_graph.
./: * basic-block.h (enum profile_status): Break out of struct control_flow_graph. * cgraph.h (struct inline_summary): Break out of struct cgraph_local_info. * cgraphunit.c (enum cgraph_order_sort_kind): New enum, broken out of struct cgraph_order_sort. * combine.c (enum undo_kind): New enum, broken out of struct undo. * cse.c (struct branch_path): Break out of struct cse_basic_block_data. * except.h (enum eh_region_type): Break out of struct eh_region. * gcc.c (enum add_del): Break out of struct modify_target. * genrecog.c (enum decision_type): Break out of struct decision_test. * ggc-page.c (struct ggc_pch_ondisk): Break out of struct ggc_pch_data. * matrix-reorg.c (struct free_info): Break out of struct matrix_info. * regmove.c (enum match_use): New enum, broken out of struct match. * sched-int.h (enum post_call_group): New enum, broken out of struct deps. (struct deps_reg): Break out of struct deps. * target.h (struct asm_int_op): Break out of struct gcc_target. * tree-eh.c (struct goto_queue_node): Break out of struct leh_tf_state. * tree-inline.h (enum copy_body_cge_which): Break out of copy_body_data. * tree-pass.h (enum opt_pass_type): Break out of struct opt_pass. * c-decl.c (in_struct, struct_types): New static variables. (pushtag): Add loc parameter. Change all callers. (lookup_tag): Add ploc parameter. Change all callers. (check_compound_literal_type): New function. (parser_xref_tag): Add loc parameter. Change all callers. If -Wc++-compat, warn about struct/union/enum types defined within a struct or union. (start_struct): Add enclosing_in_struct, enclosing_struct_types, and loc parameters. Change all callers. Change error calls to error_at, using loc. For a redefinition, if the location of the original definition is known, report it. Set in_struct and struct_types. If -Wc++-compat warn if in sizeof, typeof, or alignof. (finish_struct): Add new parameters enclosing_in_struct and enclosing_struct_types. Change all callers. Set C_TYPE_DEFINED_IN_STRUCT for all struct/union/enum types defined in the struct. If in a struct, add this struct to struct_types. (start_enum): Add loc parameter. Change all callers. Use error_at for errors, using loc. For a redefinition, if the location of the original definition is known, report it. If in a struct, add this enum type to struct_types. If -Wc++-compat warn if in sizeof, typeof, or alignof. * c-parser.c (disable_extension_diagnostics): Disable -Wc++-compat. (enable_extension_diagnostics): Reenable -Wc++-compat if appropriate. (c_parser_enum_specifier): Get enum location for start_enum. (c_parser_struct_or_union_specifier): Get struct location for start_struct. Save in_struct and struct_types status between start_struct and finish_struct. (c_parser_cast_expression): Get location of cast. (c_parser_alignof_expression): Get location of type. (c_parser_postfix_expression): Likewise. (c_parser_postfix_expression_after_paren_type): Add type_loc parameter. Change all callers. Call check_compound_literal_type. Use type_loc for error about variable size type. * c-typeck.c (build_external_ref): If -Wc++-compat, warn about a use of an enum constant from an enum type defined in a struct or union. (c_cast_expr): Add loc parameter. Change all callers. If -Wc++-compat, warn about defining a type in a cast. * c-tree.h (C_TYPE_DEFINED_IN_STRUCT): Define. (start_enum, start_struct, finish_struct): Update declarations. (parser_xref_tag, c_cast_expr): Update declarations. (check_compound_literal_type): Declare. fortran/: * gfortran.h (enum gfc_omp_sched_kind): New enum, broken out of gfc_omp_clauses. (enum gfc_omp_default_sharing): Likewise. * module.c (enum gfc_rsym_state): New enum, broken out of pointer_info. (enum gfc_wsym_state): Likewise. * parse.c (enum state_order): New enum, broken out of st_state. objc/: * objc-act.c (objc_building_struct): New static variable. (objc_in_struct, objc_struct_types): New static variables. (objc_start_struct, objc_finish_struct): New static functions. (generate_struct_by_value_array): Call objc_start_struct instead of start_struct, and call objc_finish_struct instead of finish_struct. (objc_build_struct, build_objc_symtab_template): Likewise. (build_module_descriptor): Likewise. (build_next_objc_exception_stuff): Likewise. (build_protocol_template): Likewise. (build_method_prototype_list_template): Likewise. (build_method_prototype_template): Likewise. (build_category_template, build_selector_template): Likewise. (build_class_template, build_super_template): Likewise. (build_ivar_template, build_ivar_list_template): Likewise. (build_method_list_template): Likewise. (build_method_template): Likewise. objcp/: * objcp-decl.h (start_struct): Add three new, ignored, macro parameters. (finish_struct): Add two new, ignored, macro parameters. testsuite/: * gcc.dg/Wcxx-compat-7.c: New testcase. * gcc.dg/Wcxx-compat-8.c: New testcase. * gcc.dg/c99-tag-1.c: Recognize new "originally defined here" notes * gcc.dg/pr17188-1.c: Likewise. * gcc.dg/pr39084.c: Likewise. From-SVN: r147358
Diffstat (limited to 'gcc/objc')
-rw-r--r--gcc/objc/ChangeLog20
-rw-r--r--gcc/objc/objc-act.c101
2 files changed, 81 insertions, 40 deletions
diff --git a/gcc/objc/ChangeLog b/gcc/objc/ChangeLog
index 58f60d2b..a1f0f24 100644
--- a/gcc/objc/ChangeLog
+++ b/gcc/objc/ChangeLog
@@ -1,3 +1,23 @@
+2009-05-10 Ian Lance Taylor <iant@google.com>
+
+ * objc-act.c (objc_building_struct): New static variable.
+ (objc_in_struct, objc_struct_types): New static variables.
+ (objc_start_struct, objc_finish_struct): New static functions.
+ (generate_struct_by_value_array): Call objc_start_struct instead
+ of start_struct, and call objc_finish_struct instead of
+ finish_struct.
+ (objc_build_struct, build_objc_symtab_template): Likewise.
+ (build_module_descriptor): Likewise.
+ (build_next_objc_exception_stuff): Likewise.
+ (build_protocol_template): Likewise.
+ (build_method_prototype_list_template): Likewise.
+ (build_method_prototype_template): Likewise.
+ (build_category_template, build_selector_template): Likewise.
+ (build_class_template, build_super_template): Likewise.
+ (build_ivar_template, build_ivar_list_template): Likewise.
+ (build_method_list_template): Likewise.
+ (build_method_template): Likewise.
+
2009-05-10 Joseph Myers <joseph@codesourcery.com>
* objc-act.c: Include intl.h.
diff --git a/gcc/objc/objc-act.c b/gcc/objc/objc-act.c
index 02bff7d..9bf7d3f 100644
--- a/gcc/objc/objc-act.c
+++ b/gcc/objc/objc-act.c
@@ -416,6 +416,35 @@ FILE *gen_declaration_file;
static int generating_instance_variables = 0;
+/* For building an objc struct. These may not be used when this file
+ is compiled as part of obj-c++. */
+
+static bool objc_building_struct;
+static bool objc_in_struct ATTRIBUTE_UNUSED;
+static VEC(tree,heap) *objc_struct_types ATTRIBUTE_UNUSED;
+
+/* Start building a struct for objc. */
+
+static tree
+objc_start_struct (tree name)
+{
+ gcc_assert (!objc_building_struct);
+ objc_building_struct = true;
+ return start_struct (RECORD_TYPE, name, &objc_in_struct, &objc_struct_types,
+ UNKNOWN_LOCATION);
+}
+
+/* Finish building a struct for objc. */
+
+static tree
+objc_finish_struct (tree type, tree fieldlist)
+{
+ gcc_assert (objc_building_struct);
+ objc_building_struct = false;
+ return finish_struct (type, fieldlist, NULL_TREE, objc_in_struct,
+ objc_struct_types);
+}
+
/* Some platforms pass small structures through registers versus
through an invisible pointer. Determine at what size structure is
the transition point between the two possibilities. */
@@ -435,7 +464,7 @@ generate_struct_by_value_array (void)
char buffer[5];
/* Create an unnamed struct that has `i' character components */
- type = start_struct (RECORD_TYPE, NULL_TREE);
+ type = objc_start_struct (NULL_TREE);
strcpy (buffer, "c1");
field_decl = create_field_decl (char_type_node,
@@ -449,7 +478,7 @@ generate_struct_by_value_array (void)
buffer);
chainon (field_decl_chain, field_decl);
}
- finish_struct (type, field_decl_chain, NULL_TREE);
+ objc_finish_struct (type, field_decl_chain);
aggregate_in_mem[i] = aggregate_value_p (type, 0);
if (!aggregate_in_mem[i])
@@ -789,7 +818,7 @@ static tree
objc_build_struct (tree klass, tree fields, tree super_name)
{
tree name = CLASS_NAME (klass);
- tree s = start_struct (RECORD_TYPE, name);
+ tree s = objc_start_struct (name);
tree super = (super_name ? xref_tag (RECORD_TYPE, super_name) : NULL_TREE);
tree t, objc_info = NULL_TREE;
@@ -850,7 +879,7 @@ objc_build_struct (tree klass, tree fields, tree super_name)
INIT_TYPE_OBJC_INFO (s);
TYPE_OBJC_INTERFACE (s) = klass;
- s = finish_struct (s, fields, NULL_TREE);
+ s = objc_finish_struct (s, fields);
for (t = TYPE_NEXT_VARIANT (s); t;
t = TYPE_NEXT_VARIANT (t), objc_info = TREE_CHAIN (objc_info))
@@ -2058,8 +2087,7 @@ build_objc_symtab_template (void)
{
tree field_decl, field_decl_chain;
- objc_symtab_template
- = start_struct (RECORD_TYPE, get_identifier (UTAG_SYMTAB));
+ objc_symtab_template = objc_start_struct (get_identifier (UTAG_SYMTAB));
/* long sel_ref_cnt; */
field_decl = create_field_decl (long_integer_type_node, "sel_ref_cnt");
@@ -2093,7 +2121,7 @@ build_objc_symtab_template (void)
chainon (field_decl_chain, field_decl);
}
- finish_struct (objc_symtab_template, field_decl_chain, NULL_TREE);
+ objc_finish_struct (objc_symtab_template, field_decl_chain);
}
/* Create the initial value for the `defs' field of _objc_symtab.
@@ -2293,8 +2321,7 @@ build_module_descriptor (void)
push_lang_context (lang_name_c); /* extern "C" */
#endif
- objc_module_template
- = start_struct (RECORD_TYPE, get_identifier (UTAG_MODULE));
+ objc_module_template = objc_start_struct (get_identifier (UTAG_MODULE));
/* long version; */
field_decl = create_field_decl (long_integer_type_node, "version");
@@ -2316,7 +2343,7 @@ build_module_descriptor (void)
"symtab");
chainon (field_decl_chain, field_decl);
- finish_struct (objc_module_template, field_decl_chain, NULL_TREE);
+ objc_finish_struct (objc_module_template, field_decl_chain);
/* Create an instance of "_objc_module". */
UOBJC_MODULES_decl = start_var_decl (objc_module_template, "_OBJC_MODULES");
@@ -3994,7 +4021,7 @@ build_next_objc_exception_stuff (void)
tree field_decl, field_decl_chain, index, temp_type;
objc_exception_data_template
- = start_struct (RECORD_TYPE, get_identifier (UTAG_EXCDATA));
+ = objc_start_struct (get_identifier (UTAG_EXCDATA));
/* int buf[OBJC_JBLEN]; */
@@ -4010,7 +4037,7 @@ build_next_objc_exception_stuff (void)
"pointers");
chainon (field_decl_chain, field_decl);
- finish_struct (objc_exception_data_template, field_decl_chain, NULL_TREE);
+ objc_finish_struct (objc_exception_data_template, field_decl_chain);
/* int _setjmp(...); */
/* If the user includes <setjmp.h>, this shall be superseded by
@@ -4157,8 +4184,7 @@ build_protocol_template (void)
{
tree field_decl, field_decl_chain;
- objc_protocol_template = start_struct (RECORD_TYPE,
- get_identifier (UTAG_PROTOCOL));
+ objc_protocol_template = objc_start_struct (get_identifier (UTAG_PROTOCOL));
/* struct _objc_class *isa; */
field_decl = create_field_decl (build_pointer_type
@@ -4188,7 +4214,7 @@ build_protocol_template (void)
"class_methods");
chainon (field_decl_chain, field_decl);
- finish_struct (objc_protocol_template, field_decl_chain, NULL_TREE);
+ objc_finish_struct (objc_protocol_template, field_decl_chain);
}
static tree
@@ -4238,7 +4264,7 @@ build_method_prototype_list_template (tree list_type, int size)
/* Generate an unnamed struct definition. */
- objc_ivar_list_record = start_struct (RECORD_TYPE, NULL_TREE);
+ objc_ivar_list_record = objc_start_struct (NULL_TREE);
/* int method_count; */
field_decl = create_field_decl (integer_type_node, "method_count");
@@ -4252,7 +4278,7 @@ build_method_prototype_list_template (tree list_type, int size)
"method_list");
chainon (field_decl_chain, field_decl);
- finish_struct (objc_ivar_list_record, field_decl_chain, NULL_TREE);
+ objc_finish_struct (objc_ivar_list_record, field_decl_chain);
return objc_ivar_list_record;
}
@@ -4263,8 +4289,7 @@ build_method_prototype_template (void)
tree proto_record;
tree field_decl, field_decl_chain;
- proto_record
- = start_struct (RECORD_TYPE, get_identifier (UTAG_METHOD_PROTOTYPE));
+ proto_record = objc_start_struct (get_identifier (UTAG_METHOD_PROTOTYPE));
/* SEL _cmd; */
field_decl = create_field_decl (objc_selector_type, "_cmd");
@@ -4274,7 +4299,7 @@ build_method_prototype_template (void)
field_decl = create_field_decl (string_type_node, "method_types");
chainon (field_decl_chain, field_decl);
- finish_struct (proto_record, field_decl_chain, NULL_TREE);
+ objc_finish_struct (proto_record, field_decl_chain);
return proto_record;
}
@@ -4759,8 +4784,7 @@ build_category_template (void)
{
tree field_decl, field_decl_chain;
- objc_category_template = start_struct (RECORD_TYPE,
- get_identifier (UTAG_CATEGORY));
+ objc_category_template = objc_start_struct (get_identifier (UTAG_CATEGORY));
/* char *category_name; */
field_decl = create_field_decl (string_type_node, "category_name");
@@ -4787,7 +4811,7 @@ build_category_template (void)
"protocol_list");
chainon (field_decl_chain, field_decl);
- finish_struct (objc_category_template, field_decl_chain, NULL_TREE);
+ objc_finish_struct (objc_category_template, field_decl_chain);
}
/* struct _objc_selector {
@@ -4798,11 +4822,9 @@ build_category_template (void)
static void
build_selector_template (void)
{
-
tree field_decl, field_decl_chain;
- objc_selector_template
- = start_struct (RECORD_TYPE, get_identifier (UTAG_SELECTOR));
+ objc_selector_template = objc_start_struct (get_identifier (UTAG_SELECTOR));
/* SEL sel_id; */
field_decl = create_field_decl (objc_selector_type, "sel_id");
@@ -4812,7 +4834,7 @@ build_selector_template (void)
field_decl = create_field_decl (string_type_node, "sel_type");
chainon (field_decl_chain, field_decl);
- finish_struct (objc_selector_template, field_decl_chain, NULL_TREE);
+ objc_finish_struct (objc_selector_template, field_decl_chain);
}
/* struct _objc_class {
@@ -4848,8 +4870,7 @@ build_class_template (void)
{
tree field_decl, field_decl_chain;
- objc_class_template
- = start_struct (RECORD_TYPE, get_identifier (UTAG_CLASS));
+ objc_class_template = objc_start_struct (get_identifier (UTAG_CLASS));
/* struct _objc_class *isa; */
field_decl = create_field_decl (build_pointer_type (objc_class_template),
@@ -4942,7 +4963,7 @@ build_class_template (void)
"gc_object_type");
chainon (field_decl_chain, field_decl);
- finish_struct (objc_class_template, field_decl_chain, NULL_TREE);
+ objc_finish_struct (objc_class_template, field_decl_chain);
}
/* Generate appropriate forward declarations for an implementation. */
@@ -5043,7 +5064,7 @@ build_super_template (void)
{
tree field_decl, field_decl_chain;
- objc_super_template = start_struct (RECORD_TYPE, get_identifier (UTAG_SUPER));
+ objc_super_template = objc_start_struct (get_identifier (UTAG_SUPER));
/* struct _objc_object *self; */
field_decl = create_field_decl (objc_object_type, "self");
@@ -5054,7 +5075,7 @@ build_super_template (void)
"super_class");
chainon (field_decl_chain, field_decl);
- finish_struct (objc_super_template, field_decl_chain, NULL_TREE);
+ objc_finish_struct (objc_super_template, field_decl_chain);
}
/* struct _objc_ivar {
@@ -5070,7 +5091,7 @@ build_ivar_template (void)
tree field_decl, field_decl_chain;
objc_ivar_id = get_identifier (UTAG_IVAR);
- objc_ivar_record = start_struct (RECORD_TYPE, objc_ivar_id);
+ objc_ivar_record = objc_start_struct (objc_ivar_id);
/* char *ivar_name; */
field_decl = create_field_decl (string_type_node, "ivar_name");
@@ -5084,7 +5105,7 @@ build_ivar_template (void)
field_decl = create_field_decl (integer_type_node, "ivar_offset");
chainon (field_decl_chain, field_decl);
- finish_struct (objc_ivar_record, field_decl_chain, NULL_TREE);
+ objc_finish_struct (objc_ivar_record, field_decl_chain);
return objc_ivar_record;
}
@@ -5100,7 +5121,7 @@ build_ivar_list_template (tree list_type, int size)
tree objc_ivar_list_record;
tree field_decl, field_decl_chain;
- objc_ivar_list_record = start_struct (RECORD_TYPE, NULL_TREE);
+ objc_ivar_list_record = objc_start_struct (NULL_TREE);
/* int ivar_count; */
field_decl = create_field_decl (integer_type_node, "ivar_count");
@@ -5114,7 +5135,7 @@ build_ivar_list_template (tree list_type, int size)
"ivar_list");
chainon (field_decl_chain, field_decl);
- finish_struct (objc_ivar_list_record, field_decl_chain, NULL_TREE);
+ objc_finish_struct (objc_ivar_list_record, field_decl_chain);
return objc_ivar_list_record;
}
@@ -5131,7 +5152,7 @@ build_method_list_template (tree list_type, int size)
tree objc_ivar_list_record;
tree field_decl, field_decl_chain;
- objc_ivar_list_record = start_struct (RECORD_TYPE, NULL_TREE);
+ objc_ivar_list_record = objc_start_struct (NULL_TREE);
/* struct _objc__method_prototype_list *method_next; */
field_decl = create_field_decl (objc_method_proto_list_ptr,
@@ -5150,7 +5171,7 @@ build_method_list_template (tree list_type, int size)
"method_list");
chainon (field_decl_chain, field_decl);
- finish_struct (objc_ivar_list_record, field_decl_chain, NULL_TREE);
+ objc_finish_struct (objc_ivar_list_record, field_decl_chain);
return objc_ivar_list_record;
}
@@ -5338,7 +5359,7 @@ build_method_template (void)
tree _SLT_record;
tree field_decl, field_decl_chain;
- _SLT_record = start_struct (RECORD_TYPE, get_identifier (UTAG_METHOD));
+ _SLT_record = objc_start_struct (get_identifier (UTAG_METHOD));
/* SEL _cmd; */
field_decl = create_field_decl (objc_selector_type, "_cmd");
@@ -5353,7 +5374,7 @@ build_method_template (void)
"_imp");
chainon (field_decl_chain, field_decl);
- finish_struct (_SLT_record, field_decl_chain, NULL_TREE);
+ objc_finish_struct (_SLT_record, field_decl_chain);
return _SLT_record;
}