Commit Graph

281 Commits

Author SHA1 Message Date
Diego Novillo 6de9cd9a88 Merge tree-ssa-20020619-branch into mainline.
From-SVN: r81764
2004-05-13 02:41:07 -04:00
Zack Weinberg f75fbaf754 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
2004-03-23 23:47:53 +00:00
Eric Christopher 2152660651 target-supports.exp (check-iconv-available): New function.
2004-02-26  Eric Christopher  <echristo@redhat.com>

	* lib/target-supports.exp (check-iconv-available): New function.
	* lib/gcc-dg.exp (dg-require-iconv): New function.
	Use above.
        * gcc.dg/charset: New directory.
        * gcc.dg/charset/charset.exp: New file.
        * gcc.dg/charset/asm1.c: Ditto.
        * gcc.dg/charset/asm2.c: Ditto.
        * gcc.dg/charset/asm3.c: Ditto.
        * gcc.dg/charset/asm4.c: Ditto.
        * gcc.dg/charset/asm5.c: Ditto.
        * gcc.dg/charset/attribute1.c: Ditto.
        * gcc.dg/charset/attribute2.c: Ditto.
        * gcc.dg/charset/string1.c: Ditto.
        * g++.dg/charset: New directory.
        * g++.dg/dg.exp: Add here. Special options.
        * g++.dg/charset/charset.exp: New file.
        * g++.dg/charset/asm1.c: Ditto.
        * g++.dg/charset/asm2.c: Ditto.
        * g++.dg/charset/asm3.c: Ditto.
        * g++.dg/charset/asm4.c: Ditto.
        * g++.dg/charset/attribute1.c: Ditto.
        * g++.dg/charset/attribute2.c: Ditto.
        * g++.dg/charset/extern1.cc: Ditto.
        * g++.dg/charset/extern2.cc: Ditto.
        * g++.dg/charset/string1.c: Ditto.

2004-02-26  Eric Christopher  <echristo@redhat.com>

	* c-lex.c (c_lex_string_translate): New variable.
	(lex_string): Use to determine string translation.
	* c-pragma.h: Prototype.
	* c-parse.in (start_string_translation): New. Set above.
	(stop_string_translation): Ditto.
	(attribute, attribute_list, asm_def, asm_stmt,
	asm_operand): Use above functions.
	* cp/parser.c (cp_parser_declaration): Translate strings
	unless token is RID_EXTERN. Set c_lex_string_translate
	for recursive use.
	(cp_parser_asm_definition): Only translate argument strings
	to asms.
	(cp_parser_asm_operand_list): Ditto.
	(cp_parser_attribute_list): Do not translate attribute strings.

From-SVN: r78548
2004-02-27 02:01:10 +00:00
Zack Weinberg 8507c40abc dbxout.c: Move declaration of dbxout_type_decl outside #ifdef DBX_DEBUGGING_INFO.
* dbxout.c: Move declaration of dbxout_type_decl outside
	#ifdef DBX_DEBUGGING_INFO.
	* c-parse.in: Don't give the asmdef production a type.

From-SVN: r77732
2004-02-12 23:35:19 +00:00
Zack Weinberg 9f0e2d86e2 c-parse.in (maybe_type_qual): Delete.
* c-parse.in (maybe_type_qual): Delete.
	(maybe_volatile, simple_asm_expr, asmdef, asm_stmt)
	(asm_argument): New grammar rules.
	(extdef_1): Use asmdef.
	(maybeasm): Move down with other asm rules; use simple_asm_expr.
	(xexpr): Move up with other expression rules.
	(stmt): Use asm_stmt.

	* c-typeck.c (build_asm_expr): New function - body mostly
	pulled from build_asm_stmt.
	(build_asm_stmt): Just handle tacking on the volatile qualifier.
	* c-tree.h (build_asm_expr, build_asm_stmt): Update prototypes.

From-SVN: r77723
2004-02-12 19:14:05 +00:00
Joseph Myers b46b8fb40c README.Portability: Change "ISO C89" to "ISO C90".
* README.Portability: Change "ISO C89" to "ISO C90".
	* c-parse.in (primary, initelt): Likewise.

testsuite:
	* gcc.dg/c90-init-1.c: Adjust expected error messages.

From-SVN: r77499
2004-02-08 20:55:34 +00:00
Zack Weinberg a6f78652f3 c-common.c (shadow_warning): Delete.
* c-common.c (shadow_warning): Delete.
	* c-common.h (free_parser_stacks, shadow_warning, sw_kind): Delete.
	* c-decl.c (warn_if_shadowing): Issue shadow warnings directly.
	* c-opts.c (c_common_parse_file): Don't call free_parser_stacks.
	* c-parse.in (free_parser_stacks): Delete.
cp:
	* name-lookup.c (pushdecl): Issue shadow warnings directly.
	* parser.c (free_parser_stacks): Delete.
testsuite:
	* gcc.c-torture/execute/string-opt-15.c: Define memcmp with void *
	arguments.
	* gcc.dg/fwritable-strings-1.c: Expect the deprecation notice.
------
	Bug 13856
	* c-decl.c (diagnose_mismatched_decls): Only give special
	treatment when olddecl is DECL_BUILT_IN, if C_DECL_INVISIBLE
	is also true.
	(merge_decls): Don't clear DECL_BUILT_IN_CLASS and
	DECL_FUNCTION_CODE when defining a built-in function.
	Don't update DECL_ESTIMATED_INSNS.
	* dwarf2out.c (dwarf2out_decl): Don't ignore built-in
	FUNCTION_DECLs.
	* tree.h: Delete DECL_ESTIMATED_INSNS.
	* tree-inline.c (struct inline_data): Delete inlined_insns field.
	(expand_call_inline, optimize_inline_calls): Don't update
	DECL_ESTIMATED_INSNS nor inlined_insns.
	* cgraphunit.c (cgraph_analyze_function): Don't update
	DECL_ESTIMATED_INSNS.
cp:
	* optimize.c (maybe_clone_body): Don't update DECL_ESTIMATED_INSNS.
	* decl.c (duplicate_decls, start_function): Likewise.
testsuite:
	* gcc.dg/visibility-8.c: New testcase.

From-SVN: r77475
2004-02-08 01:59:11 +00:00
Paolo Bonzini e57e265ba6 re PR c/11658 (Wrong error message)
2004-02-03  Paolo Bonzini  <bonzini@gnu.org>

	PR c/11658
	PR c/13994
	* Makefile.in (c-parse.o, c-convert.o, c-typeck.o): Depend
	on langhooks.h.
	* objc/Make-lang.in (objc-parse.o): Depend on langhooks.h.
	* c-parse.in, c-convert.c, c-typeck.c, objc/objc-act.c:
	Include langhooks.h.  Replace c_common_truthvalue_conversion
	with the truthvalue_conversion language hook throughout.
	(expr_no_commas): Call default_conversion before save_expr
	for the first term of the production 'x ? : y'.
	* c-common.c (c_common_truthvalue_conversion): Remove
	obsolete block.  Invoke recursively the hook instead
	of this function.
	* c-convert.c (convert): handle ERROR_MARK_NODE.
	* c-typeck.c (build_binary_op): handle ERROR_MARK_NODE
	returned by the truthvalue_conversion language hook.
	* c-lang.c (LANG_HOOKS_TRUTHVALUE_CONVERSION): Use
	c_objc_common_truthvalue_conversion.
	* c-objc-common.c (c_objc_common_truthvalue_conversion):
	New function.
	* c-tree.h (c_objc_common_truthvalue_conversion): Declare it.
	* objc/objc-lang.c (LANG_HOOKS_TRUTHVALUE_CONVERSION): Use
	c_objc_common_truthvalue_conversion.

