Commit f8893e47 by Joseph Myers Committed by Joseph Myers

c-tree.h (enum c_declarator_kind, [...]): New.

	* c-tree.h (enum c_declarator_kind, struct c_arg_info, struct
	c_declarator, struct c_type_name, struct c_parm): New.
	(build_array_declarator, set_array_declarator_inner,
	get_parm_info, grokfield, groktypename, grokparm, push_parm_decl,
	start_function, start_decl, build_c_parm, build_attrs_declarator,
	build_function_declarator, make_pointer_declarator, c_cast_expr,
	store_parm_decls_newstyle, c_expr_sizeof_type): Update prototypes.
	(build_id_declarator): New.
	* c-typeck.c (c_cast_expr, c_expr_sizeof_type): Update to new
	structures.
	* c-decl.c (ARG_INFO_PARMS, ARG_INFO_TAGS, ARG_INFO_TYPES,
	ARG_INFO_OTHERS): Remove.
	(build_id_declarator): New.
	(build_array_declarator, set_array_declarator_inner, groktypename,
	start_decl, grokparm, push_parm_decl, grokparms, get_parm_info,
	grokfield, start_function, store_parm_decls_newstyle,
	store_parm_decls_oldstyle, store_parm_decls,
	build_c_parm, build_attrs_declarator, build_function_declarator,
	make_pointer_declarator, grokdeclarator): Update to new
	structures.
	* c-parse.in (%union): Add arginfotype, dtrtype, typenametype and
	parmtype.
	(declarator, notype_declarator, after_type_declarator,
	parm_declarator, parm_declarator_starttypename,
	parm_declarator_nostarttypename, array_declarator, typename,
	absdcl, absdcl1, absdcl1_ea, absdcl1_noea, direct_absdcl1,
	absdcl_maybe_attribute, parm, firstparm, parms, parmlist,
	parmlist_1, parmlist_2, parmlist_or_identifiers,
	parmlist_or_identifiers_1): Use these types.
	(primary, after_type_declarator, parm_declarator_starttypename,
	notype_declarator, component_decl, component_declarator,
	component_notype_declarator, typename, absdcl,
	absdcl_maybe_attribute, absdcl1_ea, direct_absdcl1, parmlist_1,
	parmlist_2, parmlist_or_identifiers_1): Update to new structures.

objc:
	* objc-act.c (objc_start_function, really_start_method,
	objc_get_parm_info, start_method_def): Update to new arg_info
	structures.

