Commit Graph

537 Commits

Author SHA1 Message Date
Eric Botcazou bba745c19d re PR c/14188 (Suggestion: improve warning message for call through incompatible type)
PR c/14188
	* builtins.c (expand_builtin_va_arg): Emit an informative message
	if a trap is generated.
	* c-typeck.c (build_function_call): Likewise.

Co-Authored-By: Falk Hueffner <falk@debian.org>

From-SVN: r78294
2004-02-23 12:41:43 +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
Rainer Orth 839ee4bc57 re PR target/13750 (Ada bootstrap failure on Tru64 UNIX: b_gnat[1b].o comparison failure)
PR middle-end/13750
	Revert:
	2004-01-15  Geoffrey Keating  <geoffk@apple.com>
	PR pch/13361
	* c-typeck.c (constructor_asmspec): Delete.
	(struct initializer_stack): Delete field 'asmspec'.
	(start_init): Delete saving of asmspec.
	(finish_init): Don't update constructor_asmspec.
	* dwarf2out.c (rtl_for_decl_location): Duplicate string from tree.
	* stmt.c (expand_asm): Duplicate strings from tree.
	(expand_asm_operands): Likewise.
	* tree.c (tree_size): Update computation of size of STRING_CST.
	(make_node): Don't make STRING_CST nodes.
	(build_string): Allocate string with tree node.
	* tree.def (STRING_CST): Update comment.
	* tree.h (TREE_STRING_POINTER): Adjust for change to STRING_CST.
	(tree_string): Place contents of string in tree node.
	* config/sh/sh.c (sh_handle_sp_switch_attribute): Duplicate string
	from tree.

	cp:
	PR middle-end/13750
	Revert:
	2004-01-15  Geoffrey Keating  <geoffk@apple.com>
	PR pch/13361
	* cp/lex.c (handle_pragma_interface): Duplicate string from tree.
	(handle_pragma_implementation): Likewise.

	testsuite:
	PR middle-end/13750
	Revert:
	2004-01-15  Geoffrey Keating  <geoffk@apple.com>
	PR pch/13361
	* testsuite/g++.dg/pch/wchar-1.C: New.
	* testsuite/g++.dg/pch/wchar-1.Hs: New.

From-SVN: r77343
2004-02-05 21:56:38 +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
Joseph Myers b1adf557d8 c-typeck.c (build_conditional_expr): Do not allow non-lvalue arrays.
* c-typeck.c (build_conditional_expr): Do not allow non-lvalue
	arrays.

testsuite:
	* gcc.dg/c90-array-lval-7.c, gcc.dg/c99-array-lval-7.c: New tests.

From-SVN: r76477
2004-01-24 00:30:58 +00:00
Joseph Myers 53cd18ec8e c-decl.c (c_init_decl_processing): Set pedantic_lvalues to true unconditionally.
* c-decl.c (c_init_decl_processing): Set pedantic_lvalues to
	true unconditionally.
	* c-typeck.c (unary_complex_lvalue, pedantic_lvalue_warning):
	Remove.
	(build_unary_op, build_modify_expr): Don't handle extended
	lvalues.
	(build_component_ref, build_conditional_expr): Call non_lvalue
	instead of pedantic_non_lvalue.
	(build_c_cast): Don't condition use of non_lvalue on pedantic.
	* fold-const.c (fold): Don't check pedantic directly for
	COMPOUND_EXPR.  Ensure that results for COMPOUND_EXPR are
	passed to pedantic_non_lvalue.
	* doc/extend.texi: Remove documentation of extended lvalues.

testsuite:
	* gcc.c-torture/compile/981022-1.c: Remove.
	* gcc.dg/array-5.c: Remove XFAIL.
	* gcc.dg/sequence-pt-1.c: Remove test using extended lvalues.
	* gcc.dg/cast-lvalue-1.c, gcc.dg/compound-lvalue-1.c,
	gcc.dg/cond-lvalue-1.c: Update.
	* gcc.dg/cast-lvalue-2.c: New test.

From-SVN: r76192
2004-01-20 01:38:27 +00:00
Geoffrey Keating a6dd409400 Index: ChangeLog
2004-01-15  Geoffrey Keating  <geoffk@apple.com>

	PR pch/13361
	* c-typeck.c (constructor_asmspec): Delete.
	(struct initializer_stack): Delete field 'asmspec'.
	(start_init): Delete saving of asmspec.
	(finish_init): Don't update constructor_asmspec.
	* dwarf2out.c (rtl_for_decl_location): Duplicate string from tree.
	* stmt.c (expand_asm): Duplicate strings from tree.
	(expand_asm_operands): Likewise.
	* tree.c (tree_size): Update computation of size of STRING_CST.
	(make_node): Don't make STRING_CST nodes.
	(build_string): Allocate string with tree node.
	* tree.def (STRING_CST): Update comment.
	* tree.h (TREE_STRING_POINTER): Adjust for change to STRING_CST.
	(tree_string): Place contents of string in tree node.
	* config/sh/sh.c (sh_handle_sp_switch_attribute): Duplicate string
	from tree.

Index: cp/ChangeLog
2004-01-15  Geoffrey Keating  <geoffk@apple.com>

	PR pch/13361
	* cp/lex.c (handle_pragma_interface): Duplicate string from tree.
	(handle_pragma_implementation): Likewise.

Index: testsuite/ChangeLog
2004-01-15  Geoffrey Keating  <geoffk@apple.com>

	PR pch/13361
	* testsuite/g++.dg/pch/wchar-1.C: New.
	* testsuite/g++.dg/pch/wchar-1.Hs: New.