From-SVN: r77168
2004-02-03 11:22:41 +00:00
Richard Henderson 1aaec916ad c-parse.in (extension): Use itype.
* c-parse.in (extension): Use itype.
        (SAVE_EXT_FLAGS): Don't allocate a tree.
        (RESTORE_EXT_FLAGS): Don't read a tree.

From-SVN: r76676
2004-01-26 15:02:04 -08:00
Jan Hubicka 0de456a50f function.c (allocate_struct_function): Do not initialize expr, emit and varasm.
* function.c (allocate_struct_function): Do not initialize expr, emit
	and varasm.
	(prepare_function_start): Do it here.
	* c-parse.in (maybe_type_qual): Do not produce line number notes.

From-SVN: r76345
2004-01-22 10:52:20 +00:00
Joseph Myers f560bf91ae c-parse.in (stmts_and_decls): Make label at end of compound statement a hard error.
* c-parse.in (stmts_and_decls): Make label at end of compound
	statement a hard error.

testsuite:
	* gcc.dg/label-compound-stmt-1.c: New test.
	* gcc.c-torture/compile/950922-1.c,
	gcc.c-torture/compile/20000211-3.c,
	gcc.c-torture/compile/20000518-1.c,
	gcc.c-torture/compile/20021108-1.c: Avoid labels at and of
	compound statements.

From-SVN: r75891
2004-01-14 23:03:58 +00:00
Mark Mitchell 263ee05239 re PR c++/13275 (Implementation of offsetof macro)
PR c++/13275
	* c-common.h (enum rid): Add RID_OFFSETOF.
	* c-parser.in (rid_to_yy): Ignore RID_OFFSETOF.
	* ginclude/stddef.h (offsetof): Reimplement for C++, using
	__offsetof__.
	* doc/extend.texi: Document __offsetof__.

	PR c++/13275
	* lex.c (reswords): Add "__offsetof" and "__offsetof__".
	* parser.c (cp_parser): Add in_offsetof_p.
	(cp_parser_new): Initialize it.
	(cp_parser_primary_expression): Handle __offsetof__ (...).
	(cp_parser_postfix_expression): Allow casts to pointer type and
	uses of "->" in a constant expression if implementing offsetof.
	(cp_parser_unary_expression): Allow the use of "&" in a constant
	expression if implementing offsetof.

	PR c++/13275
	* g++.dg/other/offsetof2.C: Remove XFAIL.
	* g++.dg/parse/offsetof1.C: New test.
	* g++.gd/parse/offsetof2.C: Likewise.

From-SVN: r74702
2003-12-16 16:09:23 +00:00
Mark Mitchell 4bb8ca281f re PR c++/10779 (Error cascade for unknown type in function prototype)
* c-common.h (c_parse_error): Declare it.
	* c-common.c (c_parse_error): New function.
	* c-parse.y (yyerror): Use it.

	* parser.c (struct cp_parser): Add in_template_argument_list_p.
	(cp_parser_error): Use c_parse_error.
	(cp_parser_name_lookup_error): New function.
	(cp_parser_new): Initialize it.
	(cp_parser_declarator): Add parenthesized_p parameter.
	(cp_parser_nested_name_specifier_opt): Use
	cp_parser_name_lookup_error.
	(cp_parser_parenthesized_expression_list): Improve comments.
	(cp_parser_condition): Adjust call to cp_parser_declarator.
	(cp_parser_template_parameter): Adjust call to
	cp_parser_parameter_declaration.
	(cp_parser_template_argument_list): Set
	in_template_argument_list_p.
	(cp_parser_explicit_instantiation): Adjust call to
	cp_parser_declarator.
	(cp_parser_simple_type_specifier): Remove unncessary code.
	(cp_parser_using_declaration): Use cp_parser_name_lookup_error.
	(cp_parser_init_declarator): Handle member function definitions.
	(cp_parser_direct_declarator): Adjust call to
	cp_parser_declarator.
	(cp_parser_type_id): Adjust call to cp_parser_declarator.
	(cp_parser_parameter_declaration_list): Avoid backtracking where
	possible.
	(cp_parser_parameter_declaration): Add parenthesized_p parameter.
	(cp_parser_function_definition): Remove.
	(cp_parser_member_declaration): Do not backtrack to look for
	function definitions.
	(cp_parser_exception_declaration): Adjust call to
	cp_parser_declarator.
	(cp_parser_single_declaration): Handle function definitions via
	cp_parser_init_declarator.
	(cp_parser_save_member_function_body): New function.

	PR c++/10779
	PR c++/12160
	* g++.dg/parse/error3.C: New test.
	* g++.dg/parse/error4.C: Likewise.
	* g++.dg/abi/mangle4.C: Tweak error messages.
	* g++.dg/lookup/using5.C: Likewise.
	* g++.dg/other/error2.C: Likewise.
	* g++.dg/parse/typename5.C: Likewise.
	* g++.dg/parse/undefined1.C: Likewise.
	* g++.dg/template/arg2.C: Likewise.
	* g++.dg/template/ttp3.C: Likewise.
	* g++.dg/template/type1.C: Likewise.
	* g++.old-deja/g++.other/crash32.C: Likewise.
	* g++.old-djea/g++.pt/defarg8.C: Likewise.

From-SVN: r74624
2003-12-15 06:28:23 +00:00
Eric Christopher cfe79ecf83 c-parse.in (c_in_iteration_stmt, [...]): Move from here...
2003-12-03  Eric Christopher  <echristo@redhat.com>

	* c-parse.in (c_in_iteration_stmt, c_in_case_stmt): Move
        from here...
        * c-tree.h: to here.

