c-common.h (objc_build_method_signature): Update prototype.

* c-common.h (objc_build_method_signature): Update prototype.
	* stub-objc.c (objc_build_method_signature): Update the stub
	implementation to accept and ignore additional parameter.
	* c-parser.c (c_parser_objc_method_decl): Reorgnize to pass
	the value of ellipsis to objc_build_method_signature instead
	of setting TREE_OVERFLOW on the parms TREE_LIST node.

	* objc-act.h (METHOD_ADD_ARGS_ELLIPSIS_P): New macro for accessing
	this field of an objc method decl.
	* objc-act.c (build_method_decl): Take an additional "ellipsis"
	argument, and set METHOD_ADD_ARGS_ELLIPSIS_P as appropriate.
	(objc_build_method_signature): Accept additional "ellipsis"
	argument and pass it to build_method_decl.
	(get_arg_type_list, start_method_def, gen_method_decl): Use
	the new METHOD_ADD_ARGS_ELLIPSIS_P instead of examining the
	TREE_OVERFLOW field of a TREE_LIST node.

From-SVN: r98528
This commit is contained in:
Roger Sayle 2005-04-21 21:31:40 +00:00 committed by Roger Sayle
parent 915167f5a5
commit dbb743654f
7 changed files with 38 additions and 13 deletions

View File

@ -1,3 +1,12 @@
2005-04-21 Roger Sayle <roger@eyesopen.com>
* c-common.h (objc_build_method_signature): Update prototype.
* stub-objc.c (objc_build_method_signature): Update the stub
implementation to accept and ignore additional parameter.
* c-parser.c (c_parser_objc_method_decl): Reorgnize to pass
the value of ellipsis to objc_build_method_signature instead
of setting TREE_OVERFLOW on the parms TREE_LIST node.
2005-04-21 Geoffrey Keating <geoffk@apple.com> 2005-04-21 Geoffrey Keating <geoffk@apple.com>
* config/rs6000/rs6000-protos.h (rs6000_emit_sync): New. * config/rs6000/rs6000-protos.h (rs6000_emit_sync): New.

View File

@ -912,7 +912,7 @@ extern void objc_continue_implementation (void);
extern void objc_finish_implementation (void); extern void objc_finish_implementation (void);
extern void objc_set_visibility (int); extern void objc_set_visibility (int);
extern void objc_set_method_type (enum tree_code); extern void objc_set_method_type (enum tree_code);
extern tree objc_build_method_signature (tree, tree, tree); extern tree objc_build_method_signature (tree, tree, tree, bool);
extern void objc_add_method_declaration (tree); extern void objc_add_method_declaration (tree);
extern void objc_start_method_definition (tree); extern void objc_start_method_definition (tree);
extern void objc_finish_method_definition (tree); extern void objc_finish_method_definition (tree);

View File