From-SVN: r75961
2004-01-16 07:20:38 +00:00
Joseph Myers 3897f229d5 re PR c/11234 (-pedantic accepts function pointer <-> void*)
PR c/11234
	* c-typeck.c (build_c_cast): If pedantic, warn for conversions
	between function and object pointers.
	(digest_init): When comparing a pointer to function type to the
	target type, only apply TREE_TYPE once to the pointer to function
	type.
	* except.c (for_each_eh_label_1): Treat data as a pointer to a
	function pointer rather than casting it to a function pointer.
	(for_each_eh_label): Update caller.
	* recog.h (struct insn_data): Use a struct or union for output.
	* genoutput.c (output_insn_data): Update.
	* final.c (get_insn_template): Update.

testsuite:
	* gcc.dg/func-ptr-conv-1.c: New test.
	* gcc.dg/weak/weak-6.c, gcc.dg/weak/weak-7.c: Update.

From-SVN: r75595
2004-01-09 20:03:58 +00:00
Joseph Myers bca6332881 re PR c/6024 (GCC fails to diagnose mismatch of enum types in prototype/function)
PR c/6024
	* c-typeck.c (comptypes): Only treat enumerated types in the same
	translation unit as compatible with each other when they are the
	same type.
	* doc/extend.texi: Update.

f:
	* com.h (ffecom_gfrt_basictype): Correct return type.

testsuite:
	* gcc.dg/enum-compat-1.c: New test.
	* gcc.c-torture/execute/builtin-types-compatible-p.c: Update.

From-SVN: r75521
2004-01-07 22:24:44 +00:00
Andrew Pinski 2f89bbc185 Update forgotten updated copy right years.
From-SVN: r75338
2004-01-02 14:44:27 -08:00
Andrew Pinski 36579663a4 c-typeck.c (finish_init): Free spelling_base before setting it again.
2004-01-02  Andrew Pinski  <pinskia@physics.uc.edu>

        * c-typeck.c (finish_init): Free spelling_base before
        setting it again.

        * cfgloop.c (flow_loops_find): Always free the sbitmap
        headers.

        * predict.c (estimate_probability): Free bbs after being
        done with it.

From-SVN: r75337
2004-01-02 14:42:31 -08:00
Eric Botcazou b300633777 re PR c/13382 (Type information for const pointer disappears during optimisation.)
PR c/13382
	* c-typeck.c (convert_for_assignment): When converting from
	integral type to pointer type, always call convert.

From-SVN: r74960
2003-12-23 05:26:41 +00:00
Eric Botcazou c96f4f736a re PR c/12085 (Internal compiler error in convert_move, at expr.c:504 with -O3 flag)
PR c/12085
	* c-typeck.c (build_function_call): Issue a warning if a
	function is called through an incompatible prototype and
	replace the call by a trap in this case.

From-SVN: r74874
2003-12-20 07:12:39 +00:00
Kazu Hirata ba228239d2 c-typeck.c: Fix comment typos.
* c-typeck.c: Fix comment typos.
	* calls.c: Likewise.
	* cfgcleanup.c: Likewise.
	* cgraph.h: Likewise.
	* dwarfout.c: Likewise.
	* emit-rtl.c: Likewise.
	* explow.c: Likewise.
	* expr.c: Likewise.
	* flow.c: Likewise.
	* function.c: Likewise.
	* gcc.c: Likewise.
	* ggc-zone.c: Likewise.
	* ifcvt.c: Likewise.
	* local-alloc.c: Likewise.
	* predict.c: Likewise.
	* pretty-print.c: Likewise.
	* profile.c: Likewise.
	* ra-colorize.c: Likewise.
	* sched-vis.c: Likewise.
	* stor-layout.c: Likewise.

From-SVN: r74594
2003-12-13 04:11:23 +00:00
Mike Stump d5123baefb c-typeck.c (c_convert_parm_for_inlining): Add argnum...
* c-typeck.c (c_convert_parm_for_inlining): Add argnum, which
	is the argumnt we are processing so that warnings and errors
	will have that information.
	* c-tree.h (c_convert_parm_for_inlining): Add argnum.
	* lang-hooks-def.h
	(lhd_tree_inlining_convert_parm_for_inlining): Likewse.
	* langhooks.c (lhd_tree_inlining_convert_parm_for_inlining): Likewise.
	* langhooks.h (convert_parm_for_inlining): Likewise.
	* tree-inline.c (initialize_inlined_parameters): Compute and
	pass argnum down.

From-SVN: r73507
2003-11-12 19:53:17 +00:00
Joseph Myers 30321c396e c-typeck.c (pedantic_lvalue_warning): Deprecate compound expressions as lvalues.
* c-typeck.c (pedantic_lvalue_warning): Deprecate compound
	expressions as lvalues.
	(internal_build_compound_expr): Remove special handling for
	non-pedantic case.
	* doc/extend.texi: Document that all extended lvalues are now
	deprecated.

testsuite:
	* gcc.dg/compound-lvalue-1.c: New test.
	* gcc.dg/c90-const-expr-2.c, gcc.dg/c99-const-expr-2.c: Remove
	some XFAILs.

From-SVN: r73352
2003-11-08 01:38:48 +00:00
Joseph Myers 0a49d02ccb c-typeck.c (pedantic_lvalue_warning): Deprecate use of conditional expressions as lvalues.
* c-typeck.c (pedantic_lvalue_warning): Deprecate use of
	conditional expressions as lvalues.

testsuite:
	* gcc.dg/cond-lvalue-1.c: New test.

From-SVN: r73273
2003-11-05 17:53:04 +00:00
Joseph Myers dc70e81d6e obstack.h: Merge the following change from gnulib...
include:
	* obstack.h: Merge the following change from gnulib:
	2003-10-21  Paul Eggert  <eggert@twinsun.com>
	* obstack.h (obstack_1grow_fast): Properly parenthesize arg.
	(obstack_ptr_grow_fast, obstack_int_grow_fast):
	Don't use lvalue casts, as GCC plans to remove support for them
	in GCC 3.5.  Reported by Joseph S. Myers.  This bug
	was also present in the non-GCC version, indicating that this
	code had always been buggy and had never been widely used.
	(obstack_1grow, obstack_ptr_grow, obstack_int_grow, obstack_blank):
	Use the fast variant of each macro, rather than copying the
	definiens of the fast variant; that way, we'll be more likely to
	catch future bugs in the fast variants.

gcc:
	* c-typeck.c (pedantic_lvalue_warning): Unconditionally warn of
	deprecation of casts as lvalues.
	* fixinc/inclhack.def (obstack_lvalue_cast): New fix.
	* fixinc/fixincl.x: Regenerate.
	* fixinc/tests/base/obstack.h: New test.

gcc/testsuite:
	* gcc.dg/cast-lvalue-1.c: New test.

From-SVN: r72826
2003-10-22 23:28:39 +01:00
Eric Botcazou b494fd9851 re PR c/12446 (ICE in emit_move_insn on complicated array reference)
PR c/12446
	* c-typeck.c (convert_for_assignment): Issue an error for
	array to pointer assignment after default conversion.
	(digest_init): Likewise.

From-SVN: r72096
2003-10-04 18:02:32 +00:00
Richard Henderson 177560b2d0 stmt.c (expand_asm_operands): Take a location_t, instead of individual file and line.
* stmt.c (expand_asm_operands): Take a location_t, instead of
        individual file and line.
        * c-typeck.c (c_expand_asm_operands): Likewise.
        * tree.h (expand_asm_operands): Update decl.
        * c-common.h (c_expand_asm_operands): Likewise.
        * c-semantics (genrtl_asm_stmt): Update call.
cp/
        * typeck.c (c_expand_asm_operands): Take location_t, instead of
        individual file and line.
ada/
        * trans.c (tree_transform): Update call to expand_asm_operands.

From-SVN: r71884
2003-09-28 12:09:53 -07: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
DJ Delorie 61f71b3447 targhooks.c: New file.
* targhooks.c: New file.
	* targhooks.h: New file.
	* Makefile.in: Add targhooks.o support.
	(function.o): Depend on$(TARGET_H).
	(stmt.o): Likewise.
	(combine.o): Depend on $(TREE_H) and $(TARGET_H).
	* builtins.c (apply_args_size, expand_builtin_apply_args_1,
	expand_builtin_apply): Convert to calls.struct_value_rtx hook.
	(expand_builtin_saveregs): Convert to
	calls.expand_builtin_saveregs hook.
	* c-decl.c (start_decl): Handle new calls.promote_prototypes hook
	here, instead of ...
	(get_parm_info) ... here.
	(store_parm_decls_oldstyle): Convert to calls.promote_prototypes
	hook.
	(finish_function): Handle calls.promote_prototypes hook here too.
	* c-typeck.c (convert_arguments): Convert to
	calls.promote_prototypes hook.
	(c_convert_parm_for_inlining): Likewise.
	* calls.c (initialize_argument_information): Convert to
	calls.promote_function_args hook.
	(expand_call): Convert to calls.struct_value_rtx,
	calls.strict_argument_naming,
	calls.pretend_outgoing_varargs_named, and
	calls.promote_function_return hooks.  Pass fndecl to
	aggregate_value_p.  Initialize CUMULATIVE_ARGS before calling
	hooks, so they can use that.
	(emit_library_call_value_1): Likewise.
	* combine.c (setup_incoming_promotions): Convert to
	calls.promote_function_args hook.
	* emit-rtl.c: Convert to calls.struct_value_rtx hook.
	* expr.c (expand_assignment): Pass call to aggregate_value_p.
	(expand_expr): Likewise.
	* expr.h: Remove support for SETUP_INCOMING_VARARGS,
	STRICT_ARGUMENT_NAMING, PRETEND_OUTGOING_VARARGS_NAMED,
	RETURN_IN_MEMORY macro defaults.
	* final.c (profile_function): Convert to calls.struct_value_rtx
	hook.
	* function.c (aggregate_value_p): Accept function type tree as
	second parameter; try to deduce fntype from it.  Convert to
	calls.return_in_memory hook.
	(assign_parms): Convert to calls.setup_incoming_varargs,
	calls.strict_argument_naming, calls.promote_function_args,
	calls.pretend_outgoing_varargs_named hooks.  Pass fndecl to
	aggregate_value_p.
	(expand_function_start): Likewise.  Convert to
	calls.struct_value_rtx hook.
	(expand_function_end): Convert to calls.promote_function_return hook.
	(allocate_struct_function): Pass fndecl to aggregate_value_p.
	* hard-reg-set.h: Update comments to new hook names.
	* integrate.c (expand_inline_function): Pass fndecl to aggregate_value_p.
	* reg-stack.c (stack_result): Likewise.
	* rtl.h (struct_value_rtx, struct_value_incoming_rtx): Delete.
	* stmt.c (expand_value_return): Convert to
	calls.promote_function_return hook.
	* target-def.h: Add TARGET_PROMOTE_FUNCTION_ARGS,
	TARGET_PROMOTE_FUNCTION_RETURN, TARGET_PROMOTE_PROTOTYPES,
	TARGET_STRUCT_VALUE_RTX, TARGET_RETURN_IN_MEMORY,
	TARGET_EXPAND_BUILTIN_SAVEREGS, TARGET_SETUP_INCOMING_VARARGS,
	TARGET_STRICT_ARGUMENT_NAMING,
	TARGET_PRETEND_OUTGOING_VARARGS_NAMED, and TARGET_CALLS.
	* target.h: Likewise.
	* tree.h (aggregate_value_p): Also takes a tree to deduce function
	attributes from (for target hooks).
	* doc/tm.texi (PROMOTE_FUNCTION_ARGS, PROMOTE_FUNCTION_RETURN,
	PROMOTE_PROTOTYPES, RETURN_IN_MEMORY, STRUCT_VALUE_REGNUM,
	STRUCT_VALUE, STRUCT_VALUE_INCOMING_REGNUM, STRUCT_VALUE_INCOMING,
	EXPAND_BUILTIN_SAVEREGS, SETUP_INCOMING_VARARGS,
	STRICT_ARGUMENT_NAMING, PRETEND_OUTGOING_VARARGS_NAMED): Convert
	to hooks.

	* config/alpha/alpha.c (alpha_output_mi_thunk_osf): Pass function
	to aggregate_value_p.
	* config/arm/arm.c (arm_init_cumulative_args,
	arm_output_mi_thunk): Likewise.
	* config/i386/i386.c (ix86_return_pops_args, x86_this_parameter):
	Likewise.
	* config/mips/mips.c (mips_save_reg_p, mips_expand_prologue,
	mips_can_use_return_insn): Likewise.
	* config/rs6000/rs6000.c (rs6000_output_mi_thunk): Likewise.
	* config/s390/s390.c (s390_output_mi_thunk): Likewise.
	* config/sparc/sparc.c (sparc_output_mi_thunk): Pass function to
	aggregate_value_p.
	* config/story16/stormy16.c (xstormy16_asm_output_mi_thunk): Pass
	function to aggregate_value_p.
	* objc/objc-act.c (generate_struct_by_value_array): Pass NULL to
	aggregate_value_p.

	* config/sh/sh-protos.h (sh_builtin_saveregs): Remove.
	(sh_attr_renesas_p, sh_cfun_attr_renesas_p, sh_function_arg,
	sh_function_arg_advance, sh_pass_in_reg_p): New.  * config/sh/sh.c
	(sh_handle_renesas_attribute, sh_promote_prototypes,
	sh_struct_value_rtx, sh_return_in_memory, sh_builtin_saveregs,
	sh_setup_incoming_varargs, sh_strict_argument_naming,
	sh_pretend_outgoing_varargs_named): New decls.
	(targetm): Add new hooks.
	(calc_live_regs): Save MACL and MACH if the function has the
	renesas attribute.
	(sh_expand_prologue): Support renesas attribute.
	(sh_builtin_saveregs): Make static.
	(sh_build_va_list): Support renesas attribute.
	(sh_va_start): Likewise.
	(sh_va_arg): Likewise.
	(sh_promote_prototypes): New.
	(sh_function_arg): New, moved from sh.h.  Support renesas
	attribute.
	(sh_function_arg_advance): Likewise.
	(sh_return_in_memory): Likewise.
	(sh_strict_argument_naming): Likewise.
	(sh_pretend_outgoing_varargs_named): Likewise.
	(sh_struct_value_rtx): New.
	(sh_attribute): Add renesas attribute.
	(sh_handle_renesas_attribute): New.
	(sh_attr_renesas_p, sh_cfun_attr_renesas_p): New.
	(sh_ms_bitfield_layout_p): Support renesas attribute also.
	(sh_output_mi_thunk): Pass function to aggregate_value_p.  *
	config/sh/sh.h (TARGET_SWITCHES): Add -mrenesas as an alias for
	-mhitachi.
	(STRUCT_VALUE_REGNUM, STRUCT_VALUE, RETURN_IN_MEMORY): Moved to
	target hooks.
	(sh_args): Add renesas_abi flag.
	(INIT_CUMULATIVE_ARGS): Set it.  Pass fndecl to aggregate_value_p.
	(FUNCTION_ARG_ADVANCE, FUNCTION_ARG): Move to sh.c.
	(PASS_IN_REG_P): Support renesas attribute.  Pass DF and TF on the
	stack for the renesas abi.
	(STRICT_ARGUMENT_NAMING, PRETEND_OUTGOING_VARARGS_NAMED,
	SETUP_INCOMING_VARARGS, EXPAND_BUILTIN_SAVEREGS,
	PROMOTE_PROTOTYPES): Moved to sh.c.  * config/sh/sh.md (call): Set
	call cookie to indicate renesas calls.

	* decl.c (finish_function): Pass fndecl to aggregate_value_p.

	* misc.c (default_pass_by_ref): Convert to calls.return_in_memory
	hook.

From-SVN: r71048
2003-09-03 23:18:05 -04:00
Josef Zlomek 31934da71a c-typeck.c (build_binary_op): Kill BIT_ANDTC_EXPR.
* c-typeck.c (build_binary_op): Kill BIT_ANDTC_EXPR.
	* convert.c (convert_to_integer): Kill BIT_ANDTC_EXPR.
	* fold-const.c (int_const_binop): Kill BIT_ANDTC_EXPR.
	(fold): Kill BIT_ANDTC_EXPR and label bit_and.
	* tree.def (BIT_ANDTC_EXPR): Kill.

	* error.c (dump_expr): Kill BIT_ANDTC_EXPR.
	* lex.c (init_operators): Kill BIT_ANDTC_EXPR.
	* pt.c (tsubst_copy): Kill BIT_ANDTC_EXPR.
	* typeck.c (build_binary_op): Kill BIT_ANDTC_EXPR.
	(tsubst_copy_and_build): Kill BIT_ANDTC_EXPR.

	* com.c (ffecom_overlap_): Kill BIT_ANDTC_EXPR.
	(ffecom_tree_canonize_ref_): Kill BIT_ANDTC_EXPR.

From-SVN: r70972
2003-09-01 05:06:25 +00:00
Zack Weinberg 766beae187 c-tree.h: Delete COMPARE_DIFFERENT_TU from enumeration.
* c-tree.h: Delete COMPARE_DIFFERENT_TU from enumeration.
	* c-typeck.c (same_translation_unit_p): New function.
	(comptypes): Use it instead of flags parameter to identify
	structure types from different translation units.
	* c-decl.c (duplicate_decls): Always call comptypes with
	COMPTYPE_STRICT flags argument.
	(c_reset_state): Set BLOCK_SUPERCONTEXT of the block formed
	to file_scope_decl.

From-SVN: r70953
2003-08-30 21:24:19 +00:00
Richard Henderson 4b1e44bee1 c-tree.h (C_DECL_FILE_SCOPE): Move ...
* c-tree.h (C_DECL_FILE_SCOPE): Move ...
        * tree.h (DECL_FILE_SCOPE_P): ... here, and rename.
        * c-decl.c, c-objc-common.c, c-typeck.c: Update to match.

From-SVN: r70925
2003-08-29 14:57:05 -07:00
Matt Kraai 622adc7e1d re PR c/11207 (ICE with negative index in array element designator)
PR c/11207
	* c-typeck.c (set_init_index): Check for negative index.

(testsuite/)
	* gcc.dg/noncompile/20030818-1.c: New.

From-SVN: r70553
2003-08-19 01:36:29 +00:00
Roger Sayle 11017cc737 expr.c (expand_expr): If an ABS_EXPR has a complex type, abort.
* expr.c (expand_expr): If an ABS_EXPR has a complex type, abort.
	* c-typeck.c (build_unary_op): COMPLEX_TYPE is not a valid
	typecode for an ABS_EXPR.

	* doc/c-tree.texi: Document ABS_EXPR.

From-SVN: r70349
2003-08-12 01:45:23 +00:00
Nathan Sidwell bae39a73be c-typeck.c (digest_init): Add conversion for VECTOR_TYPEs.
* c-typeck.c (digest_init): Add conversion for VECTOR_TYPEs.
testsuite:
	* gcc.dg/spe1.c: New test.

From-SVN: r70296
2003-08-10 15:17:35 +00:00
Steven Bosscher 8f5b6d29fb re PR c/10602 (ICE in c-typeck.c (tree check failure))
PR c/10602
	* c-typeck.c (type_lists_compatible_p): Do not compare
	arguments if one of them is an error_mark_node.

	* gcc.dg/noncompile/incomplete-2.c: New test.

From-SVN: r69735
2003-07-24 08:58:42 +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
Roger Sayle 3e4093b64f fold-const.c (const_binop): Avoid performing the FP operation at compile-time...
* fold-const.c (const_binop): Avoid performing the FP operation at
	compile-time, if either operand is NaN and we honor signaling NaNs,
	or if we're dividing by zero and either flag_trapping_math is set
	or the desired mode doesn't support infinities.
	(fold_initializer): New function to fold an expression ignoring any
	potential run-time exceptions or traps.
	* tree.h (fold_initializer): Prototype here.
	* c-typeck.c (build_binary_op): Move to the end of the file so
	that intializer_stack is in scope.  If constructing an initializer,
	i.e. when initializer_stack is not NULL, use fold_initializer to
	fold expressions.
	* simplify-rtx.c (simplify_binary_operation): Likewise, avoid
	performing FP operations at compile-time, if they would raise an
	exception at run-time.

From-SVN: r69533
2003-07-18 00:26:51 +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
Andrew Pinski d07605f570 re PR c/10962 (lookup_field is a linear search on a linked list (can be slow if large struct))
2003-07-16  Andrew Pinski  <pinskia@physics.uc.edu>
ChangeLog:
        PR c/10962
        * ggc.h: Add header guards.
        * c-decl.c (finish_struct): Sort fields if
        number greater than 15 and there are no
        anonymous structs/unions.
        * c-common.h: Include ggc.h.
        (sorted_fields_type): New struct.
        (field_decl_cmp): New prototype.
        (resort_sorted_fields): New prototype.
        (DECL_DECLARES_TYPE_NON_TEMPLATE_P): New macro.
        * c-tree.h: (lang_type): Use pointer to sorted_fields_type
        as s, removing other fields.
        * c-typeck.c (lookup_field): Use s in lang_type.
        These were mostly moved from cp/class.c:
        * c-common.c (field_decl_cmp): New static function.
        (field_decl_cmp): New function.
        (resort_sorted_fields): New function.
cp/ChangeLog:
        * class.c (field_decl_cmp): Remove.
        (resort_field_decl_cmp): Remove.
        (resort_sorted_fields): Remove.
        (add_fields_to_vec): Rename to ...
        (add_fields_to_record_type): this.
        (finish_struct_1): Change to be using
        sorted_fields_type's fields.
        * cp-tree.h (lang_decl): In lang_decl_u3
        change sorted_fields to be a pointer to
        sorted_fields_type.
        (resort_sorted_fields): Remove prototype.
        * search.c (lookup_field_1): Change to be using
        sorted_fields_type's fields.

From-SVN: r69470
2003-07-16 11:45:56 -07:00
Kazu Hirata 4ed432168c c-format.c: Fix comment formatting.
* c-format.c: Fix comment formatting.
	* c-typeck.c: Likewise.
	* coverage.c: Likewise.
	* cppcharset.c: Likewise.
	* cpplib.c: Likewise.
	* dbxout.c: Likewise.
	* gcov-io.h: Likewise.
	* toplev.c: Likewise.

From-SVN: r69276
2003-07-12 22:49:48 +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
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 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
Andreas Jaeger 2f6e4e977d c-lex.c: Convert to ISO C90.
* c-lex.c: Convert to ISO C90.
	* c-objc-common.c: Likewise.
	* c-opts.c: Likewise.
	* c-pch.c: Likewise.
	* c-ppoutput.c: Likewise.
	* c-pragma.h: Likewise.
	* c-pretty-print.c: Likewise.
	* c-pretty-print.h: Likewise.
	* c-semantics.c: Likewise.
	* c-tree.h: Likewise.
	* c-typeck.c: Likewise.

From-SVN: r68327
2003-06-22 15:41:26 +02:00
Nathanael Nerode 4581c67856 * c-typeck.c: Remove #if 0 clauses.
From-SVN: r67905
2003-06-13 16:23:35 +00:00
Aldy Hernandez 9938b5d971 simd-6.c: New.
2003-05-05  Aldy Hernandez  <aldyh@redhat.com>

        * testsuite/gcc.c-torture/compile/simd-6.c: New.

        * c-typeck.c (digest_init): Handle arrays of vector constants.

From-SVN: r66501
2003-05-05 20:31:45 +00:00
Aldy Hernandez 6035d635b5 20030505.c: New.
2003-05-05  Aldy Hernandez  <aldyh@redhat.com>

        * testsuite/gcc.dg/20030505.c: New.

        * c-typeck.c (convert_for_assignment): Opaque pointers can
        interconvert.

        * config/rs6000/rs6000.c: New global opaque_p_V2SI_type_node.
        (rs6000_init_builtins): Initialize opaque_p_V2SI_type_node.
        (spe_init_builtins): Rename all pv2si_type_node to
        opaque_p_V2SI_type_node.
        Remove declaration of pv2si_type_node.
        (is_ev64_opaque_type): Accept opaque pointers.

From-SVN: r66495
2003-05-05 19:21:10 +00:00
Zack Weinberg 87f85ea066 re PR c/10604 (-Wall includes sign conversion warning [3.3 regression])
PR c/10604

	* c-common.c (warn_sign_compare): Initialize to -1.
	* c-opts.c (c_common_init_options): Don't set warn_sign_compare here.
	(c_common_decode_option <OPT_Wall>): Set warn_sign_compare
	for C++ only.
	(c_common_post_options): Set warn_sign_compare from extra_warnings
	if it's still -1 at this point.

	* toplev.c (maybe_warn_unused_parameter): New static variable.
	(set_Wextra): New static function.
	(W_options): Remove "extra".
	(decode_W_option): Call set_Wextra.
	(independent_decode_option): Likewise.
	(set_Wunused): Cooperate with set_Wextra in setting
	warn_unused_parameter.
	(rest_of_compilation): No need to check extra_warnings as
	well as warn_uninitialized.

	* c-typeck.c (build_binary_op, build_conditional_expr):
	No need to check extra_warnings as well as warn_sign_compare.
	(internal_build_compound_expr): No need to check extra_warnings
	as well as warn_unused_value.
	* function.c (expand_function_end): No need to check extra_warnings
	as well as warn_unused_parameter.
	* stmt.c (expand_expr_stmt_value): No need to check extra_warnings
	as well as warn_unused_value.
	* cp/typeck.c (build_x_compound_expr): No need to check
	extra_warnings as well as warn_unused_value.

	* doc/invoke.texi: Clarify documentation of -Wsign-compare.
	* gcc.dg/compare7.c, g++.dg/warn/compare1.C: New testcases.

	* Makefile.in: Disable -Werror for gengtype-lex.o.

From-SVN: r66436
2003-05-03 21:44:31 +00:00
Geoffrey Keating a6fdc0868e c-typeck.c (function_types_compatible_p): Ignore incompatible 'volatile' qualifiers on a function's return type in GNU mode.
2003-04-29  Geoffrey Keating  <geoffk@apple.com>

	* c-typeck.c (function_types_compatible_p): Ignore incompatible
	'volatile' qualifiers on a function's return type in GNU mode.

Index: testsuite/ChangeLog
2003-04-29  Geoffrey Keating  <geoffk@apple.com>

	* gcc.dg/noreturn-5.c: New file.
	* gcc.dg/noreturn-6.c: New file.