From-SVN: r87217
parent bc4b653b
2004-09-09 Joseph S. Myers <jsm@polyomino.org.uk> 2004-09-09 Joseph S. Myers <jsm@polyomino.org.uk>
* c-tree.h (enum c_declarator_kind, struct c_arg_info, struct
c_declarator, struct c_type_name, struct c_parm): New.
(build_array_declarator, set_array_declarator_inner,
get_parm_info, grokfield, groktypename, grokparm, push_parm_decl,
start_function, start_decl, build_c_parm, build_attrs_declarator,
build_function_declarator, make_pointer_declarator, c_cast_expr,
store_parm_decls_newstyle, c_expr_sizeof_type): Update prototypes.
(build_id_declarator): New.
* c-typeck.c (c_cast_expr, c_expr_sizeof_type): Update to new
structures.
* c-decl.c (ARG_INFO_PARMS, ARG_INFO_TAGS, ARG_INFO_TYPES,
ARG_INFO_OTHERS): Remove.
(build_id_declarator): New.
(build_array_declarator, set_array_declarator_inner, groktypename,
start_decl, grokparm, push_parm_decl, grokparms, get_parm_info,
grokfield, start_function, store_parm_decls_newstyle,
store_parm_decls_oldstyle, store_parm_decls,
build_c_parm, build_attrs_declarator, build_function_declarator,
make_pointer_declarator, grokdeclarator): Update to new
structures.
* c-parse.in (%union): Add arginfotype, dtrtype, typenametype and
parmtype.
(declarator, notype_declarator, after_type_declarator,
parm_declarator, parm_declarator_starttypename,
parm_declarator_nostarttypename, array_declarator, typename,
absdcl, absdcl1, absdcl1_ea, absdcl1_noea, direct_absdcl1,
absdcl_maybe_attribute, parm, firstparm, parms, parmlist,
parmlist_1, parmlist_2, parmlist_or_identifiers,
parmlist_or_identifiers_1): Use these types.
(primary, after_type_declarator, parm_declarator_starttypename,
notype_declarator, component_decl, component_declarator,
component_notype_declarator, typename, absdcl,
absdcl_maybe_attribute, absdcl1_ea, direct_absdcl1, parmlist_1,
parmlist_2, parmlist_or_identifiers_1): Update to new structures.
2004-09-09 Joseph S. Myers <jsm@polyomino.org.uk>
* c-tree.h (C_DECL_USED, parser_obstack, in_alignof, in_sizeof, * c-tree.h (C_DECL_USED, parser_obstack, in_alignof, in_sizeof,
in_typeof, record_maybe_used_decl, pop_maybe_used, in_typeof, record_maybe_used_decl, pop_maybe_used,
c_expr_sizeof_expr, c_expr_sizeof_type): New. c_expr_sizeof_expr, c_expr_sizeof_type): New.
......
...@@ -100,6 +100,8 @@ do { \ ...@@ -100,6 +100,8 @@ do { \
%start program %start program
%union {long itype; tree ttype; void *otype; struct c_expr exprtype; %union {long itype; tree ttype; void *otype; struct c_expr exprtype;
struct c_arg_info *arginfotype; struct c_declarator *dtrtype;
struct c_type_name *typenametype; struct c_parm *parmtype;
enum tree_code code; location_t location; } enum tree_code code; location_t location; }
/* All identifiers that are not reserved words /* All identifiers that are not reserved words
...@@ -217,11 +219,11 @@ do { \ ...@@ -217,11 +219,11 @@ do { \
%type <ttype> c99_block_start c99_block_lineno_labeled_stmt %type <ttype> c99_block_start c99_block_lineno_labeled_stmt
%type <ttype> if_statement_1 if_statement_2 %type <ttype> if_statement_1 if_statement_2
%type <ttype> declarator %type <dtrtype> declarator
%type <ttype> notype_declarator after_type_declarator %type <dtrtype> notype_declarator after_type_declarator
%type <ttype> parm_declarator %type <dtrtype> parm_declarator
%type <ttype> parm_declarator_starttypename parm_declarator_nostarttypename %type <dtrtype> parm_declarator_starttypename parm_declarator_nostarttypename
%type <ttype> array_declarator %type <dtrtype> array_declarator
%type <ttype> structsp_attr structsp_nonattr %type <ttype> structsp_attr structsp_nonattr
%type <ttype> component_decl_list component_decl_list2 %type <ttype> component_decl_list component_decl_list2
...@@ -229,13 +231,15 @@ do { \ ...@@ -229,13 +231,15 @@ do { \
%type <ttype> component_notype_declarator %type <ttype> component_notype_declarator
%type <ttype> enumlist enumerator %type <ttype> enumlist enumerator
%type <ttype> struct_head union_head enum_head %type <ttype> struct_head union_head enum_head
%type <ttype> typename absdcl absdcl1 absdcl1_ea absdcl1_noea %type <typenametype> typename
%type <ttype> direct_absdcl1 absdcl_maybe_attribute %type <dtrtype> absdcl absdcl1 absdcl1_ea absdcl1_noea direct_absdcl1
%type <parmtype> absdcl_maybe_attribute
%type <ttype> condition xexpr for_cond_expr for_incr_expr %type <ttype> condition xexpr for_cond_expr for_incr_expr
%type <ttype> parms parm firstparm identifiers %type <parmtype> parm firstparm
%type <ttype> identifiers
%type <ttype> parmlist parmlist_1 parmlist_2 %type <arginfotype> parms parmlist parmlist_1 parmlist_2
%type <ttype> parmlist_or_identifiers parmlist_or_identifiers_1 %type <arginfotype> parmlist_or_identifiers parmlist_or_identifiers_1
%type <ttype> identifiers_or_typenames %type <ttype> identifiers_or_typenames
%type <itype> setspecs setspecs_fp extension %type <itype> setspecs setspecs_fp extension
...@@ -655,12 +659,12 @@ primary: ...@@ -655,12 +659,12 @@ primary:
$$.original_code = ERROR_MARK; } $$.original_code = ERROR_MARK; }
| '(' typename ')' '{' | '(' typename ')' '{'
{ start_init (NULL_TREE, NULL, 0); { start_init (NULL_TREE, NULL, 0);
$2 = groktypename ($2); $<ttype>$ = groktypename ($2);
really_start_incremental_init ($2); } really_start_incremental_init ($<ttype>$); }
initlist_maybe_comma '}' %prec UNARY initlist_maybe_comma '}' %prec UNARY
{ struct c_expr init = pop_init_level (0); { struct c_expr init = pop_init_level (0);
tree constructor = init.value; tree constructor = init.value;
tree type = $2; tree type = $<ttype>5;
finish_init (); finish_init ();
maybe_warn_string_init (type, init); maybe_warn_string_init (type, init);
...@@ -1653,8 +1657,10 @@ after_type_declarator: ...@@ -1653,8 +1657,10 @@ after_type_declarator:
| '*' maybe_type_quals_attrs after_type_declarator %prec UNARY | '*' maybe_type_quals_attrs after_type_declarator %prec UNARY
{ $$ = make_pointer_declarator ($2, $3); } { $$ = make_pointer_declarator ($2, $3); }
| TYPENAME | TYPENAME
{ $$ = build_id_declarator ($1); }
@@ifobjc @@ifobjc
| OBJECTNAME | OBJECTNAME
{ $$ = build_id_declarator ($1); }
@@end_ifobjc @@end_ifobjc
; ;
...@@ -1673,8 +1679,10 @@ parm_declarator_starttypename: ...@@ -1673,8 +1679,10 @@ parm_declarator_starttypename:
| parm_declarator_starttypename array_declarator %prec '.' | parm_declarator_starttypename array_declarator %prec '.'
{ $$ = set_array_declarator_inner ($2, $1, false); } { $$ = set_array_declarator_inner ($2, $1, false); }
| TYPENAME | TYPENAME
{ $$ = build_id_declarator ($1); }
@@ifobjc @@ifobjc
| OBJECTNAME | OBJECTNAME
{ $$ = build_id_declarator ($1); }
@@end_ifobjc @@end_ifobjc
; ;
...@@ -1704,6 +1712,7 @@ notype_declarator: ...@@ -1704,6 +1712,7 @@ notype_declarator:
| notype_declarator array_declarator %prec '.' | notype_declarator array_declarator %prec '.'
{ $$ = set_array_declarator_inner ($2, $1, false); } { $$ = set_array_declarator_inner ($2, $1, false); }
| IDENTIFIER | IDENTIFIER
{ $$ = build_id_declarator ($1); }
; ;
struct_head: struct_head:
...@@ -1837,7 +1846,8 @@ component_decl: ...@@ -1837,7 +1846,8 @@ component_decl:
if (pedantic) if (pedantic)
pedwarn ("ISO C doesn't support unnamed structs/unions"); pedwarn ("ISO C doesn't support unnamed structs/unions");
$$ = grokfield(NULL, current_declspecs, NULL_TREE); $$ = grokfield (build_id_declarator (NULL_TREE),
current_declspecs, NULL_TREE);
POP_DECLSPEC_STACK; } POP_DECLSPEC_STACK; }
| declspecs_nosc_nots setspecs components_notype | declspecs_nosc_nots setspecs components_notype
{ $$ = $3; { $$ = $3;
...@@ -1876,7 +1886,8 @@ component_declarator: ...@@ -1876,7 +1886,8 @@ component_declarator:
decl_attributes (&$$, decl_attributes (&$$,
chainon ($4, all_prefix_attributes), 0); } chainon ($4, all_prefix_attributes), 0); }
| ':' expr_no_commas maybe_attribute | ':' expr_no_commas maybe_attribute
{ $$ = grokfield (NULL_TREE, current_declspecs, $2.value); { $$ = grokfield (build_id_declarator (NULL_TREE),
current_declspecs, $2.value);
decl_attributes (&$$, decl_attributes (&$$,
chainon ($3, all_prefix_attributes), 0); } chainon ($3, all_prefix_attributes), 0); }
; ;
...@@ -1891,7 +1902,8 @@ component_notype_declarator: ...@@ -1891,7 +1902,8 @@ component_notype_declarator:
decl_attributes (&$$, decl_attributes (&$$,
chainon ($4, all_prefix_attributes), 0); } chainon ($4, all_prefix_attributes), 0); }
| ':' expr_no_commas maybe_attribute | ':' expr_no_commas maybe_attribute
{ $$ = grokfield (NULL_TREE, current_declspecs, $2.value); { $$ = grokfield (build_id_declarator (NULL_TREE),
current_declspecs, $2.value);
decl_attributes (&$$, decl_attributes (&$$,
chainon ($3, all_prefix_attributes), 0); } chainon ($3, all_prefix_attributes), 0); }
; ;
...@@ -1923,19 +1935,21 @@ typename: ...@@ -1923,19 +1935,21 @@ typename:
{ pending_xref_error (); { pending_xref_error ();
$<ttype>$ = $1; } $<ttype>$ = $1; }
absdcl absdcl
{ $$ = build_tree_list ($<ttype>2, $3); } { $$ = XOBNEW (&parser_obstack, struct c_type_name);
$$->specs = $<ttype>2;
$$->declarator = $3; }
; ;
absdcl: /* an absolute declarator */ absdcl: /* an absolute declarator */
/* empty */ /* empty */
{ $$ = NULL_TREE; } { $$ = build_id_declarator (NULL_TREE); }
| absdcl1 | absdcl1
; ;
absdcl_maybe_attribute: /* absdcl maybe_attribute, but not just attributes */ absdcl_maybe_attribute: /* absdcl maybe_attribute, but not just attributes */
/* empty */ /* empty */
{ $$ = build_c_parm (current_declspecs, all_prefix_attributes, { $$ = build_c_parm (current_declspecs, all_prefix_attributes,
NULL_TREE); } build_id_declarator (NULL_TREE)); }
| absdcl1 | absdcl1
{ $$ = build_c_parm (current_declspecs, all_prefix_attributes, { $$ = build_c_parm (current_declspecs, all_prefix_attributes,
$1); } $1); }
...@@ -1958,7 +1972,8 @@ absdcl1_noea: ...@@ -1958,7 +1972,8 @@ absdcl1_noea:
absdcl1_ea: absdcl1_ea:
'*' maybe_type_quals_attrs '*' maybe_type_quals_attrs
{ $$ = make_pointer_declarator ($2, NULL_TREE); } { $$ = make_pointer_declarator
($2, build_id_declarator (NULL_TREE)); }
| '*' maybe_type_quals_attrs absdcl1_ea | '*' maybe_type_quals_attrs absdcl1_ea
{ $$ = make_pointer_declarator ($2, $3); } { $$ = make_pointer_declarator ($2, $3); }
; ;
...@@ -1971,9 +1986,11 @@ direct_absdcl1: ...@@ -1971,9 +1986,11 @@ direct_absdcl1:
| direct_absdcl1 array_declarator | direct_absdcl1 array_declarator
{ $$ = set_array_declarator_inner ($2, $1, true); } { $$ = set_array_declarator_inner ($2, $1, true); }
| '(' parmlist | '(' parmlist
{ $$ = build_function_declarator ($2, NULL_TREE); } { $$ = build_function_declarator
($2, build_id_declarator (NULL_TREE)); }
| array_declarator | array_declarator
{ $$ = set_array_declarator_inner ($1, NULL_TREE, true); } { $$ = set_array_declarator_inner
($1, build_id_declarator (NULL_TREE), true); }
; ;
/* The [...] part of a declarator for an array type. */ /* The [...] part of a declarator for an array type. */
...@@ -2519,17 +2536,28 @@ parmlist_1: ...@@ -2519,17 +2536,28 @@ parmlist_1:
parmlist_1 parmlist_1
{ $$ = $6; } { $$ = $6; }
| error ')' | error ')'
{ $$ = make_node (TREE_LIST); } { $$ = XOBNEW (&parser_obstack, struct c_arg_info);
$$->parms = 0;
$$->tags = 0;
$$->types = 0;
$$->others = 0; }
; ;
/* This is what appears inside the parens in a function declarator. /* This is what appears inside the parens in a function declarator.
Is value is represented in the format that grokdeclarator expects. */ Its value is represented in the format that grokdeclarator expects. */
parmlist_2: /* empty */ parmlist_2: /* empty */
{ $$ = make_node (TREE_LIST); } { $$ = XOBNEW (&parser_obstack, struct c_arg_info);
$$->parms = 0;
$$->tags = 0;
$$->types = 0;
$$->others = 0; }
| ELLIPSIS | ELLIPSIS
{ $$ = make_node (TREE_LIST); { $$ = XOBNEW (&parser_obstack, struct c_arg_info);
$$->parms = 0;
$$->tags = 0;
$$->others = 0;
/* Suppress -Wold-style-definition for this case. */ /* Suppress -Wold-style-definition for this case. */
TREE_CHAIN ($$) = error_mark_node; $$->types = error_mark_node;
error ("ISO C requires a named argument before `...'"); error ("ISO C requires a named argument before `...'");
} }
| parms | parms
...@@ -2614,7 +2642,11 @@ parmlist_or_identifiers: ...@@ -2614,7 +2642,11 @@ parmlist_or_identifiers:
parmlist_or_identifiers_1: parmlist_or_identifiers_1:
parmlist_1 parmlist_1
| identifiers ')' | identifiers ')'
{ $$ = tree_cons (NULL_TREE, NULL_TREE, $1); { $$ = XOBNEW (&parser_obstack, struct c_arg_info);
$$->parms = 0;
$$->tags = 0;
$$->types = $1;
$$->others = 0;
/* Make sure we have a parmlist after attributes. */ /* Make sure we have a parmlist after attributes. */
if ($<ttype>-1 != 0) if ($<ttype>-1 != 0)
......
...@@ -131,6 +131,81 @@ struct c_expr ...@@ -131,6 +131,81 @@ struct c_expr
enum tree_code original_code; enum tree_code original_code;
}; };
/* The various kinds of declarators in C. */
enum c_declarator_kind {
/* An identifier. */
cdk_id,
/* A function. */
cdk_function,
/* An array. */
cdk_array,
/* A pointer. */
cdk_pointer,
/* Parenthesized declarator with nested attributes. */
cdk_attrs
};
/* Information about the parameters in a function declarator. */
struct c_arg_info {
/* A list of parameter decls. */
tree parms;
/* A list of structure, union and enum tags defined. */
tree tags;
/* A list of argument types to go in the FUNCTION_TYPE. */
tree types;
/* A list of non-parameter decls (notably enumeration constants)
defined with the parameters. */
tree others;
};
/* A declarator. */
struct c_declarator {
/* The kind of declarator. */
enum c_declarator_kind kind;
/* Except for cdk_id, the contained declarator. For cdk_id, NULL. */
struct c_declarator *declarator;
union {
/* For identifiers, an IDENTIFIER_NODE or NULL_TREE if an abstract
declarator. */
tree id;
/* For functions. */
struct c_arg_info *arg_info;
/* For arrays. */
struct {
/* The array dimension, or NULL for [] and [*]. */
tree dimen;
/* The qualifiers (and attributes, currently ignored) inside []. */
tree quals;
/* Whether [static] was used. */
BOOL_BITFIELD static_p : 1;
/* Whether [*] was used. */
BOOL_BITFIELD vla_unspec_p : 1;
} array;
/* For pointers, the qualifiers on the pointer type. */
tree pointer_quals;
/* For attributes. */
tree attrs;
} u;
};
/* A type name. */
struct c_type_name {
/* The declaration specifiers. */
tree specs;
/* The declarator. */
struct c_declarator *declarator;
};
/* A parameter. */
struct c_parm {
/* The declaration specifiers, minus any prefix attributes. */
tree specs;
/* The attributes. */
tree attrs;
/* The declarator. */
struct c_declarator *declarator;
};
/* Save and restore the variables in this file and elsewhere /* Save and restore the variables in this file and elsewhere
that keep track of the progress of compilation of the current function. that keep track of the progress of compilation of the current function.
Used for nested functions. */ Used for nested functions. */
...@@ -141,7 +216,7 @@ struct language_function GTY(()) ...@@ -141,7 +216,7 @@ struct language_function GTY(())
tree x_break_label; tree x_break_label;
tree x_cont_label; tree x_cont_label;
struct c_switch * GTY((skip)) x_switch_stack; struct c_switch * GTY((skip)) x_switch_stack;
tree arg_info; struct c_arg_info * GTY((skip)) arg_info;
int returns_value; int returns_value;
int returns_null; int returns_null;
int returns_abnormally; int returns_abnormally;
...@@ -171,7 +246,7 @@ extern void c_expand_body (tree); ...@@ -171,7 +246,7 @@ extern void c_expand_body (tree);
extern void c_init_decl_processing (void); extern void c_init_decl_processing (void);
extern void c_dup_lang_specific_decl (tree); extern void c_dup_lang_specific_decl (tree);
extern void c_print_identifier (FILE *, tree, int); extern void c_print_identifier (FILE *, tree, int);
extern tree build_array_declarator (tree, tree, bool, bool); extern struct c_declarator *build_array_declarator (tree, tree, bool, bool);
extern tree build_enumerator (tree, tree); extern tree build_enumerator (tree, tree);
extern void check_for_loop_decls (void); extern void check_for_loop_decls (void);
extern void mark_forward_parm_decls (void); extern void mark_forward_parm_decls (void);
...@@ -184,36 +259,42 @@ extern void finish_decl (tree, tree, tree); ...@@ -184,36 +259,42 @@ extern void finish_decl (tree, tree, tree);
extern tree finish_enum (tree, tree, tree); extern tree finish_enum (tree, tree, tree);
extern void finish_function (void); extern void finish_function (void);
extern tree finish_struct (tree, tree, tree); extern tree finish_struct (tree, tree, tree);
extern tree get_parm_info (bool); extern struct c_arg_info *get_parm_info (bool);
extern tree grokfield (tree, tree, tree); extern tree grokfield (struct c_declarator *, tree, tree);
extern void split_specs_attrs (tree, tree *, tree *); extern void split_specs_attrs (tree, tree *, tree *);
extern tree groktypename (tree); extern tree groktypename (struct c_type_name *);
extern tree grokparm (tree); extern tree grokparm (const struct c_parm *);
extern tree implicitly_declare (tree); extern tree implicitly_declare (tree);
extern void keep_next_level (void); extern void keep_next_level (void);
extern tree lookup_name (tree); extern tree lookup_name (tree);
extern void pending_xref_error (void); extern void pending_xref_error (void);
extern void c_push_function_context (struct function *); extern void c_push_function_context (struct function *);
extern void c_pop_function_context (struct function *); extern void c_pop_function_context (struct function *);
extern void push_parm_decl (tree); extern void push_parm_decl (const struct c_parm *);
extern tree pushdecl_top_level (tree); extern tree pushdecl_top_level (tree);
extern tree set_array_declarator_inner (tree, tree, bool); extern struct c_declarator *set_array_declarator_inner (struct c_declarator *,
struct c_declarator *,
bool);
extern tree builtin_function (const char *, tree, int, enum built_in_class, extern tree builtin_function (const char *, tree, int, enum built_in_class,
const char *, tree); const char *, tree);
extern void shadow_tag (tree); extern void shadow_tag (tree);
extern void shadow_tag_warned (tree, int); extern void shadow_tag_warned (tree, int);
extern tree start_enum (tree); extern tree start_enum (tree);
extern int start_function (tree, tree, tree); extern int start_function (tree, struct c_declarator *, tree);
extern tree start_decl (tree, tree, bool, tree); extern tree start_decl (struct c_declarator *, tree, bool, tree);
extern tree start_struct (enum tree_code, tree); extern tree start_struct (enum tree_code, tree);
extern void store_parm_decls (void); extern void store_parm_decls (void);
extern void store_parm_decls_from (tree); extern void store_parm_decls_from (struct c_arg_info *);
extern tree xref_tag (enum tree_code, tree); extern tree xref_tag (enum tree_code, tree);
extern int c_expand_decl (tree); extern int c_expand_decl (tree);
extern tree build_c_parm (tree, tree, tree); extern struct c_parm *build_c_parm (tree, tree, struct c_declarator *);
extern tree build_attrs_declarator (tree, tree); extern struct c_declarator *build_attrs_declarator (tree,
extern tree build_function_declarator (tree, tree); struct c_declarator *);
extern tree make_pointer_declarator (tree, tree); extern struct c_declarator *build_function_declarator (struct c_arg_info *,
struct c_declarator *);
extern struct c_declarator *build_id_declarator (tree);
extern struct c_declarator *make_pointer_declarator (tree,
struct c_declarator *);
/* in c-objc-common.c */ /* in c-objc-common.c */
extern int c_disregard_inline_limits (tree); extern int c_disregard_inline_limits (tree);
...@@ -252,13 +333,13 @@ extern tree build_external_ref (tree, int); ...@@ -252,13 +333,13 @@ extern tree build_external_ref (tree, int);
extern void record_maybe_used_decl (tree); extern void record_maybe_used_decl (tree);
extern void pop_maybe_used (bool); extern void pop_maybe_used (bool);
extern struct c_expr c_expr_sizeof_expr (struct c_expr); extern struct c_expr c_expr_sizeof_expr (struct c_expr);
extern struct c_expr c_expr_sizeof_type (tree); extern struct c_expr c_expr_sizeof_type (struct c_type_name *);
extern struct c_expr parser_build_binary_op (enum tree_code, struct c_expr, extern struct c_expr parser_build_binary_op (enum tree_code, struct c_expr,
struct c_expr); struct c_expr);
extern void readonly_error (tree, const char *); extern void readonly_error (tree, const char *);
extern tree build_conditional_expr (tree, tree, tree); extern tree build_conditional_expr (tree, tree, tree);
extern tree build_compound_expr (tree, tree); extern tree build_compound_expr (tree, tree);
extern tree c_cast_expr (tree, tree); extern tree c_cast_expr (struct c_type_name *, tree);
extern tree build_c_cast (tree, tree); extern tree build_c_cast (tree, tree);
extern tree build_modify_expr (tree, enum tree_code, tree); extern tree build_modify_expr (tree, enum tree_code, tree);
extern void store_init_value (tree, tree); extern void store_init_value (tree, tree);
......
...@@ -1859,7 +1859,7 @@ c_expr_sizeof_expr (struct c_expr expr) ...@@ -1859,7 +1859,7 @@ c_expr_sizeof_expr (struct c_expr expr)
name passed to sizeof (rather than the type itself). */ name passed to sizeof (rather than the type itself). */
struct c_expr struct c_expr
c_expr_sizeof_type (tree t) c_expr_sizeof_type (struct c_type_name *t)
{ {
tree type; tree type;
struct c_expr ret; struct c_expr ret;
...@@ -3217,15 +3217,16 @@ build_c_cast (tree type, tree expr) ...@@ -3217,15 +3217,16 @@ build_c_cast (tree type, tree expr)
/* Interpret a cast of expression EXPR to type TYPE. */ /* Interpret a cast of expression EXPR to type TYPE. */
tree tree
c_cast_expr (tree type, tree expr) c_cast_expr (struct c_type_name *type_name, tree expr)
{ {
tree type;
int saved_wsp = warn_strict_prototypes; int saved_wsp = warn_strict_prototypes;
/* This avoids warnings about unprototyped casts on /* This avoids warnings about unprototyped casts on
integers. E.g. "#define SIG_DFL (void(*)())0". */ integers. E.g. "#define SIG_DFL (void(*)())0". */
if (TREE_CODE (expr) == INTEGER_CST) if (TREE_CODE (expr) == INTEGER_CST)
warn_strict_prototypes = 0; warn_strict_prototypes = 0;
type = groktypename (type); type = groktypename (type_name);
warn_strict_prototypes = saved_wsp; warn_strict_prototypes = saved_wsp;
return build_c_cast (type, expr); return build_c_cast (type, expr);
......
2004-09-09 Joseph S. Myers <jsm@polyomino.org.uk>
* objc-act.c (objc_start_function, really_start_method,
objc_get_parm_info, start_method_def): Update to new arg_info
structures.
2004-09-07 Ziemowit Laski <zlaski@apple.com> 2004-09-07 Ziemowit Laski <zlaski@apple.com>
* Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of
......
...@@ -156,7 +156,11 @@ static tree start_class (enum tree_code, tree, tree, tree); ...@@ -156,7 +156,11 @@ static tree start_class (enum tree_code, tree, tree, tree);
static tree continue_class (tree); static tree continue_class (tree);
static void finish_class (tree); static void finish_class (tree);
static void start_method_def (tree); static void start_method_def (tree);
#ifdef OBJCPLUS
static void objc_start_function (tree, tree, tree, tree); static void objc_start_function (tree, tree, tree, tree);
#else
static void objc_start_function (tree, tree, tree, struct c_arg_info *);
#endif
static tree start_protocol (enum tree_code, tree, tree); static tree start_protocol (enum tree_code, tree, tree);
static tree build_method_decl (enum tree_code, tree, tree, tree); static tree build_method_decl (enum tree_code, tree, tree, tree);
static tree objc_add_method (tree, tree, int); static tree objc_add_method (tree, tree, int);
...@@ -244,12 +248,20 @@ static void encode_gnu_bitfield (int, tree, int); ...@@ -244,12 +248,20 @@ static void encode_gnu_bitfield (int, tree, int);
static void encode_type (tree, int, int); static void encode_type (tree, int, int);
static void encode_field_decl (tree, int, int); static void encode_field_decl (tree, int, int);
#ifdef OBJCPLUS
static void really_start_method (tree, tree); static void really_start_method (tree, tree);
#else
static void really_start_method (tree, struct c_arg_info *);
#endif
static int objc_types_are_equivalent (tree, tree); static int objc_types_are_equivalent (tree, tree);
static int comp_proto_with_proto (tree, tree); static int comp_proto_with_proto (tree, tree);
static tree get_arg_type_list (tree, int, int); static tree get_arg_type_list (tree, int, int);
static void objc_push_parm (tree); static void objc_push_parm (tree);
#ifdef OBJCPLUS
static tree objc_get_parm_info (int); static tree objc_get_parm_info (int);
#else
static struct c_arg_info *objc_get_parm_info (int);
#endif
static void synth_self_and_ucmd_args (void); static void synth_self_and_ucmd_args (void);
/* Utilities for debugging and error diagnostics. */ /* Utilities for debugging and error diagnostics. */
...@@ -7338,16 +7350,22 @@ objc_push_parm (tree parm) ...@@ -7338,16 +7350,22 @@ objc_push_parm (tree parm)
/* Retrieve the formal paramter list constructed via preceding calls to /* Retrieve the formal paramter list constructed via preceding calls to
objc_push_parm(). */ objc_push_parm(). */
static tree
#ifdef OBJCPLUS #ifdef OBJCPLUS
static tree
objc_get_parm_info (int have_ellipsis ATTRIBUTE_UNUSED) objc_get_parm_info (int have_ellipsis ATTRIBUTE_UNUSED)
#else #else
static struct c_arg_info *
objc_get_parm_info (int have_ellipsis) objc_get_parm_info (int have_ellipsis)
#endif #endif
{ {
#ifdef OBJCPLUS
tree parm_info = objc_parmlist; tree parm_info = objc_parmlist;
objc_parmlist = NULL_TREE;
#ifndef OBJCPLUS return parm_info;
#else
tree parm_info = objc_parmlist;
struct c_arg_info *arg_info;
/* The C front-end requires an elaborate song and dance at /* The C front-end requires an elaborate song and dance at
this point. */ this point. */
push_scope (); push_scope ();
...@@ -7360,12 +7378,11 @@ objc_get_parm_info (int have_ellipsis) ...@@ -7360,12 +7378,11 @@ objc_get_parm_info (int have_ellipsis)
pushdecl (parm_info); pushdecl (parm_info);
parm_info = next; parm_info = next;
} }
parm_info = get_parm_info (have_ellipsis); arg_info = get_parm_info (have_ellipsis);
pop_scope (); pop_scope ();
#endif
objc_parmlist = NULL_TREE; objc_parmlist = NULL_TREE;
return arg_info;
return parm_info; #endif
} }
/* Synthesize the formal parameters 'id self' and 'SEL _cmd' needed for ObjC /* Synthesize the formal parameters 'id self' and 'SEL _cmd' needed for ObjC
...@@ -7400,6 +7417,11 @@ static void ...@@ -7400,6 +7417,11 @@ static void
start_method_def (tree method) start_method_def (tree method)
{ {
tree parmlist; tree parmlist;
#ifdef OBJCPLUS
tree parm_info;
#else
struct c_arg_info *parm_info;
#endif
int have_ellipsis = 0; int have_ellipsis = 0;
/* Required to implement _msgSuper. */ /* Required to implement _msgSuper. */
...@@ -7434,9 +7456,9 @@ start_method_def (tree method) ...@@ -7434,9 +7456,9 @@ start_method_def (tree method)
have_ellipsis = 1; have_ellipsis = 1;
} }
parmlist = objc_get_parm_info (have_ellipsis); parm_info = objc_get_parm_info (have_ellipsis);
really_start_method (objc_method_context, parmlist); really_start_method (objc_method_context, parm_info);
} }
static void static void
...@@ -7509,11 +7531,19 @@ comp_proto_with_proto (tree proto1, tree proto2) ...@@ -7509,11 +7531,19 @@ comp_proto_with_proto (tree proto1, tree proto2)
} }
static void static void
objc_start_function (tree name, tree type, tree attrs, tree params) objc_start_function (tree name, tree type, tree attrs,
#ifdef OBJCPLUS
tree params
#else
struct c_arg_info *params
#endif
)
{ {
tree fndecl = build_decl (FUNCTION_DECL, name, type); tree fndecl = build_decl (FUNCTION_DECL, name, type);
#ifdef OBJCPLUS
DECL_ARGUMENTS (fndecl) = params; DECL_ARGUMENTS (fndecl) = params;
#endif
DECL_INITIAL (fndecl) = error_mark_node; DECL_INITIAL (fndecl) = error_mark_node;
DECL_EXTERNAL (fndecl) = 0; DECL_EXTERNAL (fndecl) = 0;
TREE_STATIC (fndecl) = 1; TREE_STATIC (fndecl) = 1;
...@@ -7532,7 +7562,7 @@ objc_start_function (tree name, tree type, tree attrs, tree params) ...@@ -7532,7 +7562,7 @@ objc_start_function (tree name, tree type, tree attrs, tree params)
= build_decl (RESULT_DECL, NULL_TREE, = build_decl (RESULT_DECL, NULL_TREE,
TREE_TYPE (TREE_TYPE (current_function_decl))); TREE_TYPE (TREE_TYPE (current_function_decl)));
start_fname_decls (); start_fname_decls ();
store_parm_decls_from (DECL_ARGUMENTS (current_function_decl)); store_parm_decls_from (params);
#endif #endif
TREE_USED (current_function_decl) = 1; TREE_USED (current_function_decl) = 1;
...@@ -7545,7 +7575,13 @@ objc_start_function (tree name, tree type, tree attrs, tree params) ...@@ -7545,7 +7575,13 @@ objc_start_function (tree name, tree type, tree attrs, tree params)
- If we have a prototype, check for type consistency. */ - If we have a prototype, check for type consistency. */
static void static void
really_start_method (tree method, tree parmlist) really_start_method (tree method,
#ifdef OBJCPLUS
tree parmlist
#else
struct c_arg_info *parmlist
#endif
)
{ {
tree ret_type, meth_type; tree ret_type, meth_type;
tree method_id; tree method_id;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment