Commit 55d54003 by Zack Weinberg

c-decl.c (last_function_parm_vars, [...]): New static variables.

	* c-decl.c (last_function_parm_vars, current_function_parm_vars):
	New static variables.
	(struct c_scope): Add parms and warned_forward_parm_decls
	fields; remove parm_order.
	(storedecls, storetags): Delete.
	(poplevel): Also clear bindings on the parms chain.
	(pushdecl): Handle forward declarations of parameters, and
	chain PARM_DECLs on the parms list, not the names list.
	(lookup_name_current_level): Check for PARM_DECLs on the parms
	list too.
	(push_parm_decl): Don't update parm_order.
	(clear_parm_order): Rename mark_forward_parm_decls.  Issue the
	warning, only once per parameter list, and set TREE_ASM_WRITTEN
	on the decls here.  Then move the forward decls to the names list.
	(grokparms): Set last_function_parm_vars.
	(get_parm_info): Don't use gettags or getdecls.  No need to
	extract non-parms from the parms list, or reorganize the parms
	list.  Feed nonparms back in the TREE_TYPE of the list node
	returned.  Issue only one error per parameter list for "void"
	appearing more than once in said parameter list.  Collapse
	parmlist_tags_warning into this function to avoid double scan
	of tags list.
	(start_function): Set current_function_parm_vars.
	(store_parm_decls_newstyle): Bypass pushdecl, manipulate scope
	directly.  Get non-parms from current_function_parm_vars; no
	need to extract them from the parms chain.  Properly bind tags
	in the new scope.
	(store_parm_decls_oldstyle): No need to extract non-parameters
	from the parms chain, nor to store them back afterward.  Move
	declaration to top of function, restructure code reordering
	DECL_ARGUMENTS.
	(store_parm_decls): No need to save and restore warn_shadow.
	* c-parse.in: Don't call parmlist_tags_warning nor
	clear_parm_order.  Call mark_forward_parm_decls when forward
	parm decls are encountered.
	* c-tree.h: Prototype mark_forward_parm_decls; not
	clear_parm_order or parmlist_tags_warning.

testsuite:
	* gcc.dg/struct-in-proto-1.c: New test.

From-SVN: r69945
parent 18c81520
2003-07-29 Zack Weinberg <zack@codesourcery.com>
* c-decl.c (last_function_parm_vars, current_function_parm_vars):
New static variables.
(struct c_scope): Add parms and warned_forward_parm_decls
fields; remove parm_order.
(storedecls, storetags): Delete.
(poplevel): Also clear bindings on the parms chain.
(pushdecl): Handle forward declarations of parameters, and
chain PARM_DECLs on the parms list, not the names list.
(lookup_name_current_level): Check for PARM_DECLs on the parms
list too.
(push_parm_decl): Don't update parm_order.
(clear_parm_order): Rename mark_forward_parm_decls. Issue the
warning, only once per parameter list, and set TREE_ASM_WRITTEN
on the decls here. Then move the forward decls to the names list.
(grokparms): Set last_function_parm_vars.
(get_parm_info): Don't use gettags or getdecls. No need to
extract non-parms from the parms list, or reorganize the parms
list. Feed nonparms back in the TREE_TYPE of the list node
returned. Issue only one error per parameter list for "void"
appearing more than once in said parameter list. Collapse
parmlist_tags_warning into this function to avoid double scan
of tags list.
(start_function): Set current_function_parm_vars.
(store_parm_decls_newstyle): Bypass pushdecl, manipulate scope
directly. Get non-parms from current_function_parm_vars; no
need to extract them from the parms chain. Properly bind tags
in the new scope.
(store_parm_decls_oldstyle): No need to extract non-parameters
from the parms chain, nor to store them back afterward. Move
declaration to top of function, restructure code reordering
DECL_ARGUMENTS.
(store_parm_decls): No need to save and restore warn_shadow.
* c-parse.in: Don't call parmlist_tags_warning nor
clear_parm_order. Call mark_forward_parm_decls when forward
parm decls are encountered.
* c-tree.h: Prototype mark_forward_parm_decls; not
clear_parm_order or parmlist_tags_warning.
2003-07-29 Geoffrey Keating <geoffk@apple.com>
* c-common.c (allow_pch): Remove.
......
......@@ -2478,24 +2478,16 @@ asm_clobbers:
parmlist:
maybe_attribute
{ pushlevel (0);
clear_parm_order ();
declare_parm_level (); }
parmlist_1
{ $$ = $3;
parmlist_tags_warning ();
poplevel (0, 0, 0); }
;
parmlist_1:
parmlist_2 ')'
| parms ';'
{ tree parm;
if (pedantic)
pedwarn ("ISO C forbids forward parameter declarations");
/* Mark the forward decls as such. */
for (parm = getdecls (); parm; parm = TREE_CHAIN (parm))
TREE_ASM_WRITTEN (parm) = 1;
clear_parm_order (); }
{ mark_forward_parm_decls (); }
maybe_attribute
{ /* Dummy action so attributes are in known place
on parser stack. */ }
......@@ -2600,11 +2592,9 @@ setspecs_fp:
parmlist_or_identifiers:
maybe_attribute
{ pushlevel (0);
clear_parm_order ();
declare_parm_level (); }
parmlist_or_identifiers_1
{ $$ = $3;
parmlist_tags_warning ();
poplevel (0, 0, 0); }
;
......
......@@ -193,7 +193,7 @@ extern void c_print_identifier (FILE *, tree, int);
extern tree build_array_declarator (tree, tree, int, int);
extern tree build_enumerator (tree, tree);
extern void check_for_loop_decls (void);
extern void clear_parm_order (void);
extern void mark_forward_parm_decls (void);
extern int complete_array_type (tree, tree, int);
extern void declare_parm_level (void);
extern void undeclared_variable (tree);
......@@ -211,7 +211,6 @@ extern tree implicitly_declare (tree);
extern int in_parm_level_p (void);
extern void keep_next_level (void);
extern tree lookup_name (tree);
extern void parmlist_tags_warning (void);
extern void pending_xref_error (void);
extern void c_push_function_context (struct function *);
extern void c_pop_function_context (struct function *);
......
2003-07-29 Zack Weinberg <zack@codesourcery.com>
* gcc.dg/struct-in-proto-1.c: New test.
2003-07-29 Neil Booth <neil@daikokuya.co.uk>
* gcc.dg/cpp/include2.c: Only expect one message.
......@@ -25,7 +29,7 @@
PR c++/11667
* g++.dg/init/enum2.C: New test.
* g++.dg/template/overload1.C: Add "-w" option.
2003-07-28 <hp@bitrange.com>
* gcc.dg/Wdeclaration-after-statement-1.c,
......@@ -85,7 +89,7 @@
PR c++/11517
* g++.dg/expr/cond2.C: New test.
PR optimization/10679
* g++.dg/opt/inline4.C: New test.
......@@ -96,7 +100,7 @@
2003-07-22 Nathan Sidwell <nathan@codesourcery.com>
* g++.dg/ext/flexary1.C: New test.
2003-07-22 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
PR c++/10793
......@@ -166,7 +170,7 @@
2003-07-21 Eric Botcazou <ebotcazou@libertysurf.fr>
PR optimization/11536
PR optimization/11536
* gcc.dg/20030721-1.c: New test.
2003-07-19 Mark Mitchell <mark@codesourcery.com>
......
/* { dg-do compile } */
/* { dg-options "-w" } */
int foo(struct S { int i; } s) {
return sizeof(struct S); /* { dg-bogus "incomplete type" "S visible here" } */
}
int bar(void) {
return sizeof(struct S); /* { dg-error "incomplete type" "not here" } */
}
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