From-SVN: r66281
2003-04-30 01:28:39 +00:00
Zack Weinberg b20cbca237 * varasm.c (struct deferred_constant, defer_addressed_constants_flag)
(defer_addressed_constants, output_deferred_addressed_constants): Kill.
	(output_constant_def): Remove code predicated on
	defer_addressed_constants_flag.

	* output.h: Remove prototypes of deleted functions.
	* c-typeck.c (constructor_subconstants_deferred): Kill.
	(struct initializer_stack): Remove 'deferred' field.
	(start_init): Remove all references to the above.
	(finish_init): Likewise. Also remove never-executed call to
	output_deferred_addressed_constants.  Pull assignment to
	defstr out of if expression.

From-SVN: r65865
2003-04-20 22:43:59 +00:00
Eric Botcazou 6a29edeae5 re PR rtl-optimization/7675 (ICE in fixup_var_refs_1)
PR optimization/7675
	* c-typeck.c (build_external_ref): Set the DECL_NONLOCAL flag
	on VAR_DECL, PARM_DECL and FUNCTION_DECL from within
	nested functions if they refer to declarations from parent functions.
	* stmt.c (expand_decl): Don't put automatic variables in registers
	if the DECL_NONLOCAL flag is set.

From-SVN: r65774
2003-04-18 06:45:15 +00:00
Zack Weinberg 6d0c8bb1bc * c-typeck.c (digest_init, push_init_level): Use CONSTRUCTOR_ELTS.
From-SVN: r65540
2003-04-13 03:31:09 +00:00
Zack Weinberg dcf92453c8 tree.c (build_constructor): New function.
* tree.c (build_constructor): New function.
	* tree.h: Prototype it.

	* c-typeck.c (build_c_cast, pop_init_level)
	* profile.c (build_function_info_value, build_gcov_info_value)
	(create_profiler):
	Use build_constructor.

	* builtins.c (expand_builtin_args_info): Remove #if 0 blocks.

	* objc/objc-act.c (build_constructor):
	Rename objc_build_constructor. Use build_constructor.
	(build_objc_string_object, objc_add_static_instance)
	(init_def_list, init_objc_symtab, init_module_descriptor)
	(generate_static_references, build_selector_translation_table)
	(build_descriptor_table_initializer, generate_descriptor_table)
	(build_protocol_initializer, build_ivar_list_initializer)
	(generate_ivars_list, build_dispatch_table_initializer)
	(generate_dispatch_table, generate_protocol_list)
	(build_category_initializer, build_shared_structure_initializer):
	Update to match.

ada:
	* gigi.h, utils2.c (build_constructor):
	Rename gnat_build_constructor. Use build_constructor.
	* decl.c (gnat_to_gnu_entity)
	* trans.c (tree_transform, pos_to_constructor, extract_values)
	* ada/utils.c (build_template, convert_to_fat_pointer, convert)
	(unchecked_convert)
	* ada/utils2.c (build_binary_op, build_call_raise, build_allocator)
	(fill_vms_descriptor):
	Update to match.

cp:
	* class.c (initialize_array)
	* decl.c (reshape_init)
	* decl2.c (build_expr_from_tree)
	* init.c (build_zero_init)
	* pt.c (tsubst_copy, tsubst_copy_and_build)
	* rtti.c (tinfo_base_init, generic_initializer, ptr_initializer)
	(ptm_initializer, class_initializer, get_pseudo_ti_init)
	* semantics.c (finish_compound_literal)
	* typeck.c (build_ptrmemfunc1)
	* typeck2.c (store_init_value, process_init_constructor)
	(build_functional_cast): Use build_constructor.

f:
	* com.c (ffecom_build_complex_constant_, ffecom_expr_)
	(ffecom_init_zero_, ffecom_transform_namelist_, ffecom_vardesc_)
	(ffecom_vardesc_array_, ffecom_vardesc_dims_, ffecom_2)
	* ste.c (ffeste_io_ialist_, ffeste_io_cilist_, ffeste_io_cllist_)
	(ffeste_io_icilist_, ffeste_io_inlist_, ffeste_io_olist_):
	Use build_constructor.

java:
	* class.c (make_field_value, make_method_value, get_dispatch_table)
	(make_class_data, emit_offset_symbol_table)
	* constants.c (build_constants_constructor)
	* java-tree.h (START_RECORD_CONSTRUCTOR)
	* parse.y (maybe_build_array_element_wfl):
	Use build_constructor.

From-SVN: r65539
2003-04-13 01:45:35 +00:00
Zack Weinberg 339a28b96a c-decl.c (struct binding_level): Add shadowed_tags and function_body...
2003-04-10  Zack Weinberg  <zack@codesourcery.com>

	* c-decl.c (struct binding_level): Add shadowed_tags and
	function_body; remove this_block, tag_transparent, and
	subblocks_tag_transparent; update comments.
	(clear_binding_level, lookup_tag_reverse): Kill.
	(make_binding_level): Use ggc_alloc_cleared or memset.
	(lookup_tag): Remove struct binding_level* parameter.  All
	callers changed. Just look at IDENTIFIER_TAG_VALUE, and
	current_binding_level->tags if asked for thislevel_only or if
	we might have to diagnose "struct foo; union foo;"
	(pushlevel): Ignore argument.  Do not push another binding
	level on the transition from the parameters to the top level
	of the function body; just tweak the flags and proceed.
	(poplevel): Overhaul.  Clear IDENTIFIER_TAG_VALUEs; on exiting
	a function body, separate the parameter list from the
	top-level local variables.
	(set_block): Do nothing.
	(pushtag): Set IDENTIFIER_TAG_VALUE and add an entry to
	shadowed_tags if necessary.
	(warn_if_shadowing): Nuke the special case for local shadowing
	parameter.
	(pushdecl): Do not create a shadow entry if we are replacing
	an older decl in the same binding level.
	(pushdecl_function_level): Tweak for new way of indicating
	function scope.
	(shadow_tag_warned): Use TYPE_NAME, not	lookup_tag_reverse.
	(start_function): Don't set subblocks_tag_transparent.
	(finish_function): Fix up the binding_level stack for totally
	empty functions.  Otherwise, don't call poplevel.

	* c-common.c (shadow_warning): MANDATORY argument is no longer
	necessary.  Always use plain warning.
	* c-common.h: Update to match.

	* cfglayout.c (scope_to_insns_initialize): Clear block when we
	hit the FUNCTION_DECL.
	* function.c: Do not create cyclic tree structure.