@ -5790,6 +5790,8 @@ c_parser_objc_method_decl (c_parser *parser)
tree type = NULL_TREE; tree type = NULL_TREE;
tree sel; tree sel;
tree parms = NULL_TREE; tree parms = NULL_TREE;
bool ellipsis = false;
if (c_parser_next_token_is (parser, CPP_OPEN_PAREN)) if (c_parser_next_token_is (parser, CPP_OPEN_PAREN))
{ {
c_parser_consume_token (parser); c_parser_consume_token (parser);
@ -5804,7 +5806,6 @@ c_parser_objc_method_decl (c_parser *parser)
{ {
tree tsel = sel; tree tsel = sel;
tree list = NULL_TREE; tree list = NULL_TREE;
bool ellipsis;
while (true) while (true)
{ {
tree atype = NULL_TREE, id, keyworddecl; tree atype = NULL_TREE, id, keyworddecl;
@ -5834,7 +5835,6 @@ c_parser_objc_method_decl (c_parser *parser)
method parameters follow the C syntax, and may include '...' method parameters follow the C syntax, and may include '...'
to denote a variable number of arguments. */ to denote a variable number of arguments. */
parms = make_node (TREE_LIST); parms = make_node (TREE_LIST);
ellipsis = false;
while (c_parser_next_token_is (parser, CPP_COMMA)) while (c_parser_next_token_is (parser, CPP_COMMA))
{ {
struct c_parm *parm; struct c_parm *parm;
@ -5851,10 +5851,9 @@ c_parser_objc_method_decl (c_parser *parser)
parms = chainon (parms, parms = chainon (parms,
build_tree_list (NULL_TREE, grokparm (parm))); build_tree_list (NULL_TREE, grokparm (parm)));
} }
TREE_OVERFLOW (parms) = ellipsis;
sel = list; sel = list;
} }
return objc_build_method_signature (type, sel, parms); return objc_build_method_signature (type, sel, parms, ellipsis);
} }
/* Parse an objc-type-name. /* Parse an objc-type-name.

View File

@ -1,3 +1,15 @@
2005-04-21 Roger Sayle <roger@eyesopen.com>
* objc-act.h (METHOD_ADD_ARGS_ELLIPSIS_P): New macro for accessing
this field of an objc method decl.
* objc-act.c (build_method_decl): Take an additional "ellipsis"
argument, and set METHOD_ADD_ARGS_ELLIPSIS_P as appropriate.
(objc_build_method_signature): Accept additional "ellipsis"
argument and pass it to build_method_decl.
(get_arg_type_list, start_method_def, gen_method_decl): Use
the new METHOD_ADD_ARGS_ELLIPSIS_P instead of examining the
TREE_OVERFLOW field of a TREE_LIST node.
2005-04-20 Joseph S. Myers <joseph@codesourcery.com> 2005-04-20 Joseph S. Myers <joseph@codesourcery.com>
PR c/12913 PR c/12913

View File

@ -164,7 +164,7 @@ static void objc_start_function (tree, tree, tree, tree);
static void objc_start_function (tree, tree, tree, struct c_arg_info *); static void objc_start_function (tree, tree, tree, struct c_arg_info *);
#endif #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, bool);
static tree objc_add_method (tree, tree, int); static tree objc_add_method (tree, tree, int);
static tree add_instance_variable (tree, int, tree); static tree add_instance_variable (tree, int, tree);
static tree build_ivar_reference (tree); static tree build_ivar_reference (tree);
@ -771,9 +771,11 @@ objc_set_method_type (enum tree_code type)
} }
tree tree
objc_build_method_signature (tree rettype, tree selector, tree optparms) objc_build_method_signature (tree rettype, tree selector,
tree optparms, bool ellipsis)
{ {
return build_method_decl (objc_inherit_code, rettype, selector, optparms); return build_method_decl (objc_inherit_code, rettype, selector,
optparms, ellipsis);
} }
void void
@ -5263,7 +5265,7 @@ build_keyword_selector (tree selector)
static tree static tree
build_method_decl (enum tree_code code, tree ret_type, tree selector, build_method_decl (enum tree_code code, tree ret_type, tree selector,
tree add_args) tree add_args, bool ellipsis)
{ {
tree method_decl; tree method_decl;
@ -5280,6 +5282,7 @@ build_method_decl (enum tree_code code, tree ret_type, tree selector,
METHOD_SEL_NAME (method_decl) = build_keyword_selector (selector); METHOD_SEL_NAME (method_decl) = build_keyword_selector (selector);
METHOD_SEL_ARGS (method_decl) = selector; METHOD_SEL_ARGS (method_decl) = selector;
METHOD_ADD_ARGS (method_decl) = add_args; METHOD_ADD_ARGS (method_decl) = add_args;
METHOD_ADD_ARGS_ELLIPSIS_P (method_decl) = ellipsis;
} }
else else
{ {
@ -5347,7 +5350,7 @@ get_arg_type_list (tree meth, int context, int superflag)
chainon (arglist, build_tree_list (NULL_TREE, arg_type)); chainon (arglist, build_tree_list (NULL_TREE, arg_type));
} }
if (!TREE_OVERFLOW (METHOD_ADD_ARGS (meth))) if (!METHOD_ADD_ARGS_ELLIPSIS_P (meth))
goto lack_of_ellipsis; goto lack_of_ellipsis;
} }
else else
@ -7536,7 +7539,7 @@ start_method_def (tree method)
objc_push_parm (TREE_VALUE (akey)); objc_push_parm (TREE_VALUE (akey));
} }
if (TREE_OVERFLOW (METHOD_ADD_ARGS (method))) if (METHOD_ADD_ARGS_ELLIPSIS_P (method))
have_ellipsis = 1; have_ellipsis = 1;
} }
@ -8116,7 +8119,7 @@ gen_method_decl (tree method)
chain = TREE_CHAIN (chain); chain = TREE_CHAIN (chain);
} }
if (TREE_OVERFLOW (METHOD_ADD_ARGS (method))) if (METHOD_ADD_ARGS_ELLIPSIS_P (method))
strcat (errbuf, ", ..."); strcat (errbuf, ", ...");
} }
} }

View File

@ -52,6 +52,7 @@ enum gimplify_status objc_gimplify_expr (tree *, tree *, tree *);
#define METHOD_SEL_NAME(DECL) ((DECL)->decl.name) #define METHOD_SEL_NAME(DECL) ((DECL)->decl.name)
#define METHOD_SEL_ARGS(DECL) ((DECL)->decl.arguments) #define METHOD_SEL_ARGS(DECL) ((DECL)->decl.arguments)
#define METHOD_ADD_ARGS(DECL) ((DECL)->decl.result) #define METHOD_ADD_ARGS(DECL) ((DECL)->decl.result)
#define METHOD_ADD_ARGS_ELLIPSIS_P(DECL) ((DECL)->decl.lang_flag_0)
#define METHOD_DEFINITION(DECL) ((DECL)->decl.initial) #define METHOD_DEFINITION(DECL) ((DECL)->decl.initial)
#define METHOD_ENCODING(DECL) ((DECL)->decl.context) #define METHOD_ENCODING(DECL) ((DECL)->decl.context)

View File

@ -189,7 +189,8 @@ objc_build_keyword_decl (tree ARG_UNUSED (selector),
tree tree
objc_build_method_signature (tree ARG_UNUSED (rettype), objc_build_method_signature (tree ARG_UNUSED (rettype),
tree ARG_UNUSED (selectors), tree ARG_UNUSED (selectors),
tree ARG_UNUSED (optparms)) tree ARG_UNUSED (optparms),
bool ARG_UNUSED (ellipsis))
{ {
return 0; return 0;
} }