From-SVN: r74253
2003-12-03 23:33:48 +00:00
Joseph Myers 65f0edec4b re PR c/10333 (typeof (bitfield) is accepted but doesn't work)
PR c/10333
	* c-parse.in (typespec_reserved_nonattr): Reject typeof on
	bit-fields.

testsuite:
	* gcc.dg/bitfld-7.c: New test.

From-SVN: r74036
2003-11-29 20:09:48 +00:00
Eric Christopher e13e48e707 re PR c/13014 (if shortcut misses required diagnostics)
2003-11-24  Eric Christopher  <echristo@redhat.com>

	PR C/13014
	* c-decl.c (c_in_iteration_stmt, c_in_case_stmt): New.
	(start_function): Use.
	(c_push_function_context): Ditto.
	(c-pop_function_context): Ditto.
        (language_function): Move...
	* c-tree.h: ... here. Add x_in_iteration_stmt, and
	x_in_case_stmt.
	* c-parse.in (do_stmt_start, select_or_iter_stmt, stmt): Use
	c_in_iteration_stmt, c_in_case_stmt for parser state. Move
	check for valid break or continue statment here...
	* c-semantics.c (genrtl_break_stmt, genrtl_continue_stmt): From
	here. Change original errors to abort.

From-SVN: r73887
2003-11-24 20:12:06 +00:00
Joseph Myers 88682ff62d re PR c/11943 (Accepts invalid declaration "int x[2, 3];" in C99 mode)
* c-parse.in (array_declarator): Use expr_no_commas.
	Fixes PR c/11943.

testsuite:
	* gcc.dg/c99-arraydecl-2.c: New test.  PR c/11943.

From-SVN: r72900
2003-10-24 16:30:37 +01:00
Ziemowit Laski 4898423cfd c-parse.in (methoddef, [...]): Call objc_add_method() instead of add_method().
2003-10-14  Ziemowit Laski  <zlaski@apple.com>

        * c-parse.in (methoddef, methodproto): Call objc_add_method()
        instead of add_method().
        * objc/objc-act.c (objc_check_decl): Do not check for
        constant_string_type.
        (add_method): Rename to objc_add_method().
        (really_start_method): Call objc_add_method() instead of
        add_method().
        * objc/objc-act.h (add_method): Rename to objc_add_method().

From-SVN: r72506
2003-10-15 00:10:27 +00:00
Kelley Cook 2409cb3750 /tmp/cvs001644
From-SVN: r72005
2003-10-02 00:07:50 +00:00
Ziemowit Laski 4a6bcd936a cp-parse.in (objc_try_stmt): Do not specify a %type.
2003-09-25  Ziemowit Laski  <zlaski@apple.com>

        * cp-parse.in (objc_try_stmt): Do not specify a %type.

From-SVN: r71762
2003-09-25 07:17:02 +00:00
Ziemowit Laski 264fa2db22 MERGE OF objc-improvements-branch into MAINLINE.
2003-09-24  Ziemowit Laski  <zlaski@apple.com>

        MERGE OF objc-improvements-branch into MAINLINE.
	See 'gcc/ChangeLog' and 'gcc/testsuite/ChangeLog' for
	the gory details.

From-SVN: r71748
2003-09-25 01:26:01 +00:00
Richard Henderson f31686a322 Revert DECL_SOURCE_LOCATION -> TREE_LOCUS change.
From-SVN: r71641
2003-09-21 22:09:32 -07:00
Richard Henderson 7e2af53a14 tree.h (TREE_LOCUS): Rename from DECL_SOURCE_LOCATION; make const.
* tree.h (TREE_LOCUS): Rename from DECL_SOURCE_LOCATION; make const.
	(TREE_FILENAME, TREE_LINENO): Likewise.
	(set_tree_locus, copy_tree_locus, set_tree_file_line): New.
	(TREE_LOCUS_SET_P): New.
	* c-aux-info.c, c-decl.c, c-parse.in, coverage.c, dbxout.c,
	diagnostic.c, dwarf2out.c, dwarfout.c, function.c, integrate.c,
	print-tree.c, stmt.c, toplev.c, tree-dump.c, tree-inline.c,
	tree-optimize.c, tree.c, tree.def, xcoffout.c, config/alpha/alpha.c,
	config/mips/mips.c, doc/c-tree.texi, objc/objc-act.c: Update to match.

ada/
	* trans.c, utils.c: Update for DECL_SOURCE_LOCATION rename and
	change to const.

cp/
	* class.c, cp-tree.h, decl.c, decl2.c, error.c, init.c,
	method.c, optimize.c, pt.c, semantics.c, tree.c: Update for
	DECL_SOURCE_LOCATION rename and change to const.

f/
	* com.c, ste.c: Update for DECL_SOURCE_LOCATION rename and
	change to const.

java/
	* class.c, decl.c, jcf-parse.c, jcf-write.c, parse.y,
	resource.c: Update for DECL_SOURCE_LOCATION rename and change to const.

treelang/
	* treetree.c: Update for DECL_SOURCE_LOCATION rename and
	change to const.

From-SVN: r71636
2003-09-21 16:39:40 -07:00
Andreas Jaeger c034f12167 invoke.texi (Warning Options): Describe -Wold-style-definition.
2003-09-15  Andreas Jaeger  <aj@suse.de>
            Kaveh R. Ghazi <ghazi@caip.rutgers.edu>

	* doc/invoke.texi (Warning Options): Describe -Wold-style-definition.
	* c-opts.c (c_common_handle_option): Handle OPT_Wold_style_definition.
	* c-parse.in: Warn about old-style parameter definition.
	* c-common.c: Define warn_old_style_defintion.
	* c-common.h: Declare it.
	* c.opt: Add Wold-style-defintion.

testsuite:
2003-09-15  Andreas Jaeger  <aj@suse.de>

	* gcc.dg/Wold-style-definition-1.c: New test.

From-SVN: r71400
2003-09-15 11:31:17 +02:00
Jan Hubicka 4a46cbfb11 Makefile.in (c-objc-common.o): Kill gt-c-objc-common.h dependency.
* Makefile.in (c-objc-common.o): Kill gt-c-objc-common.h dependency.
	* c-decl.c (finish_function):  Kill arguments, always use cgraph path.
	* c-objc-common.c: Kill include of gt-c-objc-common.h
	(expand_deferred_fns, deffer_fn): Kill function.
	(deferred_fns): Kill variable.
	(finish_cdtor): Update finish_function call.
	(c_objc_common_finish_file): Always call cgraph code.
	* c-parse.c: Regenerate.
	* c-parse.y: Regenerate.
	* c-tree.h (finish_function): Update prototype.

	* objc-acct.c (build_module_descriptor, finish_method_def):
	Update call of finish_function.

	* cgraphunit.c (cgraph_default_inline_p, cgraph_analyze_function): Add
	forward prototype.
	(cgraph_finalize_function): In non-unit-at-a-time mode analyze the
	function and assemble it if needed.
	(cgraph_finalize_compilation_unit): Do nothing in non-unit-at-a-time
	mode.
	(cgraph_optimize): Likewise.
	(cgraph_expand_function): In non-unit-at-a-time mode keep function body
	even when it has no inline callees.
	* c-parse.in: Update calls to finish_function.

From-SVN: r71028
2003-09-03 14:57:29 +00:00
Zack Weinberg f91f41b294 c-decl.c (gettags, [...]): Delete.
* c-decl.c (gettags, pushdecl_function_level): Delete.
	(last_function_parm_vars): Rename last_function_parm_others.
	(current_function_parm_vars): Rename current_function_parm_others.
	(struct c_scope): Rewrite comment explaining this data structure.
	Add names_last, blocks_last, parms_last fields.  Rename
	incomplete_list to incomplete.
	(SCOPE_LIST_APPEND, SCOPE_LIST_CONCAT): New macros.
	(poplevel): Ignore second argument.  No need to nreverse
	anything.  Restructure such that each list is processed
	exactly once.  Use 'const location_t *locus' syntactic sugar
	variable where useful.  Issue unused variable warnings
	ourselves, do not rely on function.c.
	(insert_block, pushdecl, bind_label): Use SCOPE_LIST_APPEND.
	(pushdecl_top_level): Likewise.  Don't call duplicate_decls.
	(implicitly_declare): decl cannot be error_mark_node.
	(undeclared_variable): Manipulate scope structure directly.
	(c_make_fname_decl): Likewise.
	(getdecls, c_init_decl_processing): Fix comment.
	(mark_forward_parm_decls): Use SCOPE_LIST_CONCAT.  No need
	for 'last' variable.
	(grokparms): No need to nreverse parms list.
	(store_parm_decls_newstyle): Set up the parms_last and
	names_last fields of the new scope too.
	(store_parm_decls_oldstyle): Can assume DECL_WEAK is not set
	on parms to begin with; check this under ENABLE_CHECKING.  Set
	up parms_last.
	(check_for_loop_decls): Refer directly to current_scope->tags.
	Use consistent quote style in diagnostics.
	(c_write_global_declarations): The names list is not backward.

	* c-common.h: Don't prototype gettags.
	* c-parse.in: Call poplevel with second argument 0 always.

From-SVN: r70061
2003-08-01 18:41:40 +00:00
Zack Weinberg 55d54003b6 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
2003-07-29 23:58:08 +00:00
Hans-Peter Nilsson 85617eba1e c-parse.in (lineno_stmt_decl_or_labels_ending_decl): Also warn when warn_declaration_after_statement.
* c-parse.in (lineno_stmt_decl_or_labels_ending_decl): Also warn
	when warn_declaration_after_statement.  Call pedwarn_c90, not
	pedwarn.  Correct message: it's "ISO C90", not "ISO C89".
	* c-common.c (warn_declaration_after_statement): Define.
	* c-common.h (warn_declaration_after_statement): Declare.
	* c.opt (Wdeclaration-after-statement): New.
	* c-errors.c (pedwarn_c90): New function.
	* c-opts.c (c_common_handle_option) <case
	OPT_Wdeclaration_after_statement>: New.
	* c-tree.h (pedwarn_c90): Declare.
	* doc/invoke.texi (Option Summary): Document
	-Wdeclaration-after-statement.
	(Warning Options): Ditto.

Co-Authored-By: Michael Culbertson <Michael.J.Culbertson@wheaton.edu>

From-SVN: r69899
2003-07-28 20:03:25 +00:00
Jason Merrill de7df9ebdc tree.h (boolean_type_node): Move from C/C++/Java frontends.
* tree.h (boolean_type_node): Move from C/C++/Java frontends.
        (boolean_true_node, boolean_false_node): Likewise.
        (enum tree_index): Add TI_BOOLEAN_{TYPE,FALSE,TRUE}.
        * tree.c (build_common_tree_nodes): Init boolean_type_node.
        (build_common_tree_nodes_2): Init boolean_{true,false}_node.
        * stor-layout.c (set_sizetype): Handle an early BOOLEAN_TYPE.
        * c-common.h (truthvalue_type_node): Renamed from boolean_type_node.
        (truthvalue_true_node): Renamed from boolean_true_node.
        (truthvalue_false_node): Renamed from boolean_false_node.
        * c-decl.c: Just set truthvalue_* to integer_*.
        * c-*.[ch]: s/boolean/truthvalue/.  s/c_bool/boolean/.
        * cp/decl.c: Just set truthvalue_* to boolean_*.
        * java/java-tree.h: Move boolean_type_node et al to the back end.

From-SVN: r69758
2003-07-24 16:48:13 -04:00
Zack Weinberg 14e33ee856 * c-decl.c (named_labels, shadowed_labels, label_level_chain)
(push_label_level, pop_label_level): Kill.
	(struct binding_level): Rename level_chain to outer.
	Add outer_function field.  Change parm_flag, function_body,
	keep, keep_if_subblocks to 1-bit bitfields of type bool.
	(current_function_level): New variable.
	(keep_next_level_flag, keep_next_if_subblocks): Change type to bool.
	(keep_next_level, declare_parm_level, warn_if_shadowing):
	Update to match.
	(struct language_function): Kill named_labels, shadowed_labels fields.
	(c_init_decl_processing, start_function, c_push__function_context)
	(c_pop_function_context): No need to muck with named_labels nor
	shadowed_labels.

	(make_binding_level): No need to clear the structure here.
	(pop_binding_level): Always operate on current_binding_level.
	Update current_function_level if necessary.
	(pushlevel): Don't clear named_labels.  Update current_function_level
	if necessary.  Use "true" and "false" where appropriate.
	(poplevel): Diagnose labels defined but not used, or vice
	versa, and clear out label-meanings leaving scope, while
	walking down the decls list, for all binding levels.
	Handle LABEL_DECLs appearing in the shadowed list.
	pop_binding_level takes no arguments.
	(pushdecl_function_level): Use current_function_level.

	(make_label, bind_label): New static functions.
	(declare_label): New exported function.
	(lookup_label, define_label): Rewritten for new data structure.
	(shadow_label): Kill.

	* c-tree.h: Prototype declare_label; don't prototype
	push_label_level, pop_label_level, nor shadow_label.
	* c-parse.in: Remove all calls to push_label_level and
	pop_label_level.  Use declare_label for __label__ decls.

	* doc/extend.texi: Clarify that __label__ can be used to
	declare labels with local scope in any nested block, not
	just statement expressions.  Cross-reference nested functions
	section from local labels section.

testsuite:
	* gcc.dg/noncompile/label-1.c: New comprehensive test case for
	diagnostics of ill-formed constructs involving labels.
	* gcc.dg/noncompile/label-lineno-1.c: Add error regexp for
	the new 'previously defined here' message.

From-SVN: r69597
2003-07-19 23:32:55 +00:00
Kaveh R. Ghazi 703ad42b4b alias.c [...]: Remove unnecessary casts.
* alias.c alloc-pool.c bitmap.c bitmap.h bt-load.c builtins.c
	c-common.c c-decl.c c-incpath.c c-lex.c c-opts.c c-parse.in
	c-pragma.c c-typeck.c calls.c cfg.c cfganal.c cfgloop.c cfgrtl.c
	collect2.c combine.c conflict.c coverage.c cppexp.c cppfiles.c
	cpphash.c cppinit.c cpplex.c cpplib.c cppmacro.c cppspec.c
	cpptrad.c cse.c cselib.c dbxout.c defaults.h df.c dominance.c
	dwarf2out.c dwarfout.c emit-rtl.c except.c expmed.c expr.c final.c
	fix-header.c flow.c fold-const.c function.c gcc.c gccspec.c gcov.c
	gcse.c genattr.c genattrtab.c genautomata.c genconditions.c
	genemit.c genextract.c genoutput.c genrecog.c gensupport.c
	ggc-page.c ggc-simple.c global.c graph.c haifa-sched.c hashtable.c
	integrate.c jump.c langhooks.c lcm.c line-map.c local-alloc.c
	loop.c mips-tdump.c mips-tfile.c mkdeps.c optabs.c params.c
	postreload.c prefix.c print-tree.c protoize.c ra-build.c
	ra-colorize.c ra-rewrite.c ra.c recog.c reg-stack.c regclass.c
	regmove.c regrename.c reload.c reload1.c reorg.c resource.c
	sbitmap.c sched-deps.c sched-rgn.c sched-vis.c sdbout.c
	simplify-rtx.c ssa-ccp.c ssa.c stmt.c stor-layout.c timevar.c
	tlink.c toplev.c tree-dump.c tree.c unroll.c unwind-dw2-fde.c
	varasm.c varray.c vmsdbgout.c xcoffout.c: Remove unnecessary
	casts.

From-SVN: r69587
2003-07-19 14:47:15 +00:00
Zack Weinberg 9cd51ef68e c-decl.c (pushdecl_function_level): Make static, return nothing.
* c-decl.c (pushdecl_function_level): Make static, return nothing.
	(kept_level_p): Fold into poplevel.
	(undeclared_variable): Moved here from c-typeck.c.  Export.
	* c-tree.h (KEEP_YES, KEEP_NO, KEEP_MAYBE): New #defines.
	(undeclared_variable): Prototype here.  Don't prototype
	kept_level_p nor pushdecl_function_level.
	* c-parse.in: Change first argument to poplevel from
	"kept_level_p()" to "KEEP_MAYBE".
	* c-typeck.c (undeclared_variable): Moved to c-decl.c.

From-SVN: r69540
2003-07-18 03:39:42 +00:00
Zack Weinberg eb1dfbb2fb c-decl.c: Fix typos in several comments.
* c-decl.c: Fix typos in several comments.  Remove all
	#if 0 blocks; reindent as needed.  Remove unused argument
	to declare_parm_level; all callers changed.
	* c-parse.in: Update calls to declare_parm_level.  Avoid
	issuing a double warning in some circumstances.
	* c-typeck.c: Update calls to declare_parm_level.
	* c-tree.h: Update prototype of declare_parm_level.

	* c-pragma.c (apply_pragma_weak): Don't complain about a
	redundant #pragma weak.

	* objc/objc-act.c (forward_declare_categories,
	build_selector_reference_decl, build_class_reference_decl,
	build_objc_string_decl, synth_forward_declarations,
	build_protocol_reference): Set TREE_PUBLIC on synthetic
	forward decl to 0, consistent with eventual definition.
	Correct comments to match.

cp:
	* pt.c (get_bindings): Make definition consistent with
	forward declaration.

From-SVN: r69519
2003-07-17 20:12:21 +00:00
Geoffrey Keating d1bd0ded61 Index: ChangeLog
2003-07-10  Geoffrey Keating  <geoffk@apple.com>

	* c-decl.c (finish_decl): Handle 'used' here...
	* cgraphunit.c (cgraph_finalize_function): ... and here ...
	* c-common.c: (handle_used_attribute): ... not here.

	* configure.in (onstep): Support --enable-intermodule.
	* Makefile.in (OBJS-common): New.
	(OBJS-md): New.
	(OBJS-archive): New.
	(OBJS): Build from OBJS-common, OBJS-md, OBJS-archive.
	(OBJS-onestep): New.
	(libbackend.a): Support @onestep@.
	(libbackend.o): New.
	* configure: Regenerate.

	* c-common.h (c_reset_state): New prototype.
	(c_parse_file): New prototype.
	(finish_file): Move prototype from c-tree.h.
	* c-decl.c: Include <hashtab.h>.
	(builtin_decls): New.
	(current_file_decl): New.
	(duplicate_decls): Add extra parameter. Change all callers.  Don't
	output duplicate common symbols.
	(link_hash_hash): New.
	(link_hash_eq): New.
	(poplevel): Handle popping of the top level.
	(warn_if_shadowing): Handle TRANSLATION_UNIT_DECL.
	(pushdecl): Set DECL_CONTEXT to TRANSLATION_UNIT_DECL if appropriate.
	(pushdecl_top_level): Likewise.
	(redeclaration_error_message): Handle TRANSLATION_UNIT_DECL.
	(c_init_decl_processing): Create TRANSLATION_UNIT_DECL.
	(finish_decl): Handle TRANSLATION_UNIT_DECL.
	(merge_translation_unit_decls): New.
	(c_write_global_declarations): New.
	(c_reset_state): New.
	(implicitly_declare): Handle TRANSLATION_UNIT_DECL.
	* c-lang.c (LANG_HOOKS_WRITE_GLOBALS): New.
	* c-objc-common.c (c_cannot_inline_tree_fn): Handle
	TRANSLATION_UNIT_DECL.
	(c_objc_common_finish_file): Call merge_translation_unit_decls.
	* c-opts.c (in_fnames): Rename from in_fname.
	(c_common_decode_option): Handle multiple input filenames.
	(c_common_post_options): Likewise.
	(c_common_parse_file): Likewise; also, call c_parse_file rather than
	yyparse.
	* c-parse.in: Move cleanup code to c_parse_file.
	(free_parser_stacks): Move contents to c_parse_file.
	(c_parse_file): New.
	* c-tree.h (union lang_tree_node): Chain along TYPE_NEXT_VARIANT
	for integer types.
	(C_DECL_FILE_SCOPE): New.
	(finish_file): Move prototype to c-common.h.
	(merge_translation_unit_decls): New prototype.
	(comptypes): Add extra parameter to prototype.
	(c_write_global_declarations): New prototype.
	* c-typeck.c (tagged_types_tu_compatible_p): New.
	(function_types_compatible_p): Add extra parameter, change all callers.
	(type_lists_compatible_p): Likewise.
	(comptypes): Likewise.
	(struct tagged_tu_seen): New.
	(tagged_tu_seen_base): New.
	(build_unary_op): Handle TRANSLATION_UNIT_DECL.
	(c_mark_addressable): Remove #if 0 code.
	* calls.c (special_function_p): Handle TRANSLATION_UNIT_DECL, add
	comment explaining why it shouldn't have to.
	* cgraph.h (struct cgraph_node): Add chain_next and chain_prev GTY
	options.
	* cppinit.c (cpp_read_next_file): New.
	(cpp_read_main_file): Use it.
	* cpplib.c (undefine_macros): New.
	(cpp_undef_all): New.
	* cpplib.h (cpp_read_next_file): Prototype.
	(cpp_undef_all): Prototype.
	* langhooks-def.h (write_global_declarations): Remove prototype.
	* toplev.h (write_global_declarations): Add prototype.
	* tree.c (decl_type_context): Use switch statement, handle
	TRANSLATION_UNIT_DECL.
	* tree.def: Update documentation for TRANSLATION_UNIT_DECL.
	(TRANSLATION_UNIT_DECL): New kind of tree.
	* tree.h: Update documentation for TRANSLATION_UNIT_DECL.
	* Makefile.in (c-decl.o): Add $(HASHTAB_H) to dependencies.
	* doc/invoke.texi: Make attempt to document new functionality.

	2003-05-19  Per Bothner <bothner@apple.com>

	* gcc.c (combine_inputs): New.
	(process_command): Set combine_inputs.
	(do_spec_1): Handle combine_inputs.
	(main): Likewise.

Index: cp/ChangeLog
2003-07-10  Geoffrey Keating  <geoffk@apple.com>

	* decl.c (cp_finish_decl): Handle 'used' attribute.

	* cp-lang.c (c_reset_state): New dummy routine.
	* cp-tree.h (finish_file): Move prototype to c-common.h.
	* parser.c (c_parse_file): Rename from yyparse; don't call finish_file.

From-SVN: r69224
2003-07-11 08:33:21 +00:00
Nathan Sidwell 0cea056ba1 rtl.h (emit_line_note): Take a location_t.
* rtl.h (emit_line_note): Take a location_t.
	(emit_line_note_force): Remove.
	(set_file_and_line_for_statement): Take a location_t.
	* tree.g (emit_line_note): Take a location_t.
	* emit-rtl.c (emit_line_note): Take a location_t.
	(emit_line_note_force): Remove.
	* function.c (init_function_start): Adjust emit_line_note call.
	(expand_function_end): Use force_next_line_note, not
	emit_line_note_force.
	* c-parse.in (maybe_type_qual): Adjust emit_line_note calls.
	* c-semantics.c (genrtl_do_pushlevel, genrtl_goto_stmt,
	genrtl_expr_stmt_value, genrtl_decl_stmt, genrtl_if_stmt,
	genrtl_while_stmt, genrtl_do_stmt_1, genrtl_return_stmt,
	genrtl_for_stmt, genrtl_break_stmt, genrtl_continue_stmt,
	genrtl_continue_stmt, genrtl_switch_stmt,
	genrtl_asm_stmt): Likewise.
	* expr.c (expand_expr): Likewise.
	* integrate.c (expand_inline_function): Likewise.
	* stmt.c (set_file_and_line_for_stmt): Take a location_t.
	(expand_decl_init): Adjust emit_line_note call.

	* ada/trans.c (build_unit_elab, set_lineno): Adjust emit_line_note
	calls.

	* cp/semantics.c: (genrtl_try_block) Adjust emit_line_note
	calls.

	* f/com.c (bison_rule_pushlevel_, bison_rule_compstmt_): Adjust
	emit_line_note calls.
	* f/ste.c (ffeste_emit_line_note_): Likewise.

	* java/expr.c (expand_byte_code):

	* treelang/treetree.c (tree_code_if_start, tree_code_if_else,
	tree_code_if_end, tree_code_create_function_initial,
	tree_code_create_function_wrapup, tree_code_generate_return,
	tree_code_output_expression_statement): Adjust emit_line_note
	calls.

From-SVN: r69047
2003-07-07 17:57:30 +00:00
Andreas Jaeger f55ade6e34 basic-block.h: Convert prototypes to ISO C90.
* basic-block.h: Convert prototypes to ISO C90.
	* c-parse.in: Likewise.
	* c-pragma.h: Likewise.
	* c-typeck.c: Likewise.
	* cfghooks.h: Likewise.
	* cfgloopanal.c: Likewise.
	* dbxout.h: Likewise.
	* debug.h: Likewise.
	* dwarf2asm.h: Likewise.
	* gcov.c: Likewise.
	* gengtype-lex.l: Likewise.
	* sched-int.h: Likewise.
	* timevar.c: Likewise.

From-SVN: r69010
2003-07-06 20:59:38 +02:00
Neil Booth ade4289c2d Makfile.in: Remove traces of mbchar.
* Makfile.in: Remove traces of mbchar.
	* c-parse.in (MULTIBYTE_CHARS): Remove.
	* config.in (MULTIBYTE_CHARS): Remove.
	* configure: Remove --enable-mbchar.
	* configure.in: Remove --enable-mbchar.
	* mbchar.c, mbchar.h: Remove.
	* system.h: Poison MULTIBYTE_CHARS.
	* config/linux-aout.h (MULTIBYTE_CHARS): Remove.
	* config/linux.h (MULTIBYTE_CHARS): Remove.
	* config/svr4.h (MULTIBYTE_CHARS): Remove.
	* config/sparc/linux.h (MULTIBYTE_CHARS): Remove.

From-SVN: r69009
2003-07-06 18:50:45 +00:00
Zack Weinberg e6cc3a24c2 cpplib.h (CPP_AT_NAME, [...]): New token types.
* cpplib.h (CPP_AT_NAME, CPP_OBJC_STRING): New token types.
	(struct cpp_options): Add narrow_charset, wide_charset,
	bytes_big_endian fields.  Remove EBCDIC field.
	(cpp_init_iconv, cpp_interpret_string): New external interfaces.

	* cpphash.h: Include <iconv.h> if we have it, otherwise
	provide a dummy definition of iconv_t.
	(struct cpp_reader): Add narrow_cset_desc and wide_cset_desc fields.
	(_cpp_valid_ucn): Update prototype.
	(_cpp_destroy_iconv): New prototype.

	* doc/cpp.texi: Document character set handling.
	* doc/cppopts.texi: Document -fexec-charset= and -fexec-wide-charset=.
	* doc/extend.texi: Delete entire section on multiline strings.
	Rewrite section on __FUNCTION__ etc now that these are
	variables in C.

	* cppucnid.tab, cppucnid.pl: New files.
	* cppucnid.h: New generated file.
	* cppcharset.c: Include cppucnid.h.  Lots of commentary added.
	(iconv_open, iconv, iconv_close): Provide dummy definitions
	if !HAVE_ICONV.
	(SOURCE_CHARSET, struct strbuf, init_iconv_desc, cpp_init_iconv,
	_cpp_destroy_iconv, convert_cset, width_to_mask, convert_ucn,
	emit_numeric_escape, convert_hex, convert_oct, convert_escape,
	cpp_interpret_string, narrow_str_to_charconst,
	wide_str_to_charconst): New.
	(ucn_valid_in_identifier): Use a binary search through the
	ucnranges table defined in cppucnid.h, not a long chain of if
	statements.
	(_cpp_valid_ucn): Add a limit pointer.  Downgrade "universal
	character names are only valid in C++ and C99" to a warning.
	Issue the "meaning of \[uU] is different in traditional C"
	warning here.  Take care not to let iconv see an invalid UCS
	value if we get a malformed UCN.  Issue an error if we don't
	have iconv.
	(cpp_interpret_charconst): Moved here from cpplex.c.  Use
	cpp_interpret_string to do the heavy lifting.

	* cppinit.c (cpp_create_reader): Initialize bytes_big_endian,
	narrow_charset, wide_charset fields of options structure.
	(cpp_destroy): Call _cpp_destroy_iconv.
	* cpplex.c (forms_identifier_p): Adjust call to _cpp_valid_ucn.
	(maybe_read_ucn, hex_digit_value, cpp_parse_escape): Delete.
	(cpp_interpret_charconst): Moved to cppcharset.c.
	* cpplib.c (dequote_string): Delete.
	(interpret_string_notranslate): New.
	(do_line, do_linemarker): Use interpret_string_notranslate.

	* Makefile.in (cppcharset.o): Depend on cppucnid.h.

	* c-common.c (fname_string, combine_strings): Delete.
	* c-common.h (fname_string, combine_strings): Delete prototypes.
	* c-lex.c (ignore_escape_flag): Delete.
	(cb_ident): Use cpp_interpret_string, not lex_string.
	(get_nonpadding_token): New function.
	(c_lex): Handle Objective-C @-prefixed identifiers and strings here.
	Adjust calls to lex_string.  Don't write *value twice.
	(lex_string): Now handles string constant concatenation.
	Most of the work handed off to cpp_interpret_string.
	Call fix_string_type here.
	* c-parse.in (STRING_FUNC_NAME, VAR_FUNC_NAME): Replace with
	FUNC_NAME, throughout.
	(OBJC_STRING): New token type.
	(primary:STRING): No need to call fix_string_type here.
	(primary:objc_string): Make that OBJC_STRING.
	(objc_string nonterminal): Delete.
	(yylexname): Delete code to handle fake string constants.
	(yylexstring): Delete entirely.
	(_yylex): Handle CPP_AT_NAME and CPP_OBJC_STRING.  No need
	to handle CPP_ATSIGN.

	* c.opt (-fexec-charset=, -fwide-exec-charset=): New options.
	* c-opts.c (missing_arg, c_common_handle_option): Handle
	OPT_fexec_charset_ and OPT_fwide_exec_charset_.
	(c_common_init): Set cpp_opts->bytes_big_endian, not
	cpp_opts->EBCDIC.  Call cpp_init_iconv.
	(print_help): Document -fexec-charset= and -fexec-wide-charset=.
	(TARGET_EBCDIC): Delete default definition.

	* objc/objc-act.c (build_objc_string_object): No need to
	handle string constant concatenation.

cp:
	* parser.c (cp_lexer_read_token): No need to handle string
	constant concatenation.

testsuite:
	* gcc.c-torture/execute/wchar_t-1.x: New file; XFAIL wchar_t-1.c
	everywhere.
	* gcc.dg/concat.c: Concatenation of string constants with
	__FUNCTION__ / __PRETTY_FUNCTION__ is now a hard error.
	* gcc.dg/wtr-strcat-1.c: Loosen dg-warning regexp.
	* gcc.dg/cpp/escape-2.c: Use wide character constants where
	necessary to avoid multi-character character constant warning.
	* gcc.dg/cpp/escape.c: Likewise.
	* gcc.dg/cpp/ucs.c: Likewise.
	Remove backslashes from dg-bogus comments, as they confuse Tcl.
	Fix a typo.

libstdc++-v3:
	* testsuite/22_locale/collate/compare/wchar_t/2.cc
	* testsuite/22_locale/collate/compare/wchar_t/wrapped_env.cc
	* testsuite/22_locale/collate/compare/wchar_t/wrapped_locale.cc
	* testsuite/22_locale/collate/hash/wchar_t/2.cc
	* testsuite/22_locale/collate/hash/wchar_t/wrapped_env.cc
	* testsuite/22_locale/collate/hash/wchar_t/wrapped_locale.cc
	* testsuite/22_locale/collate/transform/wchar_t/2.cc
	* testsuite/22_locale/collate/transform/wchar_t/wrapped_env.cc
	* testsuite/22_locale/collate/transform/wchar_t/wrapped_locale.cc:
	XFAIL on all targets.

From-SVN: r68952
2003-07-05 00:24:00 +00:00
Nathan Sidwell 5b030314af c-tree.h (define_label): Replace filename and lineno arguments with a location_t.
* c-tree.h (define_label): Replace filename and lineno arguments
	with a location_t.
	* c-decl.c (poplevel): Adjust define_label call.
	(pop_label_level): Likewise.
	(define_label): Replace filename and lineno arguments with a
	location_t.
	(store_parm_decls): Use DECL_SOURCE_LOCATION.
	* c-parse.in (label): Adjust define_label call.

	* cp/cp-tree.h (define_label): Replace filename and lineno
	arguments with a location_t.
	* cp/decl.c (pop_label): Adjust define_label call.
	(define_label): Replace filename and lineno arguments with a
	location_t.
	* cp/semantics.c (finish_label): Adjust define_label call.

	* java/decl.c (poplevel): Adjust define_label call.

From-SVN: r68766
2003-07-01 09:00:45 +00:00
Neil Booth 37fa72e9d3 c-common.c (enum c_language_kind, flag_objc): Remove.
* c-common.c (enum c_language_kind, flag_objc): Remove.
	(fix_string_type, check_case_value, c_common_nodes_and_builtins,
	c_add_case_label, finish_label_addr_expr, boolean_increment):
	Use c_dialect_ macros.
	* c-common.h (enum c_language_kind): Extend.
	(c_dialect_cxx, c_dialect_objc): New.
	(flag_objc): Remove.
	(c_common_init_options): Update prototype.
	* c-cppbuiltin.c (define__GNUC__, c_cpp_builtins): Use c_dialect_
	macros.
	* c-decl.c (finsih_decl, grokfield, finish_struct): Use c_dialect_
	macros.
	* c-format.c (C_STD_VER, C_STD_NAME): Similarly.
	* c-lang.c (c_init_options): Remove.
	(c_language): Define.
	(LANG_HOOKS_INIT_OPTIONS): Use common hook.
	* c-lex.c (lex_charconst): Use c_dialect_cxx().
	* c-opts.c (lang_flags): Make function-local.
	(c_common_init_options): Use c_dialect_ macros.  Handle
	C++ diagnostic requirements.
	(c_common_handle_option, c_common_post_options): Use flag_cxx.
	* c-parse.in (init_reswords): Use c_dialect_objc ().
	* c-pch.c (get_ident): Use c_language.
	* c-pretty-print.c (pp_c_bool_literal): Use c_dialect_ macros.
	* c-typeck.c (comptypes, build_c_cast): Similarly.
	* objc/objc-lang.c (c_language): Define.
	(LANG_HOOKS_INIT_OPTIONS): Use common hook.
	(objc_init_options): Remove.
cp:
	* Make-lang.in: Update.
	* cp-lang.c (c_language): Define.
	(LANG_HOOKS_INIT_OPTIONS): Use common hook.
	* cp-tree.h (cxx_init_options): Remove.
	* lex.c: Don't include diagnostic.h.
	(cxx_init_options): Remove.

From-SVN: r68734
2003-06-30 19:36:25 +00:00
Nathan Sidwell cead95c241 * c-parse.in (yylexstring): Use a location_t.
From-SVN: r68645
2003-06-28 19:05:32 +00:00
Nathan Sidwell 374a4e6cc7 c-parse.in (%union): Replace filename & lineno with location.
* c-parse.in (%union): Replace filename & lineno with location.
	(save_filename, save_lineno): Remove.
	(save_location): New.
	(fndef, old_style_parm_decls_1, lineno_datadecl, lineno_decl,
	nested_function, notype_nested_function, if_prefix, lineno_stmt,
	lineno_label, label): Adjust.

From-SVN: r68636
2003-06-28 12:30:05 +00:00
Nathan Sidwell bc4721b87e c-tree.h (grokfield): Remove unused filename and line parameters.
* c-tree.h (grokfield): Remove unused filename and line parameters.
	* c-decl.c (grokfield): Remove unused filename and line	parameters.
	* c-parse.in (component_decl): Adjust field grokking rules, adjust
	grokfield calls.
	(component_declarator): Likewise.
	(component_notype_declarator): Likewise.
	* objc/objc-act.c (build_module_descriptor): Adjust grokfield
	calls.
	(build_protocol_template, build_method_prototype_list_template,
	build_method_prototype_template, build_category_template,
	build_selector_template, build_class_template,
	build_super_template, build_ivar_template,
	build_ivar_list_template, build_method_list_template,
	build_method_template, add_instance_variable): Likewise.

From-SVN: r68560
2003-06-27 09:05:45 +00:00
Nathan Sidwell b190f23906 c-parse.in (fndef): Set DECL_SOURCE_LINE and FILE earlier.
* c-parse.in (fndef): Set DECL_SOURCE_LINE and FILE earlier.
	(nested_function): Likewise.
	(notype_nested_function): Likewise.
cp:
	* pt.c (register_specialization): Update the decl's location,
	if necessary.
	(check_explicit_specialization): Likewise.

From-SVN: r67063
2003-05-21 14:27:46 +00:00
Nathan Sidwell 66804d9eec c-common.h (enum rid): Remove RID_BOUNDED, RID_UNBOUNDED.
* c-common.h (enum rid): Remove RID_BOUNDED, RID_UNBOUNDED.
	* c-parse.in (reswords): Remove __bounded__ and __unbounded__.
	(rid_to_yy): Remove RID_BOUNDED, RID_UNBOUNDED slots.
	* print-tree.c (print_node): Remove ambient-boundedness.
	* tree.h (tree_common): Remove bounded_flag.
	(BOUNDED_INDIRECT_YPE_P, BOUNDED_POINTER_TYPE_P,
	BOUNDED_REFERENCE_TYPE_P, MAYBE_BOUNDED_INDIRECT_TYPE_P,
	MAYBE_BOUNDED_POINTER_TYPE_P, MAYBE_BOUNDED_REFERENCE_TYPE_P,
	TREE_BOUNDED, TYPE_MAIN_VARIANTS_PHYSICALLY_EQUAL_P,
	TYPE_MAIN_PHYSICAL_VARIANT, TYPE_BOUNDED, TYPE_QUAL_BOUNDED):
	Remove.
	(TYPE_QUALS): Remove BOUNDED.
	(TREE_EXPR_QUALS, TREE_FUNC_QUALS): Remove.
	(TYPE_BOUNDED_VALUE, TYPE_BOUNDED_BASE, TYPE_BOUNDED_EXTENT,
	TYPE_BOUNDED_SUBTYPE, TYPE_UNBOUNDED_VARIANT, TYPE_POINTER_DEPTH,
	TYPE_AMBIENT_BOUNDEDNESS, MAX_POINTER_DEPT,
	VA_LIST_POINTER_DEPTH): Remove.
	(struct tree_type): Remove pointer_depth.
treelang:
	* treetree.c (reswords): Remove __bounded__, __unbounded__.

From-SVN: r67058
2003-05-21 11:13:21 +00:00
Richard Henderson 66ea6f4cce re PR c/10675 (Compile time increases quadratically with struct size)
PR c/10675
        * c-decl.c: Include hashtab.h.
        (detect_field_duplicates): New.
        (finish_struct): Use it.
        * Makefile.in (c-decl.o): Update.
        * c-parse.in (structsp_attr): Nreverse component_decl_list results.
        (component_decl_list, component_decl_list2,
        components, components_notype): Build list in reverse order.
        (enumlist): Clarify docs.  Use TREE_CHAIN not chainon.
        * tree.c (chainon): Special case op2 null as well.
        Reorg for clarity.

From-SVN: r66710
2003-05-11 20:25:38 -07:00
Gabriel Dos Reis 49468c8be1 c-parse.in (if_stmt_locus): New object.
* c-parse.in (if_stmt_locus): New object.
	(if_prefix rule): Use it.  Don't use warning_with_file_and_line.
	(select_or_iter_stmt rule): Likewise.
	(if_stmt_file): Remove.
	(if_stmt_line): Likewise.
	* jump.c: include "diagnostic.h"
	(never_reached_warning): Don't use warning_with_file_and_line.
	* Makefile.in (jump.o): Add dependce on diagnostic.h

From-SVN: r66627
2003-05-09 09:25:34 +00:00
Nathan Sidwell d479d37f5e input.h (lineno): Rename to ...
* input.h (lineno): Rename to ...
	(input_line): ... here.
	* tree.h (lineno): Rename to ...
	(input_line): ... here.
	* scan.h (lineno): Rename to ...
	(input_line): ... here.
	* toplev.c (lineno): Rename to ...
	(input_line): ... here.
	(push_srcloc, pop_srcloc):  Rename lineno to input_line.
	* c-common.c (c_expand_start_cond, fname_decl): Likewise.
	* c-decl.c (poplevel, pop_label_level, lookup_label, lookup_tag,
	store_parm_decls, c_expand_body_1): Likewise.
	* c-errors.c (pedwarn_c99): Likewise.
	* c-format.c (status_warning): Likewise.
	* c-lex.c (fe_file_change, cb_def_pragma, c_lex): Likewise.
	* c-opts.c (c_common_post_options, c_common_parse_file): Likewise.
	* c-parse.in (save_filename, maybe_type_qual, ifc): Likwise.
	* c-semantics.c (finish_stmt_tree, build_stmt, emit_local_var,
	gentrtl_goto_stmt, genrtl_expr_stmt_value, genrtl_decl_stmt,
	genrtl_if_stmt, genrtl_while_stmt, genrtl_do_stmt,
	genrtl_return_stmt, genrtl_for_stmt, build_break_stmt,
	build_continue_stmt, genrtl_switch_stmt, genrtl_asm_stmt,
	prep_stmt, find_reachable_label, expand_unreachable_stmt): Likewise.
	* coverage.c (create_coverage): Likewise.
	* diagnostic.c (pedwarn, sorry, error, fatal_error,
	internal_error, warning, diagnostic_report_current_module,
	inform): Likewise.
	* expr.c (expand_expr): Likewise.
	* integrate.c (expand_inline_function,
	output_inline_function): Likewise.
	* rtl-error.c (file_and_line_for_asm): Likewise.
	* tree-inline.c (find_alloca_call, find_builtin_longjmp_call,
	walk_tree): Likewise.
	* tree.c (make_node): Likewise.
	* ada, cp, f, java, objc, treelang: Likewise.

	ada
	* trans.c (build_unit_elab, set_lineno): Rename lineno to
	input_line.
	* utils.c (pushdecl, create_label_decl, begin_subprog_body,
	end_subprog_body): Likewise.
	* utils2.c (build_call_raise): Likewise.

	cp
	* class.c (finish_struct): Rename lineno to input_line.
	* decl.c (push_binding_level, pop_binding_level,
	suspend_binding_level, resume_binding_level, make_label_decl,
	use_label, start_function): Likewise.
	* decl2.c (warn_if_unknown_interface,
	start_static_initialization_or_destruction,
	generate_ctor_or_dtor_function, finish_file): Likewise.
	* error.c (cp_line_of, print_instantiation_full_context,
	print_instantiation_context): Likewise.
	* except.c (check_handlers_1, check_handlers): Likewise.
	* init.c (create_temporary_var): Likewise.
	* method.c (use_thunk, synthesize_method): Likewise.
	* parser.c (cp_lexer_set_source_position_from_token,
	cp_lexer_get_preprocessor_token): Likewise.
	* pt.c (push_tinst_level, pop_tinst_level,
	tsubst_friend_function, instantiate_class_template, tsubst_decl,
	tsubst, tsubst_expr, instantiate_decl): Likewise.
	* semantics.c (genrtl_try_block, finish_label_stmt,
	begin_class_definition, expand_body,
	genrtl_finish_function): Likewise.
	* tree.c (build_min_nt, build_min): Likewise.

	f
	* ansify.c (die_unless): Rename lineno to input_line.
	* com.c (ffecom_subscript_check_, ffecom_do_entry_,
	ffecom_gen_sfuncdef_, ffecom_start_progunit_,
	ffecom_sym_transform_, ffecom_sym_transform_assign_,
	bison_rule_pushlevel_, bison_rule_compstmt_, finish_function,
	store_parm_decls): Likewise.
	* intrin.c (ffeintrin_fulfill_generic): Likewise.
	* lex.c (ffelex_hash_, ffelex_include_, ffelex_next_line_,
	ffelex_file_fixed, ffelex_file_free): Likewise.
	* std.c (ffestd_exec_end): Likewise.
	* ste.c (ffeste_emit_line_note_, ffeste_start_block_,
	ffeste_start_stmt_): Likewise.
	* ste.h (ffeste_filelinenum, ffeste_set_line): Likewise.

	java
	* lex.h (lineno): Rename to ...
	(input_line): ... here
	* parse-scan.y (lineno): Rename to ...
	(input_line): ... here.
	(reset_report): Rename lineno to input_line.
	* check-init.c (check_init): Likewise.
	* class.c (push_class): Likewise.
	* decl.c (complete_start_java_method, end_java_method): Likewise.
	* expr.c (expand_byte_code): Likewise.
	* jcf-parse.c (give_name_to_class, parse_class_file): Likewise.
	* jcf-write.c (generate_bytecode_insns): Likewise.
	* lex.c (java_init_lex, java_allocate_new_line,
	do_java_lex): Likewise.
	* parse.h (YYNOT_TWICE): Likewise.
	* parse.y (empty_statement, expression_statement,
	java_pop_parser_context, java_parser_context_save_global,
	yyerror, register_fields, method_header, safe_layout_class,
	find_in_imports_on_demand, create_artificial_method,
	source_end_java_method, start_complete_expand_method,
	build_thisn_assign, java_complete_lhs,
	maybe_absorb_scoping_block): Likewise.

	objc
	* objc-act.c (objc_init): Rename lineno to input_line.
	(build_module_descriptor, build_selector_translation_table,
	build_protocol_template, build_method_prototype_list_template,
	build_category_template, build_selector_table,
	build_class_template, build_super_template, build_ivar_template,
	build_ivar_list_template, build_method_list_template,
	build_method_template, add_instance_variable): Likewise.

	treelang
	* tree1.c (treelang_init): Rename lineno to input_line.

From-SVN: r66333
2003-05-01 16:13:36 +00:00
Gabriel Dos Reis 820e01bece * c-parse.in: Remove '%expect 32' directive in objc mode
From-SVN: r61940
2003-01-28 01:56:32 +00:00
Geoffrey Keating 17211ab553 Merge from pch-branch.
From-SVN: r61136
2003-01-10 02:22:34 +00:00