2003-04-10  Zack Weinberg  <zack@codesourcery.com>

	* c-tree.h (struct lang_identifier): Replace global_value,
	local_value members with symbol_value, tag_value.  Kill
	implicit_decl and limbo_value.
	(IDENTIFIER_GLOBAL_VALUE, IDENTIFIER_LOCAL_VALUE,
	IDENTIFIER_LIMBO_VALUE, IDENTIFIER_IMPLICIT_DECL,
	C_MISSING_PROTOTYPE_WARNED): Kill.
	(IDENTIFIER_SYMBOL_VALUE, IDENTIFIER_TAG_VALUE,
	C_DECL_IMPLICIT, C_DECL_ISNT_PROTOTYPE): New.
	(C_DECL_ANTICIPATED): Rename to C_DECL_INVISIBLE.
	(implicit_decl_warning, lookup_name_current_level,
	record_function_scope_shadow): Don't prototype.
	(pushdecl_function_level): Prototype.

	* c-decl.c (truly_local_externals): New variable.
	(struct binding_level): Adjust commentary.
	(get_function_binding_level, clear_limbo_values,
	record_function_scope_shadow): Kill.
	(lookup_name_current_level, implicit_decl_warning): Are	now static.
	(any_external_decl, record_external_decl): New static functions.
	(clone_underlying type): Split out of pushdecl.
	(c_print_identifier): Update to match changes to struct
	lang_identifier.
	(poplevel): Delete #if 0 block.  Make externals invisible
	instead of clearing their IDENTIFIER_SYMBOL_VALUEs.  Don't
	call clear_limbo_values.  Refer to IDENTIFIER_SYMBOL_VALUE not
	IDENTIFIER_GLOBAL_VALUE or IDENTIFIER_LOCAL_VALUE.
	(duplicate-decls): For real parm decl after a forward decl,
	set TREE_ASM_WRITTEN here.  Allow void foo(...) followed by
	foo(...) { } with only a warning.  Say whether a previous
	declaration was implicit.
	(warn_if_shadowing): Now handles all shadowing, not just
	local-over-local.  Clarify comments.
	(pushdecl): Rewritten.  There is no longer a distinction
	between global and local symbol values; they're all
	IDENTIFIER_SYMBOL_VALUE.  Call record_external_decl on all
	DECL_EXTERNAL decls, and use any_external_decl to check
	against previous externals.  Kill #if 0 blocks.  Don't
	tolerate error_mark_node being NULL.
	(pushdecl_top_level): Handle only those cases which
	Objective C (the only user) needs.
	(pushdecl_function_level): New function.
	(implicitly_declare): Create ordinary decls with
	C_DECL_IMPLICIT set.  Recycle old decls, however they got
	created.
	(lookup_name): It's always IDENTIFIER_SYMBOL_VALUE. Return 0
	for C_DECL_INVISIBLE symbols.
	(lookup_name_current_level): Likewise.  Use chain_member.
	(c_make_fname_decl): Don't muck with DECL_CONTEXT.
	Use pushdecl_function_level.
	(builtin_function): Use C_DECL_INVISIBLE.
	(start_function): Don't muck with IDENTIFIER_IMPLICIT_DECL.
	Use C_DECL_ISNT_PROTOTYPE and C_DECL_IMPLICIT.
	(store_parm_decls): It's IDENTIFIER_SYMBOL_VALUE now.
	(identifier_global_value): Same.  Must scan
	global_binding_level in extremis.

	* c-typeck.c (undeclared_variable): New static function, split
	from build_external_ref.
	(build_external_ref): Use DECL_CONTEXT, not
	IDENTIFIER_LOCAL_VALUE, to decide whether a local hides
	an instance variable.  Restructure for clarity.
	* objc/objc-act.c: Use identifier_global_value, not
	IDENTIFIER_GLOBAL_VALUE.

cp:
	* decl.c: Update all calls to shadow_warning.

testsuite:
	* gcc.c-torture/execute/builtin-noret-2.c: New.
	* gcc.c-torture/execute/builtin-noret-2.x: New.
	XFAIL builtin-noret-2.c at -O1 and above.
	* gcc.dg/redecl.c: New.
	* gcc.dg/Wshadow-1.c: Update error regexps.

From-SVN: r65460
2003-04-11 04:26:55 +00:00
J"orn Rennecke d5019ba399 c-typeck.c (output_init_element): Check for type == error_mark_node.
gcc:
	* c-typeck.c (output_init_element): Check for type == error_mark_node.
gcc/testsuite:
	* gcc.dg/noncompile/init-4.c.c: New test.

From-SVN: r65328
2003-04-07 12:55:27 +01:00