Commit f75fbaf7 by Zack Weinberg

PR 12267, 12391, 12560, 13129, 14114, 14113

	* c-tree.h: Forward declare struct c_binding.  Declare
	c_override_bindings_to_false.  Update prototypes.
	(struct lang_identifier): Update comments.  Change fields to be
	struct c_binding *.
	(IDENTIFIER_SYMBOL_VALUE, IDENTIFIER_TAG_VALUE)
	(IDENTIFIER_LABEL_VALUE, C_DECL_INVISIBLE)
	(KEEP_NO, KEEP_YES, KEEP_MAYBE): Delete.
	(C_DECL_IN_EXTERNAL_SCOPE, C_DECL_DECLARED_BUILTIN): New.
	* c-common.h: Update prototypes.
	* c-decl.c (struct c_scope): Update commentary.  Remove names,
	names_last, parms, parms_last, tags, and shadowed fields.  Add
	bindings and depth fields.
	(scope_freelist): Move to more appropriate location.
	(c_print_identifier): Update for changes to struct lang_identifier.
	(objc_mark_locals_volatile): Update for new bindings structures.
	(global_bindings_p): Honor c_override_global_bindings_to_false.
	(pushlevel): Rename to push_scope; take no arguments; use the
	scope_freelist; initialize scope->depth and check for overflow.
	(poplevel): Rename to pop_scope; totally rewritten for new bindings
	structures.
	(diagnose_mismatched_decls): Use C_DECL_DECLARED_BUILTIN, not
	C_DECL_INVISIBLE, for certain decisions.  Adjust some diagnostics.
	Improve some commentary.  Adjust handling of forward parm decls.
	(merge_decls): Set C_DECL_DECLARED_BUILTIN when appropriate.
	Preserve C_DECL_IN_EXTERNAL_SCOPE.
	(warn_if_shadowing): Correct indentation.  Improve diagnostics.
	(pushdecl): Remove unnecessary assertion.  Short-circuit anonymous
	decls.  Rewrite for new bindings structures.  Improve commentary.
	Eliminate the copy_node call.
	(implicit_decl_warning): Use the "diag" idiom (as seen in
	locate_old_decl) to reduce code duplication; call locate_old_decl
	if appropriate.  Relocate to remove need for forward declaration.
	(implicitly_declare): Adjust for new bindings structures.  Kludge
	around Objective-C not-really-builtin functions.
	(undeclared_variable): Improve diagnostics.  If current_function_decl
	is nonnull but current_function_scope is null, use current_scope.
	Use bind.
	(lookup_tag): Adjust for new bindings structures.  Kludge around
	Objective-C's tag declarations that wind up in the external scope.
	(lookup_name): Adjust for new bindings structures.  Kludge around
	c-common.c's pseudo-typedefs that wind up in the external scope.
	(lookup_name_current_level): Rename lookup_name_in_scope; take a
	second argument indicating the scope to examine; rewrite for
	new bindings structures.
	(c_init_decl_processing): Adjust for renamed functions.  Do not
	initialize current_file_decl, first_builtin_decl, last_builtin_decl.
	First scope pushed is the external scope, not the global scope.
	(builtin_function): Use bind, not pushdecl.  Adjust other bits
	for new data structures.  Keep track of builtins that should be
	made visible automatically.
	(start_decl): Adjust diagnostics.  Remove unnecessary call to
	expand_decl.
	(grokparms): Return 0 if arg_types is error_mark_node.
	(get_parm_info): Rename "void_at_end" argument to "ellipsis", with
	reversed sense.  Rewrite for new bindings structures.  Do not
	leave any decls in the scope, to prevent pop_scope from doing
	contradictory things with them.
	(finish_struct, finish_enum): Remove redundant diagnostics.
	(build_enumerator): Don't cascade diagnostics for error_mark_node.
	Mark location where -pedantic changes the meaning of the program.
	(store_parm_decls_newstyle, store_parm_decls_oldstyle): Load the
	parameter decls into the function's scope structure using bind.
	Warn here about function definitions in the wrong style.
	Adjust diagnostics.
	(store_parm_decls): Correct the determination of whether a
	function was defined with a prototype.
	(c_write_global_declarations): Operate on all file decls and on
	the external scope.  Split body of the loop to...
	(c_write_global_declarations_1): ... this new function, to avoid
	code duplication.
	(truly_local_externals, first_builtin_decl, last_builtin_decl)
	(make_scope, pop_scope, in_parm_level_p, set_block)
	(any_external_decl, record_external_decl, bind_label, getdecls)
	(link_hash_hash, link_hash_eq, merge_translation_unit_decls)
	(c_reset_state): Delete.
	(visible_builtins, c_override_global_bindings_to_false)
	(c_binding, I_SYMBOL_BINDING, I_SYMBOL_DECL, I_TAG_BINDING)
	(I_TAG_DECL, I_LABEL_BINDING, I_LABEL_DECL, file_scope)
	(external_scope, binding_freelist, bind, free_binding_and_advance)
	(push_file_scope, pop_file_scope): New.
	(pushtag, pushdecl_top_level, lookup_label, declare_label)
	(define_label, c_make_fname_decl, finish_decl)
	(mark_forward_parm_decls, build_compound_literal)
	(grokdeclarator, start_function, check_for_loop_decls)
	(identifier_global_value, record_builtin_type): Minor adjustments
	for new bindings structures.  Improve diagnostics and commentary.
	* c-objc-common.c (start_cdtor, finish_cdtor): Adjust calls to
	pushlevel/poplevel respectively.
	(c_objc_common_finish_file): Don't call merge_translation_unit_decls.
	* c-opts.c (c_common_parse_file): Remove spurious ATTRIBUTE_UNUSED.
	Warn about YYDEBUG not being defined only if -dy.  Remove no-longer-
	correct loop over multiple translation units; call fatal_error if
	requested to compile more than one file at once.  (This disables
	IMA temporarily - an up-front error being preferable to a crash.)
	* c-parse.in (pushlevel, poplevel rules): Rename push_scope, pop_scope.
	(all actions): Adjust calls to pushlevel/poplevel.
	(parsing_iso_function_signature): Delete.
	(extdef_1): Fold into extdef.
	(old_style_parm_decls_1): Fold into old_style_parm_decls.  Don't
	warn here about function definitions in the wrong style.
	(after_tyle_declarator, parm_declarator_starttypename)
	(parm_declarator_nostarttypename, notype_declarator): Remove
	commented-out productions.
	(parmlist_1, parmlist_2): Use make_node, not tree_cons, to create
	an empty TREE_LIST node.  Adjust calls to get_parm_info.
	(parmlist_2 : ELLIPSIS): Tag the arg-info block with error_mark_node
	to suppress -Wold-style-definition after this error.
	(c_parse_file): Don't clear the binding stack or call
	finish_fname_decls here.  Correct comment.
	* c-typeck.c (same_translation_unit_p): Export.
	(common_type): Use c_override_global_bindings_to_false, not
	pushlevel/poplevel/declare_parm_level.
	* c-lang.c: Override LANG_HOOKS_CLEAR_BINDING_STACK,
	LANG_HOOKS_PUSHLEVEL, LANG_HOOKS_POPLEVEL, LANG_HOOKS_SET_BLOCK,
	and LANG_HOOKS_GETDECLS with do-nothing stubs.
	* objc/objc-lang.c: Likewise.
	* objc/objc-act.c: Adjust all calls to pushlevel, poplevel,
	get_parm_info.
	(OBJC_VOID_AT_END): Delete; replace all uses
	with void_list_node.
	(generate_forward_declaration_to_string_table): Delete.
	* objc/objc-act.h (OCTI_STRG_DECL, UOBJC_STRINGS_decl): Delete.

	* coverage.c (create_coverage): Don't pushdecl anything.
	* langhooks.c (lhd_clear_binding_stack): Call
	lang_hooks.decls.poplevel, not poplevel.
	* tree.c (list_length): If ENABLE_TREE_CHECKING, abort on a
	circular list rather than going into an infinite loop.

cp:
	* cp-lang.c (c_reset_state): Delete.
	(push_file_scope, pop_file_scope): New stubs.
	* parser.c (c_parse_file): Call sorry() here if called more than once.

testsuite:
	* gcc.dg/Wold-style-definition-1.c, gcc.dg/builtins-30.c
	* gcc.dg/unused-4.c, gcc.dg/noncompile/label-1.c
	* gcc.dg/noncompile/label-lineno-1.c, objc.dg/naming-1.m:
	Adjust error regexps.
	* gcc.dg/Wshadow-2.c, gcc.dg/noncompile/incomplete-3.c
	* gcc.dg/noncompile/undeclared-1.c: New test cases.
	* gcc.dg/decl-5.c, gcc.dg/redecl-1.c: Remove XFAIL.
	* gcc.dg/local1.c: Add explanatory comment.

From-SVN: r79883
parent 5595a2bd
2004-03-23 Zack Weinberg <zack@codesourcery.com>
PR 12267, 12391, 12560, 13129, 14114, 14113
* c-tree.h: Forward declare struct c_binding. Declare
c_override_bindings_to_false. Update prototypes.
(struct lang_identifier): Update comments. Change fields to be
struct c_binding *.
(IDENTIFIER_SYMBOL_VALUE, IDENTIFIER_TAG_VALUE)
(IDENTIFIER_LABEL_VALUE, C_DECL_INVISIBLE)
(KEEP_NO, KEEP_YES, KEEP_MAYBE): Delete.
(C_DECL_IN_EXTERNAL_SCOPE, C_DECL_DECLARED_BUILTIN): New.
* c-common.h: Update prototypes.
* c-decl.c (struct c_scope): Update commentary. Remove names,
names_last, parms, parms_last, tags, and shadowed fields. Add
bindings and depth fields.
(scope_freelist): Move to more appropriate location.
(c_print_identifier): Update for changes to struct lang_identifier.
(objc_mark_locals_volatile): Update for new bindings structures.
(global_bindings_p): Honor c_override_global_bindings_to_false.
(pushlevel): Rename to push_scope; take no arguments; use the
scope_freelist; initialize scope->depth and check for overflow.
(poplevel): Rename to pop_scope; totally rewritten for new bindings
structures.
(diagnose_mismatched_decls): Use C_DECL_DECLARED_BUILTIN, not
C_DECL_INVISIBLE, for certain decisions. Adjust some diagnostics.
Improve some commentary. Adjust handling of forward parm decls.
(merge_decls): Set C_DECL_DECLARED_BUILTIN when appropriate.
Preserve C_DECL_IN_EXTERNAL_SCOPE.
(warn_if_shadowing): Correct indentation. Improve diagnostics.
(pushdecl): Remove unnecessary assertion. Short-circuit anonymous
decls. Rewrite for new bindings structures. Improve commentary.
Eliminate the copy_node call.
(implicit_decl_warning): Use the "diag" idiom (as seen in
locate_old_decl) to reduce code duplication; call locate_old_decl
if appropriate. Relocate to remove need for forward declaration.
(implicitly_declare): Adjust for new bindings structures. Kludge
around Objective-C not-really-builtin functions.
(undeclared_variable): Improve diagnostics. If current_function_decl
is nonnull but current_function_scope is null, use current_scope.
Use bind.
(lookup_tag): Adjust for new bindings structures. Kludge around
Objective-C's tag declarations that wind up in the external scope.
(lookup_name): Adjust for new bindings structures. Kludge around
c-common.c's pseudo-typedefs that wind up in the external scope.
(lookup_name_current_level): Rename lookup_name_in_scope; take a
second argument indicating the scope to examine; rewrite for
new bindings structures.
(c_init_decl_processing): Adjust for renamed functions. Do not
initialize current_file_decl, first_builtin_decl, last_builtin_decl.
First scope pushed is the external scope, not the global scope.
(builtin_function): Use bind, not pushdecl. Adjust other bits
for new data structures. Keep track of builtins that should be
made visible automatically.
(start_decl): Adjust diagnostics. Remove unnecessary call to
expand_decl.
(grokparms): Return 0 if arg_types is error_mark_node.
(get_parm_info): Rename "void_at_end" argument to "ellipsis", with
reversed sense. Rewrite for new bindings structures. Do not
leave any decls in the scope, to prevent pop_scope from doing
contradictory things with them.
(finish_struct, finish_enum): Remove redundant diagnostics.
(build_enumerator): Don't cascade diagnostics for error_mark_node.
Mark location where -pedantic changes the meaning of the program.
(store_parm_decls_newstyle, store_parm_decls_oldstyle): Load the
parameter decls into the function's scope structure using bind.
Warn here about function definitions in the wrong style.
Adjust diagnostics.
(store_parm_decls): Correct the determination of whether a
function was defined with a prototype.
(c_write_global_declarations): Operate on all file decls and on
the external scope. Split body of the loop to...
(c_write_global_declarations_1): ... this new function, to avoid
code duplication.
(truly_local_externals, first_builtin_decl, last_builtin_decl)
(make_scope, pop_scope, in_parm_level_p, set_block)
(any_external_decl, record_external_decl, bind_label, getdecls)
(link_hash_hash, link_hash_eq, merge_translation_unit_decls)
(c_reset_state): Delete.
(visible_builtins, c_override_global_bindings_to_false)
(c_binding, I_SYMBOL_BINDING, I_SYMBOL_DECL, I_TAG_BINDING)
(I_TAG_DECL, I_LABEL_BINDING, I_LABEL_DECL, file_scope)
(external_scope, binding_freelist, bind, free_binding_and_advance)
(push_file_scope, pop_file_scope): New.
(pushtag, pushdecl_top_level, lookup_label, declare_label)
(define_label, c_make_fname_decl, finish_decl)
(mark_forward_parm_decls, build_compound_literal)
(grokdeclarator, start_function, check_for_loop_decls)
(identifier_global_value, record_builtin_type): Minor adjustments
for new bindings structures. Improve diagnostics and commentary.
* c-objc-common.c (start_cdtor, finish_cdtor): Adjust calls to
pushlevel/poplevel respectively.
(c_objc_common_finish_file): Don't call merge_translation_unit_decls.
* c-opts.c (c_common_parse_file): Remove spurious ATTRIBUTE_UNUSED.
Warn about YYDEBUG not being defined only if -dy. Remove no-longer-
correct loop over multiple translation units; call fatal_error if
requested to compile more than one file at once. (This disables
IMA temporarily - an up-front error being preferable to a crash.)
* c-parse.in (pushlevel, poplevel rules): Rename push_scope, pop_scope.
(all actions): Adjust calls to pushlevel/poplevel.
(parsing_iso_function_signature): Delete.
(extdef_1): Fold into extdef.
(old_style_parm_decls_1): Fold into old_style_parm_decls. Don't
warn here about function definitions in the wrong style.
(after_tyle_declarator, parm_declarator_starttypename)
(parm_declarator_nostarttypename, notype_declarator): Remove
commented-out productions.
(parmlist_1, parmlist_2): Use make_node, not tree_cons, to create
an empty TREE_LIST node. Adjust calls to get_parm_info.
(parmlist_2 : ELLIPSIS): Tag the arg-info block with error_mark_node
to suppress -Wold-style-definition after this error.
(c_parse_file): Don't clear the binding stack or call
finish_fname_decls here. Correct comment.
* c-typeck.c (same_translation_unit_p): Export.
(common_type): Use c_override_global_bindings_to_false, not
pushlevel/poplevel/declare_parm_level.
* c-lang.c: Override LANG_HOOKS_CLEAR_BINDING_STACK,
LANG_HOOKS_PUSHLEVEL, LANG_HOOKS_POPLEVEL, LANG_HOOKS_SET_BLOCK,
and LANG_HOOKS_GETDECLS with do-nothing stubs.
* objc/objc-lang.c: Likewise.
* objc/objc-act.c: Adjust all calls to pushlevel, poplevel,
get_parm_info.
(OBJC_VOID_AT_END): Delete; replace all uses
with void_list_node.
(generate_forward_declaration_to_string_table): Delete.
* objc/objc-act.h (OCTI_STRG_DECL, UOBJC_STRINGS_decl): Delete.
* coverage.c (create_coverage): Don't pushdecl anything.
* langhooks.c (lhd_clear_binding_stack): Call
lang_hooks.decls.poplevel, not poplevel.
* tree.c (list_length): If ENABLE_TREE_CHECKING, abort on a
circular list rather than going into an infinite loop.
2004-03-23 Olivier Hainque <hainque@act-europe.fr> 2004-03-23 Olivier Hainque <hainque@act-europe.fr>
* optabs.c (expand_binop): When synthesizing double word rotates * optabs.c (expand_binop): When synthesizing double word rotates
from single word shifts, use a new register target if the provided from single word shifts, use a new register target if the provided
target is not a REG already. target is not a REG already.
2004-03-23 Richard Kenner <kenner@vlsi1.ultra.nyu.edu> 2004-03-23 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
...@@ -198,8 +331,8 @@ ...@@ -198,8 +331,8 @@
* frontends.texi: Add missing line. * frontends.texi: Add missing line.
2004-03-21 Zack Weinberg <zack@codesourcery.com> 2004-03-21 Zack Weinberg <zack@codesourcery.com>
Chris Devers <cdevers@pobox.com> Chris Devers <cdevers@pobox.com>
Joseph S. Myers <jsm@polyomino.org.uk> Joseph S. Myers <jsm@polyomino.org.uk>
* doc/frontends.texi: Rewrite. * doc/frontends.texi: Rewrite.
* doc/gcc.texi: Update last modification date. * doc/gcc.texi: Update last modification date.
...@@ -404,7 +537,7 @@ ...@@ -404,7 +537,7 @@
(ir_sr70_icmp): Delete. (ir_sr70_icmp): Delete.
2004-03-18 Richard Kenner <kenner@vlsi1.ultra.nyu.edu> 2004-03-18 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
* tree.h (TREE_CHECK2, TREE_CHECK3, TREE_CHECK5): New macros. * tree.h (TREE_CHECK2, TREE_CHECK3, TREE_CHECK5): New macros.
(tree_check2_failed, tree_check3_failed, tree_check5_failed): New decl. (tree_check2_failed, tree_check3_failed, tree_check5_failed): New decl.
(FUNC_OR_METHOD_CHECK, SET_ARRAY_OR_VECTOR_CHECK): New macros. (FUNC_OR_METHOD_CHECK, SET_ARRAY_OR_VECTOR_CHECK): New macros.
...@@ -462,12 +595,12 @@ ...@@ -462,12 +595,12 @@
2004-03-17 Fariborz Jahanian <fjahanian@apple.com> 2004-03-17 Fariborz Jahanian <fjahanian@apple.com>
* config/rs6000/rs6000.c (rs6000_stack_info): correct reg_size * config/rs6000/rs6000.c (rs6000_stack_info): correct reg_size
for mixed mode. for mixed mode.
(rs6000_emit_prologue): Ditto. (rs6000_emit_prologue): Ditto.
(rs6000_emit_epilogue): Ditto. (rs6000_emit_epilogue): Ditto.
* config/rs6000/rs6000.h: Definition of DWARF_CIE_DATA_ALIGNMENT * config/rs6000/rs6000.h: Definition of DWARF_CIE_DATA_ALIGNMENT
macro for mixed mode. macro for mixed mode.
2004-03-18 Jan Hubicka <jh@suse.cz> 2004-03-18 Jan Hubicka <jh@suse.cz>
......
...@@ -329,6 +329,8 @@ extern void (*lang_expand_function_end) (void); ...@@ -329,6 +329,8 @@ extern void (*lang_expand_function_end) (void);
noreturn attribute. */ noreturn attribute. */
extern int (*lang_missing_noreturn_ok_p) (tree); extern int (*lang_missing_noreturn_ok_p) (tree);
extern void push_file_scope (void);
extern void pop_file_scope (void);
extern int yyparse (void); extern int yyparse (void);
extern stmt_tree current_stmt_tree (void); extern stmt_tree current_stmt_tree (void);
extern tree *current_scope_stmt_stack (void); extern tree *current_scope_stmt_stack (void);
...@@ -950,9 +952,6 @@ extern int self_promoting_args_p (tree); ...@@ -950,9 +952,6 @@ extern int self_promoting_args_p (tree);
extern tree strip_array_types (tree); extern tree strip_array_types (tree);
extern tree strip_pointer_operator (tree); extern tree strip_pointer_operator (tree);
/* This function resets the parsers' state in preparation for parsing
a new file. */
extern void c_reset_state (void);
/* This is the basic parsing function. */ /* This is the basic parsing function. */
extern void c_parse_file (void); extern void c_parse_file (void);
/* This is misnamed, it actually performs end-of-compilation processing. */ /* This is misnamed, it actually performs end-of-compilation processing. */
......
...@@ -65,6 +65,8 @@ enum c_language_kind c_language = clk_c; ...@@ -65,6 +65,8 @@ enum c_language_kind c_language = clk_c;
#define LANG_HOOKS_MARK_ADDRESSABLE c_mark_addressable #define LANG_HOOKS_MARK_ADDRESSABLE c_mark_addressable
#undef LANG_HOOKS_PARSE_FILE #undef LANG_HOOKS_PARSE_FILE
#define LANG_HOOKS_PARSE_FILE c_common_parse_file #define LANG_HOOKS_PARSE_FILE c_common_parse_file
#undef LANG_HOOKS_CLEAR_BINDING_STACK
#define LANG_HOOKS_CLEAR_BINDING_STACK lhd_do_nothing
#undef LANG_HOOKS_TRUTHVALUE_CONVERSION #undef LANG_HOOKS_TRUTHVALUE_CONVERSION
#define LANG_HOOKS_TRUTHVALUE_CONVERSION c_objc_common_truthvalue_conversion #define LANG_HOOKS_TRUTHVALUE_CONVERSION c_objc_common_truthvalue_conversion
#undef LANG_HOOKS_FINISH_INCOMPLETE_DECL #undef LANG_HOOKS_FINISH_INCOMPLETE_DECL
...@@ -136,6 +138,19 @@ enum c_language_kind c_language = clk_c; ...@@ -136,6 +138,19 @@ enum c_language_kind c_language = clk_c;
#undef LANG_HOOKS_REGISTER_BUILTIN_TYPE #undef LANG_HOOKS_REGISTER_BUILTIN_TYPE
#define LANG_HOOKS_REGISTER_BUILTIN_TYPE c_register_builtin_type #define LANG_HOOKS_REGISTER_BUILTIN_TYPE c_register_builtin_type
/* The C front end's scoping structure is very different from
that expected by the language-independent code; it is best
to disable all of pushlevel, poplevel, set_block, and getdecls.
This means it must also provide its own write_globals. */
#undef LANG_HOOKS_PUSHLEVEL
#define LANG_HOOKS_PUSHLEVEL lhd_do_nothing_i
#undef LANG_HOOKS_POPLEVEL
#define LANG_HOOKS_POPLEVEL lhd_do_nothing_iii_return_null_tree
#undef LANG_HOOKS_SET_BLOCK
#define LANG_HOOKS_SET_BLOCK lhd_do_nothing_t
#undef LANG_HOOKS_GETDECLS
#define LANG_HOOKS_GETDECLS lhd_return_null_tree_v
#undef LANG_HOOKS_WRITE_GLOBALS #undef LANG_HOOKS_WRITE_GLOBALS
#define LANG_HOOKS_WRITE_GLOBALS c_write_global_declarations #define LANG_HOOKS_WRITE_GLOBALS c_write_global_declarations
......
...@@ -206,7 +206,7 @@ start_cdtor (int method_type) ...@@ -206,7 +206,7 @@ start_cdtor (int method_type)
body = c_begin_compound_stmt (); body = c_begin_compound_stmt ();
pushlevel (0); push_scope ();
clear_last_expr (); clear_last_expr ();
add_scope_stmt (/*begin_p=*/1, /*partial_p=*/0); add_scope_stmt (/*begin_p=*/1, /*partial_p=*/0);
...@@ -220,7 +220,7 @@ finish_cdtor (tree body) ...@@ -220,7 +220,7 @@ finish_cdtor (tree body)
tree block; tree block;
scope = add_scope_stmt (/*begin_p=*/0, /*partial_p=*/0); scope = add_scope_stmt (/*begin_p=*/0, /*partial_p=*/0);
block = poplevel (0, 0, 0); block = pop_scope ();
SCOPE_STMT_BLOCK (TREE_PURPOSE (scope)) = block; SCOPE_STMT_BLOCK (TREE_PURPOSE (scope)) = block;
SCOPE_STMT_BLOCK (TREE_VALUE (scope)) = block; SCOPE_STMT_BLOCK (TREE_VALUE (scope)) = block;
...@@ -237,10 +237,6 @@ c_objc_common_finish_file (void) ...@@ -237,10 +237,6 @@ c_objc_common_finish_file (void)
if (pch_file) if (pch_file)
c_common_write_pch (); c_common_write_pch ();
/* If multiple translation units were built, copy information between
them based on linkage rules. */
merge_translation_unit_decls ();
cgraph_finalize_compilation_unit (); cgraph_finalize_compilation_unit ();
cgraph_optimize (); cgraph_optimize ();
......
...@@ -1216,41 +1216,24 @@ c_common_init (void) ...@@ -1216,41 +1216,24 @@ c_common_init (void)
/* Initialize the integrated preprocessor after debug output has been /* Initialize the integrated preprocessor after debug output has been
initialized; loop over each input file. */ initialized; loop over each input file. */
void void
c_common_parse_file (int set_yydebug ATTRIBUTE_UNUSED) c_common_parse_file (int set_yydebug)
{ {
unsigned file_index;
#if YYDEBUG != 0 #if YYDEBUG != 0
yydebug = set_yydebug; yydebug = set_yydebug;
#else #else
warning ("YYDEBUG not defined"); if (set_yydebug)
warning ("YYDEBUG not defined");
#endif #endif
file_index = 0; if (num_in_fnames > 1)
fatal_error ("sorry, inter-module analysis temporarily out of commission");
do
{
if (file_index > 0)
{
/* Reset the state of the parser. */
c_reset_state();
/* Reset cpplib's macros and start a new file. */
cpp_undef_all (parse_in);
main_input_filename = this_input_filename
= cpp_read_main_file (parse_in, in_fnames[file_index]);
if (this_input_filename == NULL)
break;
}
finish_options ();
if (file_index == 0)
pch_init();
c_parse_file ();
file_index++; finish_options ();
} while (file_index < num_in_fnames); pch_init ();
push_file_scope ();
c_parse_file ();
finish_file (); finish_file ();
pop_file_scope ();
} }
/* Common finish hook for the C, ObjC and C++ front ends. */ /* Common finish hook for the C, ObjC and C++ front ends. */
......
...@@ -208,7 +208,7 @@ do { \ ...@@ -208,7 +208,7 @@ do { \
%type <ttype> any_word %type <ttype> any_word
%type <ttype> compstmt compstmt_start compstmt_nostart compstmt_primary_start %type <ttype> compstmt compstmt_start compstmt_nostart compstmt_primary_start
%type <ttype> do_stmt_start poplevel stmt label %type <ttype> do_stmt_start pop_scope stmt label
%type <ttype> c99_block_start c99_block_end %type <ttype> c99_block_start c99_block_end
%type <ttype> declarator %type <ttype> declarator
...@@ -328,8 +328,6 @@ static int objc_need_raw_identifier; ...@@ -328,8 +328,6 @@ static int objc_need_raw_identifier;
#define OBJC_NEED_RAW_IDENTIFIER(VAL) /* nothing */ #define OBJC_NEED_RAW_IDENTIFIER(VAL) /* nothing */
@@end_ifc @@end_ifc
static bool parsing_iso_function_signature;
/* Tell yyparse how to print a token's value, if yydebug is set. */ /* Tell yyparse how to print a token's value, if yydebug is set. */
#define YYPRINT(FILE,YYCHAR,YYLVAL) yyprint(FILE,YYCHAR,YYLVAL) #define YYPRINT(FILE,YYCHAR,YYLVAL) yyprint(FILE,YYCHAR,YYLVAL)
...@@ -368,11 +366,6 @@ extdefs: ...@@ -368,11 +366,6 @@ extdefs:
; ;
extdef: extdef:
extdef_1
{ parsing_iso_function_signature = false; } /* Reset after any external definition. */
;
extdef_1:
fndef fndef
| datadef | datadef
| asmdef | asmdef
...@@ -741,28 +734,8 @@ primary: ...@@ -741,28 +734,8 @@ primary:
; ;
old_style_parm_decls: old_style_parm_decls:
old_style_parm_decls_1
{
parsing_iso_function_signature = false; /* Reset after decls. */
}
;
old_style_parm_decls_1:
/* empty */ /* empty */
{
if (warn_traditional && !in_system_header
&& parsing_iso_function_signature)
warning ("traditional C rejects ISO C style function definitions");
if (warn_old_style_definition && !in_system_header
&& !parsing_iso_function_signature)
warning ("old-style parameter declaration");
parsing_iso_function_signature = false; /* Reset after warning. */
}
| datadecls | datadecls
{
if (warn_old_style_definition && !in_system_header)
warning ("old-style parameter declaration");
}
; ;
/* The following are analogous to lineno_decl, decls and decl /* The following are analogous to lineno_decl, decls and decl
...@@ -1555,7 +1528,6 @@ nested_function: ...@@ -1555,7 +1528,6 @@ nested_function:
pop_function_context (); pop_function_context ();
YYERROR1; YYERROR1;
} }
parsing_iso_function_signature = false; /* Don't warn about nested functions. */
} }
old_style_parm_decls save_location old_style_parm_decls save_location
{ tree decl = current_function_decl; { tree decl = current_function_decl;
...@@ -1586,7 +1558,6 @@ notype_nested_function: ...@@ -1586,7 +1558,6 @@ notype_nested_function:
pop_function_context (); pop_function_context ();
YYERROR1; YYERROR1;
} }
parsing_iso_function_signature = false; /* Don't warn about nested functions. */
} }
old_style_parm_decls save_location old_style_parm_decls save_location
{ tree decl = current_function_decl; { tree decl = current_function_decl;
...@@ -1620,9 +1591,6 @@ after_type_declarator: ...@@ -1620,9 +1591,6 @@ after_type_declarator:
{ $$ = $2 ? tree_cons ($2, $3, NULL_TREE) : $3; } { $$ = $2 ? tree_cons ($2, $3, NULL_TREE) : $3; }
| after_type_declarator '(' parmlist_or_identifiers %prec '.' | after_type_declarator '(' parmlist_or_identifiers %prec '.'
{ $$ = build_nt (CALL_EXPR, $1, $3, NULL_TREE); } { $$ = build_nt (CALL_EXPR, $1, $3, NULL_TREE); }
/* | after_type_declarator '(' error ')' %prec '.'
{ $$ = build_nt (CALL_EXPR, $1, NULL_TREE, NULL_TREE);
poplevel (0, 0, 0); } */
| after_type_declarator array_declarator %prec '.' | after_type_declarator array_declarator %prec '.'
{ $$ = set_array_declarator_type ($2, $1, 0); } { $$ = set_array_declarator_type ($2, $1, 0); }
| '*' maybe_type_quals_attrs after_type_declarator %prec UNARY | '*' maybe_type_quals_attrs after_type_declarator %prec UNARY
...@@ -1645,9 +1613,6 @@ parm_declarator: ...@@ -1645,9 +1613,6 @@ parm_declarator:
parm_declarator_starttypename: parm_declarator_starttypename:
parm_declarator_starttypename '(' parmlist_or_identifiers %prec '.' parm_declarator_starttypename '(' parmlist_or_identifiers %prec '.'
{ $$ = build_nt (CALL_EXPR, $1, $3, NULL_TREE); } { $$ = build_nt (CALL_EXPR, $1, $3, NULL_TREE); }
/* | parm_declarator_starttypename '(' error ')' %prec '.'
{ $$ = build_nt (CALL_EXPR, $1, NULL_TREE, NULL_TREE);
poplevel (0, 0, 0); } */
| parm_declarator_starttypename array_declarator %prec '.' | parm_declarator_starttypename array_declarator %prec '.'
{ $$ = set_array_declarator_type ($2, $1, 0); } { $$ = set_array_declarator_type ($2, $1, 0); }
| TYPENAME | TYPENAME
...@@ -1659,9 +1624,6 @@ parm_declarator_starttypename: ...@@ -1659,9 +1624,6 @@ parm_declarator_starttypename:
parm_declarator_nostarttypename: parm_declarator_nostarttypename:
parm_declarator_nostarttypename '(' parmlist_or_identifiers %prec '.' parm_declarator_nostarttypename '(' parmlist_or_identifiers %prec '.'
{ $$ = build_nt (CALL_EXPR, $1, $3, NULL_TREE); } { $$ = build_nt (CALL_EXPR, $1, $3, NULL_TREE); }
/* | parm_declarator_nostarttypename '(' error ')' %prec '.'
{ $$ = build_nt (CALL_EXPR, $1, NULL_TREE, NULL_TREE);
poplevel (0, 0, 0); } */
| parm_declarator_nostarttypename array_declarator %prec '.' | parm_declarator_nostarttypename array_declarator %prec '.'
{ $$ = set_array_declarator_type ($2, $1, 0); } { $$ = set_array_declarator_type ($2, $1, 0); }
| '*' maybe_type_quals_attrs parm_declarator_starttypename %prec UNARY | '*' maybe_type_quals_attrs parm_declarator_starttypename %prec UNARY
...@@ -1678,9 +1640,6 @@ parm_declarator_nostarttypename: ...@@ -1678,9 +1640,6 @@ parm_declarator_nostarttypename:
notype_declarator: notype_declarator:
notype_declarator '(' parmlist_or_identifiers %prec '.' notype_declarator '(' parmlist_or_identifiers %prec '.'
{ $$ = build_nt (CALL_EXPR, $1, $3, NULL_TREE); } { $$ = build_nt (CALL_EXPR, $1, $3, NULL_TREE); }
/* | notype_declarator '(' error ')' %prec '.'
{ $$ = build_nt (CALL_EXPR, $1, NULL_TREE, NULL_TREE);
poplevel (0, 0, 0); } */
| '(' maybe_attribute notype_declarator ')' | '(' maybe_attribute notype_declarator ')'
{ $$ = $2 ? tree_cons ($2, $3, NULL_TREE) : $3; } { $$ = $2 ? tree_cons ($2, $3, NULL_TREE) : $3; }
| '*' maybe_type_quals_attrs notype_declarator %prec UNARY | '*' maybe_type_quals_attrs notype_declarator %prec UNARY
...@@ -2037,14 +1996,14 @@ lineno_stmt_decl_or_labels: ...@@ -2037,14 +1996,14 @@ lineno_stmt_decl_or_labels:
errstmt: error ';' errstmt: error ';'
; ;
pushlevel: /* empty */ push_scope: /* empty */
{ pushlevel (0); { push_scope ();
clear_last_expr (); clear_last_expr ();
add_scope_stmt (/*begin_p=*/1, /*partial_p=*/0); add_scope_stmt (/*begin_p=*/1, /*partial_p=*/0);
} }
; ;
poplevel: /* empty */ pop_scope: /* empty */
{ {
@@ifobjc @@ifobjc
if (c_dialect_objc ()) if (c_dialect_objc ())
...@@ -2059,7 +2018,7 @@ c99_block_start: /* empty */ ...@@ -2059,7 +2018,7 @@ c99_block_start: /* empty */
{ if (flag_isoc99) { if (flag_isoc99)
{ {
$$ = c_begin_compound_stmt (); $$ = c_begin_compound_stmt ();
pushlevel (0); push_scope ();
clear_last_expr (); clear_last_expr ();
add_scope_stmt (/*begin_p=*/1, /*partial_p=*/0); add_scope_stmt (/*begin_p=*/1, /*partial_p=*/0);
} }
...@@ -2075,7 +2034,7 @@ c99_block_end: /* empty */ ...@@ -2075,7 +2034,7 @@ c99_block_end: /* empty */
{ if (flag_isoc99) { if (flag_isoc99)
{ {
tree scope_stmt = add_scope_stmt (/*begin_p=*/0, /*partial_p=*/0); tree scope_stmt = add_scope_stmt (/*begin_p=*/0, /*partial_p=*/0);
$$ = poplevel (KEEP_MAYBE, 0, 0); $$ = pop_scope ();
SCOPE_STMT_BLOCK (TREE_PURPOSE (scope_stmt)) SCOPE_STMT_BLOCK (TREE_PURPOSE (scope_stmt))
= SCOPE_STMT_BLOCK (TREE_VALUE (scope_stmt)) = SCOPE_STMT_BLOCK (TREE_VALUE (scope_stmt))
= $$; = $$;
...@@ -2124,8 +2083,8 @@ compstmt_start: '{' { compstmt_count++; ...@@ -2124,8 +2083,8 @@ compstmt_start: '{' { compstmt_count++;
compstmt_nostart: '}' compstmt_nostart: '}'
{ $$ = convert (void_type_node, integer_zero_node); } { $$ = convert (void_type_node, integer_zero_node); }
| pushlevel maybe_label_decls compstmt_contents_nonempty '}' poplevel | push_scope maybe_label_decls compstmt_contents_nonempty '}' pop_scope
{ $$ = poplevel (KEEP_MAYBE, 0, 0); { $$ = pop_scope ();
SCOPE_STMT_BLOCK (TREE_PURPOSE ($5)) SCOPE_STMT_BLOCK (TREE_PURPOSE ($5))
= SCOPE_STMT_BLOCK (TREE_VALUE ($5)) = SCOPE_STMT_BLOCK (TREE_VALUE ($5))
= $$; } = $$; }
...@@ -2589,11 +2548,11 @@ start_string_translation: ...@@ -2589,11 +2548,11 @@ start_string_translation:
"void bar (int (__attribute__((__mode__(SI))) int foo));". */ "void bar (int (__attribute__((__mode__(SI))) int foo));". */
parmlist: parmlist:
maybe_attribute maybe_attribute
{ pushlevel (0); { push_scope ();
declare_parm_level (); } declare_parm_level (); }
parmlist_1 parmlist_1
{ $$ = $3; { $$ = $3;
poplevel (0, 0, 0); } pop_scope (); }
; ;
parmlist_1: parmlist_1:
...@@ -2606,32 +2565,23 @@ parmlist_1: ...@@ -2606,32 +2565,23 @@ parmlist_1:
parmlist_1 parmlist_1
{ $$ = $6; } { $$ = $6; }
| error ')' | error ')'
{ $$ = tree_cons (NULL_TREE, NULL_TREE, NULL_TREE); } { $$ = make_node (TREE_LIST); }
; ;
/* 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. */ Is value is represented in the format that grokdeclarator expects. */
parmlist_2: /* empty */ parmlist_2: /* empty */
{ $$ = get_parm_info (0); } { $$ = make_node (TREE_LIST); }
| ELLIPSIS | ELLIPSIS
{ $$ = get_parm_info (0); { $$ = make_node (TREE_LIST);
/* Gcc used to allow this as an extension. However, it does /* Suppress -Wold-style-definition for this case. */
not work for all targets, and thus has been disabled. TREE_CHAIN ($$) = error_mark_node;
Also, since func (...) and func () are indistinguishable,
it caused problems with the code in expand_builtin which
tries to verify that BUILT_IN_NEXT_ARG is being used
correctly. */
error ("ISO C requires a named argument before `...'"); error ("ISO C requires a named argument before `...'");
parsing_iso_function_signature = true;
} }
| parms | parms
{ $$ = get_parm_info (1); { $$ = get_parm_info (/*ellipsis=*/false); }
parsing_iso_function_signature = true;
}
| parms ',' ELLIPSIS | parms ',' ELLIPSIS
{ $$ = get_parm_info (0); { $$ = get_parm_info (/*ellipsis=*/true); }
parsing_iso_function_signature = true;
}
; ;
parms: parms:
...@@ -2706,11 +2656,11 @@ setspecs_fp: ...@@ -2706,11 +2656,11 @@ setspecs_fp:
Its value is a list of ..._TYPE nodes or a list of identifiers. */ Its value is a list of ..._TYPE nodes or a list of identifiers. */
parmlist_or_identifiers: parmlist_or_identifiers:
maybe_attribute maybe_attribute
{ pushlevel (0); { push_scope ();
declare_parm_level (); } declare_parm_level (); }
parmlist_or_identifiers_1 parmlist_or_identifiers_1
{ $$ = $3; { $$ = $3;
poplevel (0, 0, 0); } pop_scope (); }
; ;
parmlist_or_identifiers_1: parmlist_or_identifiers_1:
...@@ -3128,13 +3078,13 @@ optparmlist: ...@@ -3128,13 +3078,13 @@ optparmlist:
} }
| ',' | ','
{ {
pushlevel (0); push_scope ();
} }
parmlist_2 parmlist_2
{ {
/* returns a tree list node generated by get_parm_info */ /* returns a tree list node generated by get_parm_info */
$$ = $3; $$ = $3;
poplevel (0, 0, 0); pop_scope ();
} }
; ;
...@@ -3799,22 +3749,14 @@ yyprint (FILE *file, int yychar, YYSTYPE yyl) ...@@ -3799,22 +3749,14 @@ yyprint (FILE *file, int yychar, YYSTYPE yyl)
} }
} }
/* This is not the ideal place to put these, but we have to get them out /* This is not the ideal place to put this, but we have to get it out
of c-lex.c because cp/lex.c has its own versions. */ of c-lex.c because cp/lex.c has its own version. */
/* Parse the file. */ /* Parse the file. */
void void
c_parse_file (void) c_parse_file (void)
{ {
yyparse (); yyparse ();
/* In case there were missing closebraces, get us back to the global
binding level. */
while (! global_bindings_p ())
poplevel (0, 0, 0);
/* __FUNCTION__ is defined at file scope (""). This
call may not be necessary as my tests indicate it
still works without it. */
finish_fname_decls ();
if (malloced_yyss) if (malloced_yyss)
{ {
......
...@@ -24,22 +24,21 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA ...@@ -24,22 +24,21 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#include "c-common.h" #include "c-common.h"
/* Language-dependent contents of an identifier. */ /* Each C symbol points to three linked lists of c_binding structures.
These describe the values of the identifier in the three different
namespaces defined by the language. The contents of these lists
are private to c-decl.c. */
/* The limbo_value is used for block level extern declarations, which need struct c_binding;
to be type checked against subsequent extern declarations. They can't
be referenced after they fall out of scope, so they can't be global.
The rid_code field is used for keywords. It is in all /* Language-dependent contents of an identifier. */
lang_identifier nodes, because some keywords are only special in a
particular context. */
struct lang_identifier GTY(()) struct lang_identifier GTY(())
{ {
struct c_common_identifier common_id; struct c_common_identifier common_id;
tree symbol_value; struct c_binding *symbol_binding; /* vars, funcs, constants, typedefs */
tree tag_value; struct c_binding *tag_binding; /* struct/union/enum tags */
tree label_value; struct c_binding *label_binding; /* labels */
}; };
/* The resulting tree type. */ /* The resulting tree type. */
...@@ -64,26 +63,6 @@ struct lang_decl GTY(()) ...@@ -64,26 +63,6 @@ struct lang_decl GTY(())
tree pending_sizes; tree pending_sizes;
}; };
/* Macros for access to language-specific slots in an identifier. */
/* Each of these slots contains a DECL node or null. */
/* The value of the identifier in the namespace of "ordinary identifiers"
(data objects, enum constants, functions, typedefs). */
#define IDENTIFIER_SYMBOL_VALUE(NODE) \
(((struct lang_identifier *) (NODE))->symbol_value)
/* The value of the identifier in the namespace of struct, union,
and enum tags. */
#define IDENTIFIER_TAG_VALUE(NODE) \
(((struct lang_identifier *) (NODE))->tag_value)
/* The value of the identifier in the namespace of labels. */
#define IDENTIFIER_LABEL_VALUE(NODE) \
(((struct lang_identifier *) (NODE))->label_value)
/* In identifiers, C uses the following fields in a special way:
TREE_PUBLIC to record that there was a previous local extern decl.
TREE_USED to record that such a decl was used.
TREE_ADDRESSABLE to record that the address of such a decl was used. */
/* In a RECORD_TYPE or UNION_TYPE, nonzero if any component is read-only. */ /* In a RECORD_TYPE or UNION_TYPE, nonzero if any component is read-only. */
#define C_TYPE_FIELDS_READONLY(TYPE) TREE_LANG_FLAG_1 (TYPE) #define C_TYPE_FIELDS_READONLY(TYPE) TREE_LANG_FLAG_1 (TYPE)
...@@ -128,11 +107,13 @@ struct lang_type GTY(()) ...@@ -128,11 +107,13 @@ struct lang_type GTY(())
/* For a FUNCTION_DECL, nonzero if it was an implicit declaration. */ /* For a FUNCTION_DECL, nonzero if it was an implicit declaration. */
#define C_DECL_IMPLICIT(EXP) DECL_LANG_FLAG_2 (EXP) #define C_DECL_IMPLICIT(EXP) DECL_LANG_FLAG_2 (EXP)
/* Nonzero for a declaration of an external object which is not /* For any decl, nonzero if it is bound in the externals scope and
currently in scope. This is either a built-in declaration of pop_scope mustn't chain it into any higher block. */
a library function, before a real declaration has been seen, #define C_DECL_IN_EXTERNAL_SCOPE(EXP) DECL_LANG_FLAG_3 (EXP)
or a declaration that appeared in an inner scope that has ended. */
#define C_DECL_INVISIBLE(EXP) DECL_LANG_FLAG_3 (EXP) /* For FUNCTION_DECLs, evaluates true if the decl is built-in but has
been declared. */
#define C_DECL_DECLARED_BUILTIN(EXP) DECL_LANG_FLAG_4 (EXP)
/* Nonzero for a decl which either doesn't exist or isn't a prototype. /* Nonzero for a decl which either doesn't exist or isn't a prototype.
N.B. Could be simplified if all built-in decls had complete prototypes N.B. Could be simplified if all built-in decls had complete prototypes
...@@ -147,11 +128,6 @@ struct lang_type GTY(()) ...@@ -147,11 +128,6 @@ struct lang_type GTY(())
without prototypes. */ without prototypes. */
#define TYPE_ACTUAL_ARG_TYPES(NODE) TYPE_BINFO (NODE) #define TYPE_ACTUAL_ARG_TYPES(NODE) TYPE_BINFO (NODE)
/* Values for the first parameter to poplevel. */
#define KEEP_NO 0
#define KEEP_YES 1
#define KEEP_MAYBE 2
/* 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. */
...@@ -181,9 +157,9 @@ extern int c_in_case_stmt; ...@@ -181,9 +157,9 @@ extern int c_in_case_stmt;
extern int global_bindings_p (void); extern int global_bindings_p (void);
extern tree getdecls (void); extern tree getdecls (void);
extern void pushlevel (int); extern void push_scope (void);
extern tree pop_scope (void);
extern void insert_block (tree); extern void insert_block (tree);
extern void set_block (tree);
extern tree pushdecl (tree); extern tree pushdecl (tree);
extern void c_expand_body (tree); extern void c_expand_body (tree);
...@@ -203,12 +179,11 @@ extern void finish_decl (tree, tree, tree); ...@@ -203,12 +179,11 @@ 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 (int); extern tree get_parm_info (bool);
extern tree grokfield (tree, tree, tree); extern tree grokfield (tree, tree, tree);
extern tree groktypename (tree); extern tree groktypename (tree);
extern tree groktypename_in_parm_context (tree); extern tree groktypename_in_parm_context (tree);
extern tree implicitly_declare (tree); extern tree implicitly_declare (tree);
extern int in_parm_level_p (void);
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);
...@@ -216,7 +191,6 @@ extern void c_push_function_context (struct function *); ...@@ -216,7 +191,6 @@ 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 (tree);
extern tree pushdecl_top_level (tree); extern tree pushdecl_top_level (tree);
extern void pushtag (tree, tree);
extern tree set_array_declarator_type (tree, tree, int); extern tree set_array_declarator_type (tree, tree, int);
extern void shadow_tag (tree); extern void shadow_tag (tree);
extern void shadow_tag_warned (tree, int); extern void shadow_tag_warned (tree, int);
...@@ -230,7 +204,6 @@ extern tree c_begin_compound_stmt (void); ...@@ -230,7 +204,6 @@ extern tree c_begin_compound_stmt (void);
extern void c_expand_decl_stmt (tree); extern void c_expand_decl_stmt (tree);
extern void c_static_assembler_name (tree); extern void c_static_assembler_name (tree);
extern tree make_pointer_declarator (tree, tree); extern tree make_pointer_declarator (tree, tree);
extern void merge_translation_unit_decls (void);
/* in c-objc-common.c */ /* in c-objc-common.c */
extern int c_disregard_inline_limits (tree); extern int c_disregard_inline_limits (tree);
...@@ -257,6 +230,7 @@ enum { ...@@ -257,6 +230,7 @@ enum {
}; };
extern tree require_complete_type (tree); extern tree require_complete_type (tree);
extern int same_translation_unit_p (tree, tree);
extern int comptypes (tree, tree, int); extern int comptypes (tree, tree, int);
extern tree c_size_in_bytes (tree); extern tree c_size_in_bytes (tree);
extern bool c_mark_addressable (tree); extern bool c_mark_addressable (tree);
...@@ -313,6 +287,11 @@ extern int current_function_returns_abnormally; ...@@ -313,6 +287,11 @@ extern int current_function_returns_abnormally;
extern int system_header_p; extern int system_header_p;
/* True means global_bindings_p should return false even if the scope stack
says we are in file scope. */
extern bool c_override_global_bindings_to_false;
/* In c-decl.c */ /* In c-decl.c */
extern void c_finish_incomplete_decl (tree); extern void c_finish_incomplete_decl (tree);
extern void *get_current_scope (void); extern void *get_current_scope (void);
......
...@@ -51,7 +51,6 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA ...@@ -51,7 +51,6 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
static int missing_braces_mentioned; static int missing_braces_mentioned;
static tree qualify_type (tree, tree); static tree qualify_type (tree, tree);
static int same_translation_unit_p (tree, tree);
static int tagged_types_tu_compatible_p (tree, tree, int); static int tagged_types_tu_compatible_p (tree, tree, int);
static int comp_target_types (tree, tree, int); static int comp_target_types (tree, tree, int);
static int function_types_compatible_p (tree, tree, int); static int function_types_compatible_p (tree, tree, int);
...@@ -369,9 +368,9 @@ common_type (tree t1, tree t2) ...@@ -369,9 +368,9 @@ common_type (tree t1, tree t2)
/* If both args specify argument types, we must merge the two /* If both args specify argument types, we must merge the two
lists, argument by argument. */ lists, argument by argument. */
/* Tell global_bindings_p to return false so that variable_size
pushlevel (0); doesn't abort on VLAs in parameter types. */
declare_parm_level (); c_override_global_bindings_to_false = true;
len = list_length (p1); len = list_length (p1);
newargs = 0; newargs = 0;
...@@ -434,8 +433,7 @@ common_type (tree t1, tree t2) ...@@ -434,8 +433,7 @@ common_type (tree t1, tree t2)
parm_done: ; parm_done: ;
} }
poplevel (0, 0, 0); c_override_global_bindings_to_false = false;
t1 = build_function_type (valtype, newargs); t1 = build_function_type (valtype, newargs);
/* ... falls through ... */ /* ... falls through ... */
} }
...@@ -614,11 +612,11 @@ comp_target_types (tree ttl, tree ttr, int reflexive) ...@@ -614,11 +612,11 @@ comp_target_types (tree ttl, tree ttr, int reflexive)
/* Subroutines of `comptypes'. */ /* Subroutines of `comptypes'. */
/* Determine whether two types derive from the same translation unit. /* Determine whether two trees derive from the same translation unit.
If the CONTEXT chain ends in a null, that type's context is still If the CONTEXT chain ends in a null, that tree's context is still
being parsed, so if two types have context chains ending in null, being parsed, so if two trees have context chains ending in null,
they're in the same translation unit. */ they're in the same translation unit. */
static int int
same_translation_unit_p (tree t1, tree t2) same_translation_unit_p (tree t1, tree t2)
{ {
while (t1 && TREE_CODE (t1) != TRANSLATION_UNIT_DECL) while (t1 && TREE_CODE (t1) != TRANSLATION_UNIT_DECL)
......
...@@ -902,7 +902,6 @@ create_coverage (void) ...@@ -902,7 +902,6 @@ create_coverage (void)
DECL_RESULT (ctor) = build_decl (RESULT_DECL, NULL_TREE, void_type_node); DECL_RESULT (ctor) = build_decl (RESULT_DECL, NULL_TREE, void_type_node);
DECL_UNINLINABLE (ctor) = 1; DECL_UNINLINABLE (ctor) = 1;
ctor = lang_hooks.decls.pushdecl (ctor);
rest_of_decl_compilation (ctor, 0, 1, 0); rest_of_decl_compilation (ctor, 0, 1, 0);
announce_function (ctor); announce_function (ctor);
current_function_decl = ctor; current_function_decl = ctor;
......
2004-03-23 Zack Weinberg <zack@codesourcery.com>
PR 12267, 12391, 12560, 13129, 14114, 14113
* cp-lang.c (c_reset_state): Delete.
(push_file_scope, pop_file_scope): New stubs.
* parser.c (c_parse_file): Call sorry() here if called more than once.
2004-03-23 Richard Kenner <kenner@vlsi1.ultra.nyu.edu> 2004-03-23 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
* typeck.c (build_c_cast): Only look at TREE_CONSTANT_OVERFLOW * typeck.c (build_c_cast): Only look at TREE_CONSTANT_OVERFLOW
...@@ -17,13 +24,13 @@ ...@@ -17,13 +24,13 @@
(dump_simple_decl): Likewise. (dump_simple_decl): Likewise.
(dump_function_decl): Likewise. (dump_function_decl): Likewise.
(cv_to_string): Likewise. (cv_to_string): Likewise.
(dump_type_prefix): Likewise. Adjust return void. (dump_type_prefix): Likewise. Adjust return void.
* cxx-pretty-print.c (pp_cxx_cv_qualifier_seq): Move to * cxx-pretty-print.c (pp_cxx_cv_qualifier_seq): Move to
cxx_pretty_print.h. cxx_pretty_print.h.
(pp_cxx_template_keyword_if_needed): Document. (pp_cxx_template_keyword_if_needed): Document.
(pp_cxx_qualified_id): Document case FUNCTION_DECL. Tidy. (pp_cxx_qualified_id): Document case FUNCTION_DECL. Tidy.
(pp_cxx_expression): Handle NON_DEPENDENT_EXPR and (pp_cxx_expression): Handle NON_DEPENDENT_EXPR and
MUST_NOT_THROW_EXPR. MUST_NOT_THROW_EXPR.
2004-03-21 Mark Mitchell <mark@codesourcery.com> 2004-03-21 Mark Mitchell <mark@codesourcery.com>
...@@ -69,7 +76,7 @@ ...@@ -69,7 +76,7 @@
* typeck.c (lookup_destructor): Allow the use of destructors from * typeck.c (lookup_destructor): Allow the use of destructors from
base classes. base classes.
2004-03-19 Richard Kenner <kenner@vlsi1.ultra.nyu.edu> 2004-03-19 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
* cxx-pretty-print.c (pp_cxx_unqualified_id): Use * cxx-pretty-print.c (pp_cxx_unqualified_id): Use
...@@ -194,7 +201,7 @@ ...@@ -194,7 +201,7 @@
* pt.c (do_type_instantiation): On systems where weak symbols * pt.c (do_type_instantiation): On systems where weak symbols
don't go in a static archive's TOC, explicit instantiation of a don't go in a static archive's TOC, explicit instantiation of a
class must imply *explicit* instantiation of its memeber. class must imply *explicit* instantiation of its memeber.
2004-03-11 Kazu Hirata <kazu@cs.umass.edu> 2004-03-11 Kazu Hirata <kazu@cs.umass.edu>
* call.c, cp-tree.h, pt.c: Fix comment typos. * call.c, cp-tree.h, pt.c: Fix comment typos.
...@@ -203,7 +210,7 @@ ...@@ -203,7 +210,7 @@
PR c++/14510 PR c++/14510
* decl.c (xref_tag): Disregard non-type declarations when * decl.c (xref_tag): Disregard non-type declarations when
looking up a tagged type. looking up a tagged type.
2004-03-09 Nathan Sidwell <nathan@codesourcery.com> 2004-03-09 Nathan Sidwell <nathan@codesourcery.com>
...@@ -294,7 +301,7 @@ ...@@ -294,7 +301,7 @@
PR debug/14079 PR debug/14079
* name-lookup.c (add_decl_to_level): Add extern variables, as well * name-lookup.c (add_decl_to_level): Add extern variables, as well
as static, to static_decls array. as static, to static_decls array.
2004-03-05 Jason Merrill <jason@redhat.com> 2004-03-05 Jason Merrill <jason@redhat.com>
* tree.c (list_hash_pieces): s/TYPE_HASH/TREE_HASH/. * tree.c (list_hash_pieces): s/TYPE_HASH/TREE_HASH/.
...@@ -326,7 +333,7 @@ ...@@ -326,7 +333,7 @@
* parser.c (cp_parser_late_parsing_default_args): Check that there * parser.c (cp_parser_late_parsing_default_args): Check that there
are no extra tokens after the end of the default-argument are no extra tokens after the end of the default-argument
expression. expression.
2004-03-01 Mark Mitchell <mark@codesourcery.com> 2004-03-01 Mark Mitchell <mark@codesourcery.com>
PR c++/14324 PR c++/14324
...@@ -341,7 +348,7 @@ ...@@ -341,7 +348,7 @@
PR c++/14337 PR c++/14337
* pt.c (tsubst_qualified_id): Handle dependent qualifying scopes. * pt.c (tsubst_qualified_id): Handle dependent qualifying scopes.
(tsubst_expr): Do not call tsubst_copy, even when (tsubst_expr): Do not call tsubst_copy, even when
processing_template_decl. processing_template_decl.
2004-03-01 Jeff Law <law@redhat.com> 2004-03-01 Jeff Law <law@redhat.com>
...@@ -429,7 +436,7 @@ ...@@ -429,7 +436,7 @@
2004-02-23 Giovanni Bajo <giovannibajo@gcc.gnu.org> 2004-02-23 Giovanni Bajo <giovannibajo@gcc.gnu.org>
PR c++/14143 PR c++/14143
* name-lookup.c (arg_assoc_class): Don't look into template * name-lookup.c (arg_assoc_class): Don't look into template
arguments if it is not a primary template. arguments if it is not a primary template.
2004-02-20 John David Anglin <dave.anglin@nrc-cnrc.gc.ca> 2004-02-20 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
...@@ -464,7 +471,7 @@ ...@@ -464,7 +471,7 @@
2004-02-19 Giovanni Bajo <giovannibajo@gcc.gnu.org> 2004-02-19 Giovanni Bajo <giovannibajo@gcc.gnu.org>
PR c++/14181 PR c++/14181
* parser.c (cp_parser_new_expression): Parse an ill-formed * parser.c (cp_parser_new_expression): Parse an ill-formed
direct-new-declarator after a parenthesized type-id to emit good direct-new-declarator after a parenthesized type-id to emit good
diagnostic. diagnostic.
...@@ -640,7 +647,7 @@ ...@@ -640,7 +647,7 @@
whether or not a friend template is a definition. whether or not a friend template is a definition.
(tsubst_decl): Clear DECL_INITIAL for new FUNCTION_DECLs. (tsubst_decl): Clear DECL_INITIAL for new FUNCTION_DECLs.
* tree.c (build_zc_wrapper): Remove. * tree.c (build_zc_wrapper): Remove.
2004-02-12 Zack Weinberg <zack@codesourcery.com> 2004-02-12 Zack Weinberg <zack@codesourcery.com>
* cp-lang.c: Don't define LANG_HOOKS_BUILTIN_TYPE_DECLS. * cp-lang.c: Don't define LANG_HOOKS_BUILTIN_TYPE_DECLS.
......
...@@ -388,13 +388,6 @@ cp_var_mod_type_p (tree type) ...@@ -388,13 +388,6 @@ cp_var_mod_type_p (tree type)
return false; return false;
} }
/* Stub routine to tell people that this doesn't work yet. */
void
c_reset_state (void)
{
sorry ("inter-module optimisations not implemented yet");
}
/* Construct a C++-aware pretty-printer for CONTEXT. It is assumed /* Construct a C++-aware pretty-printer for CONTEXT. It is assumed
that CONTEXT->printer is an already constructed basic pretty_printer. */ that CONTEXT->printer is an already constructed basic pretty_printer. */
static void static void
...@@ -409,3 +402,14 @@ cxx_initialize_diagnostics (diagnostic_context *context) ...@@ -409,3 +402,14 @@ cxx_initialize_diagnostics (diagnostic_context *context)
/* It is safe to free this object because it was previously malloc()'d. */ /* It is safe to free this object because it was previously malloc()'d. */
free (base); free (base);
} }
/* Stubs to keep c-opts.c happy. */
void
push_file_scope (void)
{
}
void
pop_file_scope (void)
{
}
...@@ -15347,7 +15347,6 @@ cp_parser_allow_gnu_extensions_p (cp_parser* parser) ...@@ -15347,7 +15347,6 @@ cp_parser_allow_gnu_extensions_p (cp_parser* parser)
} }
/* The parser. */ /* The parser. */
static GTY (()) cp_parser *the_parser; static GTY (()) cp_parser *the_parser;
...@@ -15360,6 +15359,14 @@ void ...@@ -15360,6 +15359,14 @@ void
c_parse_file (void) c_parse_file (void)
{ {
bool error_occurred; bool error_occurred;
static bool already_called = false;
if (already_called)
{
sorry ("inter-module optimizations not implemented for C++");
return;
}
already_called = true;
the_parser = cp_parser_new (); the_parser = cp_parser_new ();
push_deferring_access_checks (flag_access_control push_deferring_access_checks (flag_access_control
......
...@@ -216,7 +216,7 @@ void ...@@ -216,7 +216,7 @@ void
lhd_clear_binding_stack (void) lhd_clear_binding_stack (void)
{ {
while (! lang_hooks.decls.global_bindings_p ()) while (! lang_hooks.decls.global_bindings_p ())
poplevel (0, 0, 0); lang_hooks.decls.poplevel (0, 0, 0);
} }
/* Type promotion for variable arguments. */ /* Type promotion for variable arguments. */
......
...@@ -64,8 +64,6 @@ Boston, MA 02111-1307, USA. */ ...@@ -64,8 +64,6 @@ Boston, MA 02111-1307, USA. */
#include "diagnostic.h" #include "diagnostic.h"
#include "cgraph.h" #include "cgraph.h"
#define OBJC_VOID_AT_END build_tree_list (NULL_TREE, void_type_node)
/* This is the default way of generating a method name. */ /* This is the default way of generating a method name. */
/* I am not sure it is really correct. /* I am not sure it is really correct.
Perhaps there's a danger that it will make name conflicts Perhaps there's a danger that it will make name conflicts
...@@ -161,7 +159,6 @@ static void generate_ivar_lists (void); ...@@ -161,7 +159,6 @@ static void generate_ivar_lists (void);
static void generate_dispatch_tables (void); static void generate_dispatch_tables (void);
static void generate_shared_structures (void); static void generate_shared_structures (void);
static tree generate_protocol_list (tree); static tree generate_protocol_list (tree);
static void generate_forward_declaration_to_string_table (void);
static void build_protocol_reference (tree); static void build_protocol_reference (tree);
static tree build_keyword_selector (tree); static tree build_keyword_selector (tree);
...@@ -1238,7 +1235,7 @@ synth_module_prologue (void) ...@@ -1238,7 +1235,7 @@ synth_module_prologue (void)
= build_function_type (IMP_type, = build_function_type (IMP_type,
tree_cons (NULL_TREE, id_type, tree_cons (NULL_TREE, id_type,
tree_cons (NULL_TREE, selector_type, tree_cons (NULL_TREE, selector_type,
OBJC_VOID_AT_END))); void_list_node)));
umsg_decl = builtin_function (TAG_MSGSEND, umsg_decl = builtin_function (TAG_MSGSEND,
temp_type, 0, NOT_BUILT_IN, temp_type, 0, NOT_BUILT_IN,
NULL, NULL_TREE); NULL, NULL_TREE);
...@@ -1248,7 +1245,7 @@ synth_module_prologue (void) ...@@ -1248,7 +1245,7 @@ synth_module_prologue (void)
= build_function_type (IMP_type, = build_function_type (IMP_type,
tree_cons (NULL_TREE, super_type, tree_cons (NULL_TREE, super_type,
tree_cons (NULL_TREE, selector_type, tree_cons (NULL_TREE, selector_type,
OBJC_VOID_AT_END))); void_list_node)));
umsg_super_decl = builtin_function (TAG_MSGSENDSUPER, umsg_super_decl = builtin_function (TAG_MSGSENDSUPER,
temp_type, 0, NOT_BUILT_IN, temp_type, 0, NOT_BUILT_IN,
NULL, NULL_TREE); NULL, NULL_TREE);
...@@ -1259,7 +1256,7 @@ synth_module_prologue (void) ...@@ -1259,7 +1256,7 @@ synth_module_prologue (void)
temp_type = build_function_type (id_type, temp_type = build_function_type (id_type,
tree_cons (NULL_TREE, tree_cons (NULL_TREE,
const_string_type_node, const_string_type_node,
OBJC_VOID_AT_END)); void_list_node));
objc_get_class_decl objc_get_class_decl
= builtin_function (TAG_GETCLASS, temp_type, 0, NOT_BUILT_IN, = builtin_function (TAG_GETCLASS, temp_type, 0, NOT_BUILT_IN,
...@@ -1305,8 +1302,6 @@ synth_module_prologue (void) ...@@ -1305,8 +1302,6 @@ synth_module_prologue (void)
TREE_USED (UOBJC_SELECTOR_TABLE_decl) = 1; TREE_USED (UOBJC_SELECTOR_TABLE_decl) = 1;
} }
generate_forward_declaration_to_string_table ();
/* Forward declare constant_string_id and constant_string_type. */ /* Forward declare constant_string_id and constant_string_type. */
if (!constant_string_class_name) if (!constant_string_class_name)
constant_string_class_name = default_constant_string_class_name; constant_string_class_name = default_constant_string_class_name;
...@@ -1877,7 +1872,7 @@ build_module_descriptor (void) ...@@ -1877,7 +1872,7 @@ build_module_descriptor (void)
get_identifier (TAG_EXECCLASS), get_identifier (TAG_EXECCLASS),
build_function_type (void_type_node, build_function_type (void_type_node,
tree_cons (NULL_TREE, ptr_type_node, tree_cons (NULL_TREE, ptr_type_node,
OBJC_VOID_AT_END))); void_list_node)));
DECL_EXTERNAL (execclass_decl) = 1; DECL_EXTERNAL (execclass_decl) = 1;
DECL_ARTIFICIAL (execclass_decl) = 1; DECL_ARTIFICIAL (execclass_decl) = 1;
...@@ -1892,7 +1887,7 @@ build_module_descriptor (void) ...@@ -1892,7 +1887,7 @@ build_module_descriptor (void)
start_function (void_list_node_1, start_function (void_list_node_1,
build_nt (CALL_EXPR, init_function_name, build_nt (CALL_EXPR, init_function_name,
tree_cons (NULL_TREE, NULL_TREE, tree_cons (NULL_TREE, NULL_TREE,
OBJC_VOID_AT_END), void_list_node),
NULL_TREE), NULL_TREE),
NULL_TREE); NULL_TREE);
store_parm_decls (); store_parm_decls ();
...@@ -1919,22 +1914,6 @@ build_module_descriptor (void) ...@@ -1919,22 +1914,6 @@ build_module_descriptor (void)
} }
} }
/* extern const char _OBJC_STRINGS[]; */
static void
generate_forward_declaration_to_string_table (void)
{
tree sc_spec, decl_specs, expr_decl;
sc_spec = tree_cons (NULL_TREE, ridpointers[(int) RID_EXTERN], NULL_TREE);
decl_specs = tree_cons (NULL_TREE, ridpointers[(int) RID_CHAR], sc_spec);
expr_decl
= build_nt (ARRAY_REF, get_identifier ("_OBJC_STRINGS"), NULL_TREE);
UOBJC_STRINGS_decl = define_decl (expr_decl, decl_specs);
}
/* Return the DECL of the string IDENT in the SECTION. */ /* Return the DECL of the string IDENT in the SECTION. */
static tree static tree
...@@ -2699,7 +2678,7 @@ objc_enter_block (void) ...@@ -2699,7 +2678,7 @@ objc_enter_block (void)
block = begin_compound_stmt (0); block = begin_compound_stmt (0);
#else #else
block = c_begin_compound_stmt (); block = c_begin_compound_stmt ();
pushlevel (0); push_scope ();
clear_last_expr (); clear_last_expr ();
add_scope_stmt (/*begin_p=*/1, /*partial_p=*/0); add_scope_stmt (/*begin_p=*/1, /*partial_p=*/0);
#endif #endif
...@@ -2724,7 +2703,7 @@ objc_exit_block (void) ...@@ -2724,7 +2703,7 @@ objc_exit_block (void)
finish_compound_stmt (0, block); finish_compound_stmt (0, block);
#else #else
scope_stmt = add_scope_stmt (/*begin_p=*/0, /*partial_p=*/0); scope_stmt = add_scope_stmt (/*begin_p=*/0, /*partial_p=*/0);
inner = poplevel (KEEP_MAYBE, 1, 0); inner = pop_scope ();
SCOPE_STMT_BLOCK (TREE_PURPOSE (scope_stmt)) SCOPE_STMT_BLOCK (TREE_PURPOSE (scope_stmt))
= SCOPE_STMT_BLOCK (TREE_VALUE (scope_stmt)) = SCOPE_STMT_BLOCK (TREE_VALUE (scope_stmt))
...@@ -3331,7 +3310,7 @@ build_objc_exception_stuff (void) ...@@ -3331,7 +3310,7 @@ build_objc_exception_stuff (void)
= build_function_type (id_type, = build_function_type (id_type,
tree_cons (NULL_TREE, tree_cons (NULL_TREE,
build_pointer_type (objc_exception_data_template), build_pointer_type (objc_exception_data_template),
OBJC_VOID_AT_END)); void_list_node));
objc_exception_extract_decl objc_exception_extract_decl
= builtin_function (TAG_EXCEPTIONEXTRACT, temp_type, 0, NOT_BUILT_IN, NULL, NULL_TREE); = builtin_function (TAG_EXCEPTIONEXTRACT, temp_type, 0, NOT_BUILT_IN, NULL, NULL_TREE);
/* void objc_exception_try_enter(struct _objc_exception_data *); */ /* void objc_exception_try_enter(struct _objc_exception_data *); */
...@@ -3340,7 +3319,7 @@ build_objc_exception_stuff (void) ...@@ -3340,7 +3319,7 @@ build_objc_exception_stuff (void)
= build_function_type (void_type_node, = build_function_type (void_type_node,
tree_cons (NULL_TREE, tree_cons (NULL_TREE,
build_pointer_type (objc_exception_data_template), build_pointer_type (objc_exception_data_template),
OBJC_VOID_AT_END)); void_list_node));
objc_exception_try_enter_decl objc_exception_try_enter_decl
= builtin_function (TAG_EXCEPTIONTRYENTER, temp_type, 0, NOT_BUILT_IN, NULL, NULL_TREE); = builtin_function (TAG_EXCEPTIONTRYENTER, temp_type, 0, NOT_BUILT_IN, NULL, NULL_TREE);
objc_exception_try_exit_decl objc_exception_try_exit_decl
...@@ -3350,7 +3329,7 @@ build_objc_exception_stuff (void) ...@@ -3350,7 +3329,7 @@ build_objc_exception_stuff (void)
/* void objc_sync_exit(id); */ /* void objc_sync_exit(id); */
temp_type = build_function_type (void_type_node, temp_type = build_function_type (void_type_node,
tree_cons (NULL_TREE, id_type, tree_cons (NULL_TREE, id_type,
OBJC_VOID_AT_END)); void_list_node));
objc_exception_throw_decl objc_exception_throw_decl
= builtin_function (TAG_EXCEPTIONTHROW, temp_type, 0, NOT_BUILT_IN, NULL, NULL_TREE); = builtin_function (TAG_EXCEPTIONTHROW, temp_type, 0, NOT_BUILT_IN, NULL, NULL_TREE);
DECL_ATTRIBUTES (objc_exception_throw_decl) DECL_ATTRIBUTES (objc_exception_throw_decl)
...@@ -3363,7 +3342,7 @@ build_objc_exception_stuff (void) ...@@ -3363,7 +3342,7 @@ build_objc_exception_stuff (void)
temp_type = build_function_type (integer_type_node, temp_type = build_function_type (integer_type_node,
tree_cons (NULL_TREE, id_type, tree_cons (NULL_TREE, id_type,
tree_cons (NULL_TREE, id_type, tree_cons (NULL_TREE, id_type,
OBJC_VOID_AT_END))); void_list_node)));
objc_exception_match_decl objc_exception_match_decl
= builtin_function (TAG_EXCEPTIONMATCH, temp_type, 0, NOT_BUILT_IN, NULL, NULL_TREE); = builtin_function (TAG_EXCEPTIONMATCH, temp_type, 0, NOT_BUILT_IN, NULL, NULL_TREE);
...@@ -5463,7 +5442,7 @@ get_arg_type_list (tree meth, int context, int superflag) ...@@ -5463,7 +5442,7 @@ get_arg_type_list (tree meth, int context, int superflag)
if (METHOD_ADD_ARGS (meth) == objc_ellipsis_node) if (METHOD_ADD_ARGS (meth) == objc_ellipsis_node)
/* We have a `, ...' immediately following the selector, /* We have a `, ...' immediately following the selector,
finalize the arglist...simulate get_parm_info (0). */ finalize the arglist...simulate get_parm_info (true). */
; ;
else if (METHOD_ADD_ARGS (meth)) else if (METHOD_ADD_ARGS (meth))
{ {
...@@ -5472,8 +5451,8 @@ get_arg_type_list (tree meth, int context, int superflag) ...@@ -5472,8 +5451,8 @@ get_arg_type_list (tree meth, int context, int superflag)
chainon (arglist, add_arg_list); chainon (arglist, add_arg_list);
} }
else else
/* finalize the arglist...simulate get_parm_info (1) */ /* finalize the arglist...simulate get_parm_info (false) */
chainon (arglist, OBJC_VOID_AT_END); chainon (arglist, void_list_node);
return arglist; return arglist;
} }
...@@ -7539,7 +7518,8 @@ start_method_def (tree method) ...@@ -7539,7 +7518,8 @@ start_method_def (tree method)
UOBJC_SUPER_decl = NULL_TREE; UOBJC_SUPER_decl = NULL_TREE;
/* Must be called BEFORE start_function. */ /* Must be called BEFORE start_function. */
pushlevel (0); push_scope ();
declare_parm_level ();
/* Generate prototype declarations for arguments..."new-style". */ /* Generate prototype declarations for arguments..."new-style". */
synth_self_and_ucmd_args (); synth_self_and_ucmd_args ();
...@@ -7819,9 +7799,9 @@ continue_method_def (void) ...@@ -7819,9 +7799,9 @@ continue_method_def (void)
if (METHOD_ADD_ARGS (objc_method_context) == objc_ellipsis_node) if (METHOD_ADD_ARGS (objc_method_context) == objc_ellipsis_node)
/* We have a `, ...' immediately following the selector. */ /* We have a `, ...' immediately following the selector. */
parmlist = get_parm_info (0); parmlist = get_parm_info (/*ellipsis=*/true);
else else
parmlist = get_parm_info (1); /* place a `void_at_end' */ parmlist = get_parm_info (/*ellipsis=*/false);
#ifndef OBJCPLUS #ifndef OBJCPLUS
/* Set self_decl from the first argument...this global is used by /* Set self_decl from the first argument...this global is used by
...@@ -7829,7 +7809,7 @@ continue_method_def (void) ...@@ -7829,7 +7809,7 @@ continue_method_def (void)
self_decl = TREE_PURPOSE (parmlist); self_decl = TREE_PURPOSE (parmlist);
#endif /* !OBJCPLUS */ #endif /* !OBJCPLUS */
poplevel (0, 0, 0); pop_scope ();
really_start_method (objc_method_context, parmlist); really_start_method (objc_method_context, parmlist);
store_parm_decls (); store_parm_decls ();
} }
...@@ -8801,8 +8781,6 @@ finish_objc (void) ...@@ -8801,8 +8781,6 @@ finish_objc (void)
objc_implementation_context = NULL_TREE; objc_implementation_context = NULL_TREE;
} }
generate_forward_declaration_to_string_table ();
/* Process the static instances here because initialization of objc_symtab /* Process the static instances here because initialization of objc_symtab
depends on them. */ depends on them. */
if (objc_static_instances) if (objc_static_instances)
......
...@@ -234,7 +234,6 @@ enum objc_tree_index ...@@ -234,7 +234,6 @@ enum objc_tree_index
OCTI_MCLS_DECL, OCTI_MCLS_DECL,
OCTI_SEL_TABLE_DECL, OCTI_SEL_TABLE_DECL,
OCTI_MODULES_DECL, OCTI_MODULES_DECL,
OCTI_STRG_DECL,
OCTI_INTF_CTX, OCTI_INTF_CTX,
OCTI_IMPL_CTX, OCTI_IMPL_CTX,
...@@ -360,7 +359,6 @@ extern GTY(()) tree objc_global_trees[OCTI_MAX]; ...@@ -360,7 +359,6 @@ extern GTY(()) tree objc_global_trees[OCTI_MAX];
#define UOBJC_METACLASS_decl objc_global_trees[OCTI_MCLS_DECL] #define UOBJC_METACLASS_decl objc_global_trees[OCTI_MCLS_DECL]
#define UOBJC_SELECTOR_TABLE_decl objc_global_trees[OCTI_SEL_TABLE_DECL] #define UOBJC_SELECTOR_TABLE_decl objc_global_trees[OCTI_SEL_TABLE_DECL]
#define UOBJC_MODULES_decl objc_global_trees[OCTI_MODULES_DECL] #define UOBJC_MODULES_decl objc_global_trees[OCTI_MODULES_DECL]
#define UOBJC_STRINGS_decl objc_global_trees[OCTI_STRG_DECL]
/* The following are used when compiling a class implementation. /* The following are used when compiling a class implementation.
implementation_template will normally be an interface, however if implementation_template will normally be an interface, however if
......
...@@ -55,6 +55,8 @@ enum c_language_kind c_language = clk_objc; ...@@ -55,6 +55,8 @@ enum c_language_kind c_language = clk_objc;
#define LANG_HOOKS_SAFE_FROM_P c_safe_from_p #define LANG_HOOKS_SAFE_FROM_P c_safe_from_p
#undef LANG_HOOKS_PARSE_FILE #undef LANG_HOOKS_PARSE_FILE
#define LANG_HOOKS_PARSE_FILE c_common_parse_file #define LANG_HOOKS_PARSE_FILE c_common_parse_file
#undef LANG_HOOKS_CLEAR_BINDING_STACK
#define LANG_HOOKS_CLEAR_BINDING_STACK lhd_do_nothing
#undef LANG_HOOKS_EXPAND_EXPR #undef LANG_HOOKS_EXPAND_EXPR
#define LANG_HOOKS_EXPAND_EXPR c_expand_expr #define LANG_HOOKS_EXPAND_EXPR c_expand_expr
#undef LANG_HOOKS_MARK_ADDRESSABLE #undef LANG_HOOKS_MARK_ADDRESSABLE
...@@ -130,6 +132,19 @@ enum c_language_kind c_language = clk_objc; ...@@ -130,6 +132,19 @@ enum c_language_kind c_language = clk_objc;
#undef LANG_HOOKS_TYPE_PROMOTES_TO #undef LANG_HOOKS_TYPE_PROMOTES_TO
#define LANG_HOOKS_TYPE_PROMOTES_TO c_type_promotes_to #define LANG_HOOKS_TYPE_PROMOTES_TO c_type_promotes_to
/* The C front end's scoping structure is very different from
that expected by the language-independent code; it is best
to disable all of pushlevel, poplevel, set_block, and getdecls.
This means it must also provide its own write_globals. */
#undef LANG_HOOKS_PUSHLEVEL
#define LANG_HOOKS_PUSHLEVEL lhd_do_nothing_i
#undef LANG_HOOKS_POPLEVEL
#define LANG_HOOKS_POPLEVEL lhd_do_nothing_iii_return_null_tree
#undef LANG_HOOKS_SET_BLOCK
#define LANG_HOOKS_SET_BLOCK lhd_do_nothing_t
#undef LANG_HOOKS_GETDECLS
#define LANG_HOOKS_GETDECLS lhd_return_null_tree_v
#undef LANG_HOOKS_WRITE_GLOBALS #undef LANG_HOOKS_WRITE_GLOBALS
#define LANG_HOOKS_WRITE_GLOBALS c_write_global_declarations #define LANG_HOOKS_WRITE_GLOBALS c_write_global_declarations
......
2004-03-23 Zack Weinberg <zack@codesourcery.com>
PR 12267, 12391, 12560, 13129, 14114, 14113
* gcc.dg/Wold-style-definition-1.c, gcc.dg/builtins-30.c
* gcc.dg/unused-4.c, gcc.dg/noncompile/label-1.c
* gcc.dg/noncompile/label-lineno-1.c, objc.dg/naming-1.m:
Adjust error regexps.
* gcc.dg/Wshadow-2.c, gcc.dg/noncompile/incomplete-3.c
* gcc.dg/noncompile/undeclared-1.c: New test cases.
* gcc.dg/decl-5.c, gcc.dg/redecl-1.c: Remove XFAIL.
* gcc.dg/local1.c: Add explanatory comment.
2004-03-23 Roger Sayle <roger@eyesopen.com> 2004-03-23 Roger Sayle <roger@eyesopen.com>
PR optimization/14669 PR optimization/14669
...@@ -55,11 +67,11 @@ ...@@ -55,11 +67,11 @@
* g++.dg/template/spec13.C: New test. * g++.dg/template/spec13.C: New test.
* g++.dg/lookup/using11.C: New test. * g++.dg/lookup/using11.C: New test.
* g++.dg/lookup/koenig3.C: New test. * g++.dg/lookup/koenig3.C: New test.
* g++.dg/template/operator2.C: New test. * g++.dg/template/operator2.C: New test.
* g++.dg/expr/dtor3.C: New test. * g++.dg/expr/dtor3.C: New test.
* g++.old-deja/g++.brendan/crash15.C: Remove incorrect dg-error * g++.old-deja/g++.brendan/crash15.C: Remove incorrect dg-error
marker. marker.
......
...@@ -5,19 +5,19 @@ ...@@ -5,19 +5,19 @@
/* { dg-options "-Wold-style-definition" } */ /* { dg-options "-Wold-style-definition" } */
void void
bar (a) int a; { } /* { dg-warning "old-style parameter declaration" } */ bar (a) int a; { } /* { dg-warning "old-style function definition" } */
void bar1 () {} /* { dg-warning "old-style parameter declaration" } */ void bar1 () {} /* { dg-warning "old-style function definition" } */
extern void bar2 (void); extern void bar2 (void);
void bar2 () {} /* { dg-warning "old-style parameter declaration" } */ void bar2 () {} /* { dg-warning "old-style function definition" } */
extern void bar3 (int); extern void bar3 (int);
void bar3 (a) {} /* { dg-warning "old-style parameter declaration" } */ void bar3 (a) {} /* { dg-warning "old-style function definition" } */
void bar4 (a) {} /* { dg-warning "old-style parameter declaration" } */ void bar4 (a) {} /* { dg-warning "old-style function definition" } */
void bar5 (int a) {} void bar5 (int a) {}
......
/* Bogus warning for a double declaration of the same extern variable,
first at file scope, then at block scope. PR 13129. */
/* { dg-options "-Wshadow" } */
extern struct foo bar;
void dummy()
{
extern struct foo bar; /* { dg-bogus "shadows" } */
}
...@@ -7,20 +7,20 @@ extern double strtod (const char *, char **); ...@@ -7,20 +7,20 @@ extern double strtod (const char *, char **);
/* A built-in function may be overridden by an old-style definition /* A built-in function may be overridden by an old-style definition
specifying too few arguments... */ specifying too few arguments... */
double cos () double cos ()
{ /* { dg-warning "shadowing built-in" } */ { /* { dg-warning "shadows a built-in" } */
return strtod ("nan", 0); return strtod ("nan", 0);
} }
/* the right number, but the wrong type, arguments... */ /* the right number, but the wrong type, arguments... */
double sin (foo) double sin (foo)
int foo UNUSED; /* { dg-warning "shadowing built-in" } */ int foo UNUSED; /* { dg-warning "shadows a built-in" } */
{ {
return strtod ("nan", 0); return strtod ("nan", 0);
} }
/* or too many arguments. */ /* or too many arguments. */
long double cosl (foo, bar) long double cosl (foo, bar)
long double foo UNUSED; /* { dg-warning "shadowing built-in" } */ const char *foo UNUSED; /* { dg-warning "shadows a built-in" } */
int bar UNUSED; int bar UNUSED;
{ {
return strtod ("nan", 0); return strtod ("nan", 0);
......
...@@ -10,7 +10,7 @@ void a() ...@@ -10,7 +10,7 @@ void a()
{ {
void c(); void c();
c(); c();
} /* { dg-bogus "error" "PR c/14114" { xfail *-*-* } } */ }
void b() void b()
{ {
......
/* This is allowed, with the effect that the 'extern' declaration at block
scope refers to the same object as the 'static' declaration at file scope.
C90 6.1.2.2 [as corrected by TC1], C99 6.2.2:
For an identifier declared with the storage-class specifier
extern in a scope in which a prior declaration of that
identifier is visible, if the prior declaration specifies
internal or external linkage, the linkage of the identifier at
the later daclaration is the same as the linkage specified at
the prior declaration. If no prior declaration is visible,
or if the prior declaration specifies no linkage, then the
identifer has external linkage.
This is PR 14366. */
static int i; static int i;
extern int i; extern int i;
......
/* Both occurrences of "c" should get diagnostics. PR 12391. */
typedef struct { int a; } b_t;
int foo (void)
{
b_t d;
struct b_t *c = &d; /* { dg-warning "incompatible pointer type" } */
c->a; /* { dg-error "incomplete type" } */
}
...@@ -28,7 +28,7 @@ void c(void) ...@@ -28,7 +28,7 @@ void c(void)
/* can't have two labels with the same name in the same function */ /* can't have two labels with the same name in the same function */
void d(void) void d(void)
{ {
l: dummy(); /* { dg-error "previously defined" "prev def same scope" } */ l: dummy(); /* { dg-error "previous definition" "prev def same scope" } */
l: dummy(); /* { dg-error "duplicate label" "dup label same scope" } */ l: dummy(); /* { dg-error "duplicate label" "dup label same scope" } */
goto l; goto l;
} }
...@@ -36,7 +36,7 @@ void d(void) ...@@ -36,7 +36,7 @@ void d(void)
/* even at different scopes */ /* even at different scopes */
void e(void) void e(void)
{ {
l: dummy(); /* { dg-error "previously defined" "prev def diff scope" } */ l: dummy(); /* { dg-error "previous definition" "prev def diff scope" } */
{ {
l: dummy(); /* { dg-error "duplicate label" "dup label diff scope" } */ l: dummy(); /* { dg-error "duplicate label" "dup label diff scope" } */
} }
...@@ -150,7 +150,7 @@ void m(void) ...@@ -150,7 +150,7 @@ void m(void)
void n(void) void n(void)
{ {
__label__ l; /* { dg-error "previously declared" "outer label decl" } */ __label__ l; /* { dg-error "previous declaration" "outer label decl" } */
void nest(void) void nest(void)
{ {
l: goto l; /* { dg-error "duplicate label" "inner label defn" } */ l: goto l; /* { dg-error "duplicate label" "inner label defn" } */
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
void void
foo(int i) foo(int i)
{ {
my_label: /* { dg-error "previously defined" "prev label" } */ my_label: /* { dg-error "previous definition" "prev label" } */
i++; i++;
......
/* Test for no ICE with an undeclared identifier in an enum in old-style
parameter decls. PR 12560. */
/* { dg-options "-w" } */
foo(c)
enum { a = b } c; /* { dg-error "undeclared|for each" } */
{
}
...@@ -64,7 +64,7 @@ void test4(void) ...@@ -64,7 +64,7 @@ void test4(void)
void prime5(void) void prime5(void)
{ {
extern double bar5(double); /* { dg-error "previous" "" { xfail *-*-* } } */ extern double bar5(double); /* { dg-error "previous" "" } */
} }
void test5(void) void test5(void)
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-options "-Wunused -O3" } */ /* { dg-options "-Wunused -O3" } */
static const int i = 0; static const int i = 0; /* { dg-warning "unused variable" } */
static void f() { } /* { dg-warning "defined but not used" } */ static void f() { } /* { dg-warning "defined but not used" } */
static inline void g() { } static inline void g() { }
...@@ -9,9 +9,7 @@ void foo(void) ...@@ -9,9 +9,7 @@ void foo(void)
{ {
int View; /* ok */ int View; /* ok */
View = 1; /* ok */ View = 1; /* ok */
View *view; /* { dg-error "`view' undeclared" } */ View *view; /* { dg-error "undeclared|only once|it appears" } */
/* { dg-error "is reported only once" "" { target *-*-* } 12 } */
/* { dg-error "function it appears in" "" { target *-*-* } 12 } */
} }
void bar(void) void bar(void)
......
...@@ -941,11 +941,23 @@ chain_member (tree elem, tree chain) ...@@ -941,11 +941,23 @@ chain_member (tree elem, tree chain)
int int
list_length (tree t) list_length (tree t)
{ {
tree tail; tree p = t;
#ifdef ENABLE_TREE_CHECKING
tree q = t;
#endif
int len = 0; int len = 0;
for (tail = t; tail; tail = TREE_CHAIN (tail)) while (p)
len++; {
p = TREE_CHAIN (p);
#ifdef ENABLE_TREE_CHECKING
if (len % 2)
q = TREE_CHAIN (q);
if (p == q)
abort ();
#endif
len++;
}
return len; return len;
} }
......
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