Commit Graph

968 Commits

Author SHA1 Message Date
Diego Novillo 953ff28998 [multiple changes]
2006-01-18  Richard Henderson  <rth@redhat.com>
	    Jakub Jelinek  <jakub@redhat.com>
            Diego Novillo  <dnovillo@redhat.com>

	* libgomp: New directory.
	* Makefile.def: Add target_module libgomp.
	* Makefile.in: Regenerate.
	* configure.in (target_libraries): Add target-libgomp.
	* configure: Regenerate.


contrib/

2006-01-18  Richard Henderson  <rth@redhat.com>
            Diego Novillo  <dnovillo@redhat.com>

	* gcc_update (files_and_dependencies): Add libgomp files.


gcc/

2006-01-18  Richard Henderson  <rth@redhat.com>
            Aldy Hernandez  <aldyh@redhat.com>
	    Jakub Jelinek  <jakub@redhat.com>
            Diego Novillo  <dnovillo@redhat.com>

	* omp-low.c: New file.
	* c-omp.c: New file.

2006-01-18  Richard Henderson  <rth@redhat.com>
	    Jakub Jelinek  <jakub@redhat.com>
            Diego Novillo  <dnovillo@redhat.com>

	* doc/invoke.texi: Document -fopenmp.
	* tree-dump.h (debug_function): Declare.

	* hooks.c (hook_bool_tree_bool_false): New function.
	(hook_tree_tree_null): Remove.
	(hook_tree_tree_tree_null): New.
	* hooks.h: Update to match.

	* tree-pretty-print.c (debug_tree_chain): New.
	(print_generic_expr): Handle TDF_CHAIN.
	(dump_generic_node): Handle BLOCK.
	Do not abort with incomplete SWITCH_EXPRs.
	Do not dump body of an OpenMP directive if TDF_SLIM is given.
	<case OMP_PARALLEL, OMP_FOR, OMP_SECTIONS>: Don't
	print space after directive name.
	<OMP_FOR>: Handle printing OMP_FOR_PRE_BODY.
	Handle OMP_MASTER and OMP_ORDERED.
	Handle printing of OMP_BODY just in one place, goto
	dump_omp_body in the rest of OMP_* nodes that have
	OMP_BODY.
	Don't handle clause nodes here.  Update omp statements to
	use dump_omp_clauses.
	Handle OMP_SINGLE, OMP_SECTIONS, OMP_SECTION,
	OMP_CLAUSE_ORDERED, OMP_CLAUSE_SCHEDULE, OMP_ATOMIC,
	OMP_CRITICAL, OMP_CLAUSE_NOWAIT, GOMP_CLAUSE_IF,
	GOMP_CLAUSE_NUM_THREADS, GOMP_FOR, GOMP_CLAUSE_SHARED,
	GOMP_CLAUSE_FIRSTPRIVATE, GOMP_CLAUSE_LASTPRIVATE,
	GOMP_CLAUSE_COPYIN and GOMP_CLAUSE_COPYPRIVATE.
	Adjust output for GOMP_PARALLEL.
	(dump_omp_clauses): New.
	(print_declaration): Dump DECL_VALUE_EXPR.
	(op_symbol_1): Split out of op_symbol.
	(dumping_stmts): Remove.  Update all users.

	* cgraph.c (cgraph_analyze_queue): New.
	(cgraph_add_new_function): New.
	* cgraph.h (cgraph_analyze_queue): Declare.
	(cgraph_add_new_function): Declare.
	(cgraph_lower_function): Remove.

	* tree.c (walk_tree): Walk OMP_CLAUSE_CHAIN of OMP_CLAUSE_*
	nodes.  Use switch for all nodes, handle most of IS_EXPR_CODE_CLASS
	and TYPE_P nodes in its default clause.
	(empty_body_p): New.
	(tree_range_check_failed): New.
	(build5_stat): New.

	* tree.h (OMP_CLAUSE_REDUCTION_INIT,
	OMP_CLAUSE_REDUCTION_MERGE,
	OMP_CLAUSE_REDUCTION_PLACEHOLDER,
	OMP_CLAUSE_PRIVATE_DEBUG,
	OMP_CLAUSE_LASTPRIVATE_FIRSTPRIVATE, OMP_FOR_PRE_BODY,
	OMP_MASTER_BODY, OMP_ORDERED_BODY OMP_BODY,
	OMP_CLAUSES, OMP_CLAUSE_DECL, OMP_CLAUSE_DEFAULT_KIND,
	OMP_CLAUSE_CHAIN, OMP_CLAUSE_OUTER_DECL,
	OMP_CLAUSE_INNER_DECL, OMP_CLAUSE_NUM_THREADS_EXPR,
	OMP_CLAUSE_IF_EXPR, OMP_CLAUSE_SCHEDULE_CHUNK_EXPR,
	OMP_CLAUSE_SCHEDULE_CHUNK_SIZE. OMP_PARALLEL_VAR_INIT,
	OMP_PARALLEL_VAR_REDUC, OMP_FOR_VAR_INIT,
	OMP_FOR_VAR_LAST, OMP_FOR_VAR_REDUC,
	OMP_SECTIONS_VAR_INIT, OMP_SECTIONS_VAR_LAST,
	OMP_SECTIONS_VAR_REDUC, OMP_CLAUSE_REDUCTION_CODE
	OMP_SINGLE_CLAUSES, OMP_SINGLE_BODY,
	OMP_CLAUSE_SCHEDULE_CHUNK_SIZE, OMP_SECTION_BODY,
	OMP_CRITICAL_NAME, OMP_CRITICAL_BODY): New.
	(TREE_RANGE_CHECK): New.
	(empty_body_p): Declare.
	(enum omp_clause_default_kind): New.
	(build_string_literal): Declare.
	(enum omp_clause_schedule_kind, OMP_CLAUSE_SCHEDULE_KIND): New.
	(build5_stat, build5): Declare.

	* tree-pass.h (TDF_CHAIN): Define.
	* tree-pass.h (PROP_gimple_lomp): Define.
	(pass_lower_omp): Declare.

	* diagnostic.h (debug_tree_chain): Declare.

	* builtins.c (get_builtin_sync_mode): Use 0 as last argument to
	mode_for_size.
	(expand_builtin): Handle sync BUILT_IN_*_16 builtins.
	* builtins.c (build_string_literal): Make extern.

	* gcc.c (include_spec_function): New.
	(static_spec_functions): Add it.
	(main): Move load of libgomp.spec ...
	(LINK_COMMAND_SPEC): ... here.
	(link_gomp_spec): New.
	(static_specs): Include it.
	(LINK_COMMAND_SPEC): Add link_gomp.
	(GOMP_SELF_SPECS): New.
	(driver_self_specs): Include it.
	(switch_matches): Don't mark inline.
	(main): Load libgomp.spec.

	* tree-gimple.c (is_gimple_stmt): True for OMP_MASTER,
	OMP_ORDERED, OMP_CRITICAL, OMP_SECTIONS, OMP_SECTION,
	and OMP_SINGLE, OMP_FOR and OMP_PARALLEL.

	* tree-gimple.h (enum omp_parallel): Declare.
	(determine_parallel_type): Declare.
	(omp_firstprivatize_variable): Declare.
	(omp_reduction_init): Declare.
	(diagnose_omp_structured_block_errors): Declare.
	(struct walk_stmt_info): Add want_return_expr.
	(struct walk_stmt_info): Add want_bind_expr, want_locations.
	(find_omp_clause): Declare.
	(insert_field_into_struct): Declare.
	(struct walk_stmt_info): Move from tree-nested.c
	(walk_stmts): Declare.

	* c-cppbuiltin.c (c_cpp_builtins): If -fopenmp, #define _OPENMP
	to 200505.

	* cgraphunit.c (cgraph_lower_function): Make static.
	(cgraph_finalize_pending_functions): New.
	(cgraph_finalize_function): Call it.
	(cgraph_finalize_compilation_unit): Likewise.

	* builtin-types.def (BT_I16, BT_FN_I16_VPTR_I16,
	BT_FN_BOOL_VPTR_I16_I16, BT_FN_I16_VPTR_I16_I16): Add.
	(BT_FN_UINT_UINT): New.
	(DEF_FUNCTION_TYPE_6, DEF_FUNCTION_TYPE_7,
	DEF_FUNCTION_TYPE_VAR_4): Document.
	(BT_PTR_LONG, BT_PTR_PTR, BT_FN_BOOL, BT_FN_INT,
	BT_FN_VOID_PTRPTR, BT_PTR_FN_VOID_PTR,
	BT_FN_BOOL_LONGPTR_LONGPTR, BT_FN_VOID_OMPFN_PTR_UINT,
	BT_FN_VOID_OMPFN_PTR_UINT_UINT,
	BT_FN_BOOL_LONG_LONG_LONG_LONGPTR_LONGPTR,
	BT_FN_BOOL_LONG_LONG_LONG_LONG_LONGPTR_LONGPTR,
	BT_FN_VOID_OMPFN_PTR_UINT_LONG_LONG_LONG,
	BT_FN_VOID_OMPFN_PTR_UINT_LONG_LONG_LONG_LONG): New.

	* builtins.def: Update DEF_BUILTIN comment to include COND argument.
	Move all DEF_SYNC_BUILTIN () and DEF_GOMP_BUILTIN () builtins
	into separate files.
	(DEF_GOMP_BUILTIN): New.
	(BUILT_IN_OMP_GET_THREAD_NUM, BUILT_IN_GOMP_BARRIER,
	BUILT_IN_GOMP_CRITICAL_START, BUILT_IN_GOMP_CRITICAL_END,
	BUILT_IN_GOMP_CRITICAL_NAME_START, BUILT_IN_GOMP_CRITICAL_NAME_END,
	BUILT_IN_GOMP_LOOP_STATIC_START, BUILT_IN_GOMP_LOOP_DYNAMIC_START,
	BUILT_IN_GOMP_LOOP_GUIDED_START, BUILT_IN_GOMP_LOOP_RUNTIME_START,
	BUILT_IN_GOMP_LOOP_ORDERED_STATIC_START,
	BUILT_IN_GOMP_LOOP_ORDERED_DYNAMIC_START,
	BUILT_IN_GOMP_LOOP_ORDERED_GUIDED_START,
	BUILT_IN_GOMP_LOOP_ORDERED_RUNTIME_START,
	BUILT_IN_GOMP_LOOP_STATIC_NEXT, BUILT_IN_GOMP_LOOP_DYNAMIC_NEXT,
	BUILT_IN_GOMP_LOOP_GUIDED_NEXT, BUILT_IN_GOMP_LOOP_RUNTIME_NEXT,
	BUILT_IN_GOMP_LOOP_ORDERED_STATIC_NEXT,
	BUILT_IN_GOMP_LOOP_ORDERED_DYNAMIC_NEXT,
	BUILT_IN_GOMP_LOOP_ORDERED_GUIDED_NEXT,
	BUILT_IN_GOMP_LOOP_ORDERED_RUNTIME_NEXT,
	BUILT_IN_GOMP_PARALLEL_LOOP_STATIC_START,
	BUILT_IN_GOMP_PARALLEL_LOOP_DYNAMIC_START,
	BUILT_IN_GOMP_PARALLEL_LOOP_GUIDED_START,
	BUILT_IN_GOMP_PARALLEL_LOOP_RUNTIME_START,
	BUILT_IN_GOMP_LOOP_END, BUILT_IN_GOMP_LOOP_END_NOWAIT,
	BUILT_IN_GOMP_ORDERED_START, BUILT_IN_GOMP_ORDERED_END,
	BUILT_IN_GOMP_PARALLEL_START, BUILT_IN_GOMP_PARALLEL_END,
	BUILT_IN_GOMP_SECTIONS_START, BUILT_IN_GOMP_SECTIONS_NEXT,
	BUILT_IN_GOMP_PARALLEL_SECTIONS_START, BUILT_IN_GOMP_SECTIONS_END,
	BUILT_IN_GOMP_SECTIONS_END_NOWAIT, BUILT_IN_GOMP_SINGLE_START,
	BUILT_IN_GOMP_SINGLE_COPY_START, BUILT_IN_GOMP_SINGLE_COPY_END): New.
	* sync-builtins.def: New file, moved from builtins.def.
	* omp-builtins.def: New file, moved from builtins.def.

	* c-objc-common.h (LANG_HOOKS_OMP_PREDETERMINED_SHARING): Redefine.

	* gimple-low.c (lower_function_body): Clear data.
	(lower_stmt): Do not handle COMPOUND_EXPR.
	Remove call to print_node_brief.

	* c-tree.h (c_finish_omp_clauses): New prototype.
	(C_DECL_THREADPRIVATE_P): Define.
	(lookup_name_no_remap, c_omp_remap_private): Remove
	(c_begin_omp_parallel, c_finish_omp_parallel): Update.
	(check_for_loop_decls): Update decl.
	(lookup_name_no_remap, c_omp_remap_private): Declare.
	(build_indirect_ref, build_modify_expr, pushdecl,
	pushdecl_top_level): Move to c-common.h.

	* dwarf2out.c (loc_descriptor_from_tree_1): Don't set unsignedp
	before the switch, but just in the 2 places that need it.

	* c-decl.c (diagnose_mismatched_decls): Do not check for
	mismatched thread-local attributes when OLDDECL is marked
	threadprivate and NEWDECL has no thread-local attributes.
	(merge_decls): Merge C_DECL_THREADPRIVATE_P.
	(c_gimple_diagnostics_recursively): Rename from
	c_warn_unused_result_recursively.  Invoke
	diagnose_omp_structured_block_errors.
	(check_for_loop_decls): Return a singular decl found.

	* langhooks.c (lhd_omp_predetermined_sharing): Return
	OMP_CLAUSE_DEFAULT_SHARED for DECL_ARTIFICIAL decls.
	(lhd_omp_firstprivatize_type_sizes): New.
	(lhd_omp_assignment): New.
	(lhd_omp_predetermined_sharing): New.

	* langhooks.h (struct gimplify_omp_ctx): Forward declare.
	(struct lang_hooks_for_types): Add
	omp_firstprivatize_type_sizes, omp_privatize_by_reference,
	omp_predetermined_sharing, omp_disregard_value_expr,
	omp_private_debug_clause, omp_clause_default_ctor,
	omp_clause_copy_ctor, omp_clause_assign_op, omp_clause_dtor.

	(c_finish_omp_clauses): New.
	(c_finish_bc_stmt): Diagnose break within omp for.
	(c_begin_omp_parallel, c_finish_omp_parallel): New.
	(build_unary_op): Return error_mark after reporting
	a readonly_error.
	(build_modify_expr): Likewise.

	* gimplify.c: Include optabs.h and pointer-set.h.
	(enum gimplify_omp_var_data): Declare.
	(struct gimplify_omp_ctx): Declare.
	(struct gimplify_ctx): Add fields prev_context, combined_pre_p
	and combined_ctxp.
	(gimplify_ctxp, gimplify_omp_ctxp): New local variables.
	(push_gimplify_context, pop_gimplify_context): Allow nesting.
	(splay_tree_compare_decl_uid): New.
	(new_omp_context): New.
	(delete_omp_context): New.
	(gimple_add_tmp_var): Call omp_add_variable.
	(gimplify_bind_expr): Likewise.
	(gimplify_var_or_parm_decl): If omp_notice_variable returned
	true, disregard DECL_VALUE_EXPR on the decl if any.
	(gimplify_expr_in_ctx): New.
	(omp_firstprivatize_variable, omp_firstprivatize_type_sizes
	omp_add_variable, omp_notice_variable, omp_is_private
	gimplify_scan_omp_clauses, gimplify_adjust_omp_clauses_1
	gimplify_adjust_omp_clauses, gimplify_omp_parallel
	gimplify_omp_for, gimplify_omp_workshare, goa_lhs_expr_p
	gimplify_omp_atomic_fetch_op, goa_stabilize_expr
	gimplify_omp_atomic_pipeline, gimplify_omp_atomic_mutex
	gimplify_omp_atomic): New.
	(gimplify_expr): Handle OMP_PARALLEL, OMP_FOR, OMP_SECTIONS,
	OMP_SINGLE, OMP_SECTION, OMP_MASTER, OMP_ORDERED,
	OMP_CRITICAL and OMP_ATOMIC.
	(gimplify_body): Verify gimplify_ctxp is empty after gimplification.

	* c-pragma.h (enum pragma_kind): Add
	PRAGMA_OMP_ATOMIC, PRAGMA_OMP_BARRIER,
	PRAGMA_OMP_CRITICAL, PRAGMA_OMP_FLUSH, PRAGMA_OMP_FOR,
	PRAGMA_OMP_MASTER, PRAGMA_OMP_ORDERED,
	PRAGMA_OMP_PARALLEL, PRAGMA_OMP_PARALLEL_FOR,
	PRAGMA_OMP_PARALLEL_SECTIONS, PRAGMA_OMP_SECTION,
	PRAGMA_OMP_SECTIONS, PRAGMA_OMP_SINGLE,
	PRAGMA_OMP_THREADPRIVATE.

	* tree.def (OMP_PARALLEL, OMP_FOR, OMP_SECTIONS,
	OMP_SINGLE, OMP_SECTION, OMP_MASTER, OMP_ORDERED,
	OMP_CRITICAL, OMP_ATOMIC, OMP_CLAUSE_PRIVATE,
	OMP_CLAUSE_SHARED, OMP_CLAUSE_FIRSTPRIVATE,
	OMP_CLAUSE_LASTPRIVATE, OMP_CLAUSE_REDUCTION,
	OMP_CLAUSE_COPYIN, OMP_CLAUSE_COPYPRIVATE,
	OMP_CLAUSE_IF, OMP_CLAUSE_NUM_THREADS,
	OMP_CLAUSE_SCHEDULE, OMP_CLAUSE_NOWAIT,
	OMP_CLAUSE_ORDERED, OMP_CLAUSE_DEFAULT): Define.

	* print-tree.c (print_node): Dump DECL_VALUE_EXPR.

	* tree-ssa-dce.c (find_control_dependence): Do not assume that
	ENTRY_BLOCK_PTR->next_bb == single_succ (ENTRY_BLOCK_PTR).

	* tree-nested.c (convert_call_expr): Call walk_body on OMP_BODY for
	OpenMP directives.
	(struct nesting_info): Add field_map,
	suppress_expansion, debug_var_chain.
	(create_nesting_tree): Initialize them.
	(lookup_field_for_decl): Use field_map.
	(get_nonlocal_debug_decl, get_local_debug_decl): New.
	(convert_local_omp_clauses): New.
	(finalize_nesting_tree_1): Add debug_var_chain to toplevel block.
	(walk_body): Split out of walk_function.
	(convert_nonlocal_omp_clauses, convert_local_omp_clauses): New.
	(convert_nonlocal_reference): Handle omp statements.
	(convert_local_reference): Likewise.
	(unnest_nesting_tree_1): Split out of finalize_nesting_tree_1.
	(unnest_nesting_tree): New.
	(lower_nested_functions): Call it.
	(insert_field_into_struct): Make extern.
	(struct walk_stmt_info): Move to tree-gimple.h.
	(walk_stmts): Make extern.

	* omp-builtins.def: New file.

	* tree-iterator.c (expr_only): Clarify comment.

	* c-common.h (pushdecl_top_level, pushdecl,
	build_modify_expr, build_indirect_ref,
	c_finish_omp_master, c_finish_omp_critical,
	c_finish_omp_ordered, c_finish_omp_barrier,
	c_finish_omp_atomic, c_finish_omp_flush,
	c_finish_omp_for, c_split_parallel_clauses,
	omp_clause_default_kind, c_omp_sharing_predetermined,
	c_omp_remap_decl): Declare.

	* Makefile.in (BUILTINS_DEF): Add omp-builtins.def.
	(OBJS-common): Add omp-low.o.
	(c-omp.o, omp-low.o): Add.
	(gimplify.o): Add dependency on $(OPTABS_H).
	(GTFILES): Add omp-low.c.
	(gt-stringpool.h): Add.

	* tree-cfg.c (set_bb_for_stmt): Do not update the
	block-to-labels map if we are currently expanding to RTL.
	(tree_node_can_be_shared): Remove unnecessary CONSTANT_CLASS_P
	checks.
	Handle IDENTIFIER_NODE.
	(tree_verify_flow_info): Do not ICE when emitting error
	messages about invalid labels.
	(dump_function_to_file): Reset CFUN before emitting the body
	of the function.
	(debug_function): New.

	* passes.c (init_optimization_passes): Schedule
	pass_lower_omp.

	* langhooks-def.h (lhd_omp_predetermined_sharing,
	lhd_omp_assignment, lhd_omp_firstprivatize_type_sizes):
	Declare.
	(LANG_HOOKS_OMP_FIRSTPRIVATIZE_TYPE_SIZES): Define.
	(LANG_HOOKS_FOR_TYPES_INITIALIZER): Use it.
	(LANG_HOOKS_OMP_PRIVATIZE_BY_REFERENCE,
	LANG_HOOKS_OMP_PREDETERMINED_SHARING,
	LANG_HOOKS_OMP_DISREGARD_VALUE_EXPR,
	LANG_HOOKS_OMP_PRIVATE_DEBUG_CLAUSE,
	LANG_HOOKS_OMP_CLAUSE_DEFAULT_CTOR,
	LANG_HOOKS_OMP_CLAUSE_COPY_CTOR,
	LANG_HOOKS_OMP_CLAUSE_ASSIGN_OP,
	LANG_HOOKS_OMP_CLAUSE_DTOR): Define.
	(LANG_HOOK_DECLS): Use them.


2006-01-18  Dmitry Kurochkin <dmitry.kurochkin@gmail.com>
	    Richard Henderson  <rth@redhat.com>
	    Jakub Jelinek  <jakub@redhat.com>
            Diego Novillo  <dnovillo@redhat.com>

	* c-parser.c (pragma_omp_clause): Define.
	(c_parser_declaration_or_fndef): Document OpenMP syntax.
	(c_parser_compound_statement): Likewise.
	(c_parser_statement): Likewise.
	(c_parser_pragma): Handle omp pragmas.
	(OMP_FOR_CLAUSE_MASK, OMP_SECTIONS_CLAUSE_MASK,
	OMP_PARALLEL_CLAUSE_MASK, OMP_SINGLE_CLAUSE_MASK): Define.
	(c_parser_omp_clause_name, check_no_duplicate_clause,
	c_parser_omp_variable_list,
	c_parser_omp_var_list_parens, c_parser_omp_clause_copyin,
	c_parser_omp_clause_copyprivate,
	c_parser_omp_clause_default,
	c_parser_omp_clause_firstprivate, c_parser_omp_clause_if,
	c_parser_omp_clause_lastprivate,
	c_parser_omp_clause_nowait,
	c_parser_omp_clause_num_threads,
	c_parser_omp_clause_ordered, c_parser_omp_clause_private,
	c_parser_omp_clause_reduction,
	c_parser_omp_clause_schedule, c_parser_omp_clause_shared,
	c_parser_omp_all_clauses, c_parser_omp_structured_block,
	c_parser_omp_atomic, c_parser_omp_barrier,
	c_parser_omp_critical, c_parser_omp_flush,
	c_parser_omp_for_loop, c_parser_omp_for,
	c_parser_omp_master, c_parser_omp_ordered,
	c_parser_omp_sections_scope, c_parser_omp_sections,
	c_parser_omp_parallel, c_parser_omp_single,
	c_parser_omp_construct, c_parser_omp_threadprivate): New.
	* c-pragma.c (init_pragma): Do omp pragma registration here.
	* c.opt (fopenmp): New flag.


2006-01-18  Eric Christopher  <echristo@apple.com>

	* gcc.c (GOMP_SELF_SPECS): Bracket in #ifndef/#endif.
	* config/darwin.h (GOMP_SELF_SPECS): Define.


testsuite/

2006-01-18  Richard Henderson  <rth@redhat.com>
            Aldy Hernandez  <aldyh@redhat.com>
	    Jakub Jelinek  <jakub@redhat.com>
            Diego Novillo  <dnovillo@redhat.com>
            Uros Bizjak  <uros@kss-loka.si>

	* testsuite/gcc.dg/gomp: New directory.

From-SVN: r109902
2006-01-18 14:21:25 -05:00
Mark Mitchell 3b2db49f36 PR c++/23171, c++/23172, c++/25417.
* c-decl.c (compound_literal_number): Remove.
	(build_compound_literal): Use set_compound_literal_name.
	* c-common.c (compound_literal_number): New variable.
	(set_compound_literal_name): New function.
	* c-common.h (set_compound_literal_name): Declare.

	PR c++/23171, c++/23172, c++/25417.
	* typeck.c (build_unary_op): Create temporary variables for
	compound literals whose addresses are taken.
	* init.c (expand_aggr_init_1): Use COMPOUND_LITERAL_P.
	* decl.c (reshape_init_vector): Likewise.
	(reshape_init): Give it external linkage.
	(check_initializer): Use COMPOUND_LITERAL_P.
	(initialize_artificial_var): Allow the initializer to be a
	CONSTRUCTOR.
	* call.c (make_temporary_var_for_ref_to_temp): Use
	create_temporary_var.
	* cp-tree.h (COMPOUND_LITERAL_P): New macro.
	(rehape_init): Declare.
	* typeck2.c (digest_init): Use COMPOUND_LITERAL_P.
	* semantics.c (finish_compound_literal): Use reshape_init.

	PR c++/23172
	* g++.dg/ext/complit4.C: New test.

	PR c++/25417
	* g++.dg/ext/complit5.C: Likewise.

From-SVN: r109075
2005-12-27 06:09:13 +00:00
Jon Grimm 9a8ce21f3b target-def.h (TARGET_DECIMAL_FLOAT_SUPPORTED_P): New.
2005-12-16  Jon Grimm  <jgrimm2@us.ibm.com>
	    Janis Johnson  <janis187@us.ibm.com>
	    Ben Elliston  <bje@au.ibm.com>

	* target-def.h (TARGET_DECIMAL_FLOAT_SUPPORTED_P): New.
	(TARGET_INITIALIZER): Add TARGET_DECIMAL_FLOAT_P.
	* target.h (struct gcc_target): Add decimal_float_supported_p.
	* targhooks.c (default_scalar_mode_supported_p): Handle
	MODE_DECIMAL_FLOAT.
	* builtins.def: Add new builtins for 32, 64 and 128 bit variants
	of inf, nan, finite, isinf and isnan.
	* builtin-types.def (BT_DFLOAT32, BT_DFLOAT64, BT_DFLOAT128,
	BT_DFLOAT32_PTR, BT_DFLOAT64_PTR, BT_DFLOAT128_PTR,
	BT_FN_DFLOAT32, BT_FN_DFLOAT64, BT_FN_DFLOAT128,
	BT_FN_INT_DFLOAT32, BT_FN_INT_DFLOAT64, BT_FN_INT_DFLOAT128,
	BT_FN_DFLOAT32_CONST_STRING, BT_FN_DFLOAT64_CONST_STRING,
	BT_FN_DFLOAT32_CONST_STRING, BT_FN_DFLOAT32_DFLOAT32,
	BT_FN_DFLOAT64_DFLOAT64, BT_FN_DFLOAT128_DFLOAT128): New.
	* c-decl.c (declspecs_add_type): Verify combos on type qualifiers.
	Pedwarn if decimal floating point types are used.  Error if
	decimal floating point is not supported by the target.
	(finish_declspecs): Return type from DFP typespec_word.
	* c-typeck.c (c_common_type): Choose the decimal floating point
	type with the greater precision when determining a common type.
	(convert_arguments): Warn if there is a mismatch between argument
	and prototype for decimal float types.  Warn of conversions with
	binary float types and of precision narrowing due to prototype.
	* c-parser.c (reswords): Add _Decimal32, _Decimal64, _Decimal128.
	(c_token_starts_typename): Handle RID_DFLOAT32/64/128.
	(c_token_starts_declspecs): Likewise.
	(c_parser_attributes): Likewise.
	* c-common.h (enum rid): Add new enumeration values RID_DFLOAT32,
	RID_DFLOAT64, RID_DFLOAT128.
	(T_D32, TEX_D32, T_D64, TEX_D64, T_D128, TEX_D128): New macros.
	* c-common.c (c_common_type_for_mode): Handle decimal float modes.
	(shorten_compare): Convert DFP/BFP operands to a common type.
	(c_common_modes_and_builtins): Register built-in decimal float
	types if the target supports them.
	(handle_mode_addtribute): Handle MODE_DECIMAL_FLOAT.
	* builtins.c (fold_builtin_1): Handle 32, 64 and 128 bit cases of
	inf, nan, finite, isinf and isnan builtins.
	* c-cppbuiltin.c (builtin_define_decimal_float_constants): New.
	(builtin_define_float_constants): Assert non-decimal radix.
	(c_cpp_builtins): Register built-in __DEC_EVAL_METHOD__ define.
	Call builtin_define_decimal_float_constants for each type.
	* c-lex.c (interpret_float): Decode decimal float types from CPP_N
	flags.  Use real_from_string3, which can handle binary or decimal
	floats.
	* c-tree.h (enum c_typespec_keyword): Add cts_dfloat32,
	cts_dfloat64, cts_dfloat128.
	* tree.c (build_common_tree_nodes_2): Add decimal float types.
	* tree.h (enum tree_index): Add new enumeration values
	TI_DFLOAT32_TYPE, TI_DFLOAT64_TYPE, TI_DFLOAT128_TYPE,
	TI_DFLOAT32_PTR_TYPE, TI_DFLOAT64_PTR_TYPE, TI_DFLOAT128_PTR_TYPE.
	(dfloat32_type_node): New macro.
	(dfloat64_type_node, dfloat128_type_node): Likewise.
	(dfloat32_ptr_type_node, dfloat64_ptr_type_node): Likewise.
	(dfloat128_ptr_type_node): Likewise.
	* c-pretty-print.c (pp_c_floating_constant): Append 32, 64 and 128
	bit decimal floating point types with "df", "dd" and "dl".
	* c-format.h (enum format_lengths): Add new enumeration values
	FMT_LEN_H, FMT_LEN_D and FMT_LEN_DD.
	* c-format.c (printf_length_specs, scanf_length_specs): Add
	entries for H, D, DD.
	(print_char_table, scan_char_table): Use new entries.
	(asm_fprintf_char_table, gcc_diag_char_table,
	gcc_cdiag_char_table, gcc_cxxdiag_char_table): Adjust for longer
	length arrays.
	* defaults.h (DECIMAL32_TYPE_SIZE): Define.
	(DECIMAL64_TYPE_SIZE): Likewise.
	(DECIMAL128_TYPE_SIZE): Likewise.
	(TARGET_DEC_EVAL_METHOD): Likewise.
	* doc/extend.texi (Decimal Float): New node.
	(Constructing Calls): Document decimal float built-ins.
	* doc/tm.texi: Document TARGET_DECIMAL_FLOAT_SUPPORTED_P hook.
	* Makefile.in (USER_H): Add $(srcdir)/ginclude/decfloat.h.
	* ginclude/decfloat.h: New file.

Co-Authored-By: Ben Elliston <bje@au.ibm.com>
Co-Authored-By: Janis Johnson <janis187@us.ibm.com>

From-SVN: r108629
2005-12-16 17:38:26 +11:00
Nathan Sidwell 646c083546 re PR c++/21166 (g++ gives error on reference to packed structure elements)
.:	PR c++/21166
	* c-decl.c (finish_struct):  Only set DECL_PACKED on a field
	when its natural alignment is > BITS_PER_UNIT.
	* stor-layout.c (finalize_type_size): Revert my patch of 2005-08-08.
	* c-common.c (handle_packed_attribute): Ignore packing on a field
	whose type is naturally char aligned.
cp:
	PR c++/21166
	* class.c (check_field_decls): Only set DECL_PACKED on a field
	when its natural alignment is > BITS_PER_UNIT.

From-SVN: r107599
2005-11-28 10:34:30 +00:00
Gabriel Dos Reis b8b47f4251 re PR c/21668 (gratuitous warning about "extern const" with initializer)
PR c/21668
        * c-decl.c (grokdeclarator): Don't warn for 'extern const' when
        compiling at the intersection of C and C++.

testsuite/
        PR c/21668
        * gcc.dg/Wc++-compat.c: New.
        * gcc.dg/Wno-c++-compat.c: New.

From-SVN: r107401
2005-11-23 07:07:33 +00:00
Mike Stump 7bbd0aab4c c-common.c (handle_cleanup_attribute): Use a lang hook for lookup_name.
* c-common.c (handle_cleanup_attribute): Use a lang hook for lookup_name.
	* config/darwin-c.c (darwin_pragma_unused): Likewise.
	* c-decl.c (lookup_name_two) Remove.
	* c-tree.h (lookup_name_two): Remove.
	* c-objc-common.h (LANG_HOOKS_LOOKUP_NAME): Add.
	* langhooks-def.h (LANG_HOOKS_LOOKUP_NAME): Add.
	(LANG_HOOKS_DECLS): Add initializer for LANG_HOOKS_LOOKUP_NAME.
	* langhooks.h (lang_hooks_for_decls): Add lookup_name.

cp:
	* cp-objcp-common.h (LANG_HOOKS_LOOKUP_NAME): Add.
	* name-lookup.c (lookup_name_two): Remove.
	(lookup_name_one): Add.
	* name-lookup.h (lookup_name_two): Remove.
	(lookup_name_one): Add.

From-SVN: r107196
2005-11-18 23:40:29 +00:00
Mike Stump 988037306d c-decl.c (lookup_name_two): Add.
* c-decl.c (lookup_name_two): Add.
	* c-tree.h (lookup_name_two): Likewise.
	* c-common.c (handle_cleanup_attribute): Use lookup_name_two instead.
	* config/darwin-c.c (darwin_pragma_unused): Likewise.

cp:
	* name-lookup.c (lookup_name_two): Add.
	* name-lookup.h: Likewise.

testsuite:
	* g++.old-deja/g++.mike/unused.C: Add.

From-SVN: r107062
2005-11-16 02:08:11 +00:00
Andrew Pinski fcc207bfd7 re PR c/24644 (gcc-4.1 compiled ppc64 kernels do not boot)
2005-11-09  Andrew Pinski  <pinskia@physics.uc.edu>

        PR c/24644
        * dwarf2-out.c (add_name_and_src_coords_attributes): Don't add
        a linkage name for a variable if it a register variable.
        * c-decl.c (grokdeclarator): Global register variables
        should be set as PUBLIC.

From-SVN: r106693
2005-11-09 04:33:59 -08:00
Steven Bosscher f95f80d1a7 re PR c/23228 (Silly "unused variable" warning after redeclaration of a local variable)
PR c/23228
	* c-decl.c (pop_scope): Don't warn about an unused variable
	if it is marked with TREE_NO_WARNING.
	(duplicate_decls): Set TREE_NO_WARNING if olddecl and newdecl
	somenow mismatch and olddecl is to be replaced.

From-SVN: r105621
2005-10-19 14:48:29 +00:00
Richard Guenther 9df594d7e7 re PR c/23576 (tree check: expected class ‘type’, have exceptional’ (error_mark) in grokdeclarator, at c-decl.c:4252)
2005-10-04  Richard Guenther  <rguenther@suse.de>

	PR c/23576
	* c-decl.c (grokdeclarator): Don't write to fields
	of error_mark_node.

	* gcc.dg/noncompile/pr23576.c: New testcase.

From-SVN: r104943
2005-10-04 13:58:42 +00:00
Andrew Pinski 11e3f4b6f7 re PR middle-end/23125 (OpenBSD's zic.c causes g++ but not gcc to segfault)
2005-10-04  Andrew Pinski  <pinskia@physics.uc.edu>

        PR middle-end/23125
        * decl.c (make_rtl_for_nonlocal_decl): Use set_user_assembler_name
        instead of change_decl_assembler_name.
2005-10-04  Andrew Pinski  <pinskia@physics.uc.edu>

        PR middle-end/23125
        * c-decl.c (finish_decl): Use set_user_assembler_name even for
        register variables.
        * varasm.c (make_decl_rtl): If a register variable does not
        have a set user assmbler name, error out.
        Decode the asmspec is now name+1 bypassing '*'.
2005-10-04  Andrew Pinski  <pinskia@physics.uc.edu>

        PR middle-end/23125
        * gcc.dg/register-var-3.c: New test.

From-SVN: r104942
2005-10-04 06:39:17 -07:00
Jakub Jelinek df4b9cfe50 re PR middle-end/24109 (non unit-at-a-time failure with compound literals)
PR middle-end/24109
	* c-decl.c (c_write_global_declarations_1): If any
	wrapup_global_declaration_2 call returned true, restart the loop.

	* gcc.c-torture/execute/20050929-1.c: New test.

From-SVN: r104794
2005-09-29 23:34:33 +02:00
Richard Henderson db5f8b93fe re PR debug/23190 (debug info omitted for uninitialized variables (stabs))
PR debug/23190
        * toplev.c (wrapup_global_declaration_1): Split out ...
        (wrapup_global_declaration_2): ... from ...
        (wrapup_global_declarations): ... here.  Return bool.
        (check_global_declaration_1): Split out ...
        (check_global_declarations): from here.
        (emit_debug_global_declarations): New.
        * toplev.h (wrapup_global_declaration_1, wrapup_global_declaration_2,
        check_global_declaration_1, emit_debug_global_declarations): Declare.
        * c-decl.c (c_write_global_declarations_1): Don't create a vector
        of decls.  Call wrapup_global_declaration_1,
        wrapup_global_declaration_2, check_global_declaration_1 directly.
        (c_write_global_declarations_2): New.
        (ext_block): New.
        (c_write_global_declarations): Call c_write_global_declarations_2.
        * langhooks.c (write_global_declarations): Call
        emit_debug_global_declarations.
        * cgraphunit.c (cgraph_varpool_remove_unreferenced_decls): Don't
        remove decls that have DECL_RTL_SET_P.
        * passes.c (rest_of_decl_compilation): Invoke
        cgraph_varpool_finalize_decl for all but functions.
cp/
        * decl.c (wrapup_globals_for_namespace): Call
        emit_debug_global_declarations.
        * decl2.c (cp_finish_file): Likewise.

From-SVN: r104065
2005-09-08 17:47:05 -07:00
Craig Rodrigues 52d09157d5 c-decl.c (diagnose_mismatched_decls): With -Wredundant-decls...
* c-decl.c (diagnose_mismatched_decls):  With -Wredundant-decls,
	do not issue warning for a variable definition following
	a declaration.

From-SVN: r103758
2005-09-02 01:09:42 +00:00
James E Wilson 9bc2a5cb82 Use TYPE_SIZE_UNIT consistently. Last patch was inconsistent.
* c-decl.c (grokdeclarator): Use TYPE_SIZE_UNIT not TYPE_SIZE in
array size check.

From-SVN: r103240
2005-08-17 17:21:28 -07:00
James E Wilson 355a9e437d Emit an error for too large arrays instead of an ICE.
PR tree-optimization/21105
* c-decl.c (grokdeclarator): Use TYPE_SIZE_UNIT not TYPE_SIZE in
TREE_OVERFLOW check.
* gcc.dg/large-size-array.c: New.

From-SVN: r103164
2005-08-16 11:23:58 -07:00
Kaveh R. Ghazi 06145cb9b4 aclocal.m4 (gcc_AC_FUNC_PRINTF_PTR): Delete.
* aclocal.m4 (gcc_AC_FUNC_PRINTF_PTR): Delete.
	* configure.ac: Don't call gcc_AC_FUNC_PRINTF_PTR.
	* system.h (HOST_PTR_PRINTF): Don't define, poison it.

	* bitmap.c, c-decl.c, config/i386/i386-interix.h,
	config/iq2000/iq2000.c, mips-tfile.c, print-rtl.c, print-tree.c:
	Delete HOST_PTR_PRINTF.

	* configure, config.in: Regenerate.

cp:
	* name-lookup.c, ptree.c: Delete HOST_PTR_PRINTF.

From-SVN: r103135
2005-08-16 00:13:53 +00:00
Joseph Myers 91d975b88e re PR c/23143 (parameter forward declarations broken)
PR c/23143
	* c-parser.c (c_parser_parms_list_declarator): Call
	mark_forward_parm_decls.
	* c-decl.c (merge_decls): Only check DECL_IN_SYSTEM_HEADER for
	decls with visibility structure.

testsuite:
	* gcc.dg/parm-forwdecl-1.c, gcc.dg/parm-forwdecl-2.c,
	gcc.dg/parm-forwdecl-3.c, gcc.dg/parm-forwdecl-4.c: New tests.

From-SVN: r102581
2005-07-30 02:34:58 +01:00
Joseph Myers 7c47d6e984 re PR c/529 (-Wshadow warns on function prototypes vs. global vars)
PR c/529
	* c-decl.c (warn_if_shadowing): Don't check for PARM_DECL in
	nested function declarators.
	(pushdecl): Don't call warn_if_shadowing for PARM_DECL.
	(grokparms): Call warn_if_shadowing for parameters used within the
	parameter list.
	(store_parm_decls_newstyle): Call warn_if_shadowing for parameters
	not used within the parameter list.
	(store_parm_decls_oldstyle): Call warn_if_shadowing for parameters.

testsuite:
	* gcc.dg/Wshadow-3.c: New test.

From-SVN: r102571
2005-07-30 00:58:37 +01:00
DJ Delorie b9b8dde302 toplev.h: Add comment about the first parameter for warning().
* toplev.h: Add comment about the first parameter for warning().
* errors.h: Likewise.

* c.opt (Wpragmas): New.
* doc/invoke.texi: Document it.

* function.c (do_warn_unused_parameter): Add warning control to
warning call.
* c-decl.c (warn_if_shadowing): Likewise.
* c-lex.c (cb_def_pragma): Likewise.
* c-pragma.c (GCC_BAD, GCC_BAD2): Likewise.
(pop_alignment): Likewise.
(handle_pragma_pack): Likewise.
(apply_pragma_weak): Likewise.
(handle_pragma_weak): Likewise.
(handle_pragma_redefine_extname): Likewise.
(add_to_renaming_pragma_list): Likewise.
(handle_pragma_extern_prefix): Likewise.
(maybe_apply_renaming_pragma): Likewise.
(handle_pragma_visibility): Likewise.

* config/c4x/c4x-c.c (BAD): Likewise.
(c4x_parse_pragma): Likewise.
* config/ia64/ia64-c.c (ia64_hpux_handle_builtin_pragma): Likewise.
* config/rs6000/rs6000-c.c (SYNTAX_ERROR): Likewise.
(rs6000_pragma_longcall): Likewise.
* config/v850/v850-c.c (pop_data_area): Likewise.
(ghs_pragma_section): Likewise.
(ghs_pragma_section): Likewise.
(ghs_pragma_interrupt): Likewise.
(ghs_pragma_starttda): Likewise.
(ghs_pragma_startsda): Likewise.
(ghs_pragma_startzda): Likewise.
(ghs_pragma_endtda): Likewise.
(ghs_pragma_endsda): Likewise.
(ghs_pragma_endzda): Likewise.

From-SVN: r102168
2005-07-19 16:19:16 -04:00
Joseph Myers 0b359b0103 re PR c/22421 (problems with -Wformat and bit-fields)
PR c/22421
	* c-decl.c (c_build_bitfield_integer_type): New function.
	(finish_struct): Call it.
	* c-pretty-print.c (pp_c_type_specifier): Handle bit-field types.

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

From-SVN: r102091
2005-07-16 17:01:57 +01:00
Daniel Berlin 820cc88fbd Makefile.in (TREE_H): Add treestruct.def.
2005-07-08  Daniel Berlin  <dberlin@dberlin.org>

	* Makefile.in (TREE_H): Add treestruct.def.
	(c-decl.o): Add pointer-set.h
	* c-decl.c (diagnose_mismatched_decls): Don't attempt to look at
	visibility on regular DECL's.
	(merge_decls): Fix the copying of decl nodes of various types for
	the new structures.  Don't update RTL, section name, weak status,
	etc, on DECL's without RTL.
	(grokdeclarator): DECL_ARG_TYPE_AS_WRITTEN is gone.
	Don't check volatile on non-variable types.
	(store_parm_decls_oldstyle): Use pointer_set instead of DECL_WEAK
	to check whether we have seen arguments.
	* c-objc-common.c (c_tree_printer): Reverse order of tests so that
	flag is checked before field (flag is common, field is not).
	* dwarf2out.c (decl_ultimate_origin):  Only DECL's with
	TS_DECL_COMMON could have an origin.
	(add_location_or_const_value_attribute): Don't check section name
	on non-var/function decls.
	(dwarf2out_var_location): Reverse order of tests.
	* emit-rtl.c (set_reg_attrs_for_parm): DECL_CHECK is dead, replace
	with DECL_WRTL_CHECK.
	* expmed.c (make_tree): rtl is now in decl_with_rtl.
	* fold-const.c (fold_binary): Don't check weakness on
	non-var/function decls.
	(tree_expr_nonzero_p): Ditto.
	(fold_checksum_tree): Use tree_decl_extra as sizeof
	buffer.
	* ggc-page.c (extra_order_size_table): Add sizes for
	tree_decl_non_common, tree_parm_decl,  tree_var_decl, and
	tree_field_decl.
	* gimplify.c (gimplify_bind_expr): Only set
	DECL_SEEN_IN_BIND_EXPR_P on VAR_DECL.
	* integrate.c (copy_decl_for_inlining): Don't set RTL on decl's
	without RTL.
	* langhooks-def.h (LANG_HOOK_INIT_TS): New.
	* langhooks.h (init_ts). New langhook.
	* passes.c (rest_of_decl_compilation): Reverse order of tests.
	* print-tree.c (print_node): Update to only print fields that
	exist in the structures the passed decl has.
	* toplev.c (wrapup_global_declarations): Don't reset
	DECL_DEFER_OUTPUT on DECL's that don't contain it.
	* tree-browser.c (browse_tree): DECL_ARG_TYPE_AS_WRITTEN removed.
	* tree-inline.c (remap_decl): Ditto.
	* tree-outof-ssa.c (create_temp): Reverse order of tests.
	* tree-pretty-print.c (print_declaration): Don't print
	DECL_REGISTER on things that don't contain it.
	* tree-vrp.c (expr_computes_nonzero): Don't check weakness on
	non-var/function decls.
	* tree.c (tree_contains_struct): New structure.
	(init_priority_for_decl): New hashtable.
	(tree_int_map): New structure.
	(tree_int_map_eq): New function.
	(tree_int_map_marked_p): Ditto.
	(tree_int_map_hash): Ditto.
	(tree_map): Move to tree.h.
	(tree_map_eq): Externalize.
	(tree_map_hash): Ditto.
	(tree_map_marked_p): Ditto.
	(init_ttree): Set up tree_contains_struct and call langhook.
	(decl_assembler_name): Use DECL_NON_COMMON_CHECK..
	(tree_code_size): Update for new structures.
	(tree_node_structure): Update for new structures.
	(make_node_stat): Don't try to set DECL_IN_SYSTEM_HEADER on decls
	without the field.
	(copy_node_stat):  Copy init priority.
	(build_decl_stat): Ditto for visibility.
	(ts_enum_names): New.
	(tree_contains_struct_check_failed): New function.
	(decl_init_priority_lookup): Ditto.
	(decl_init_priority_insert): Ditto.
	* treestruct.def: New file.
	* tree.h (CODE_CONTAINS_STRUCT): New macro.
	(CONTAINS_STRUCT_CHECK): Ditto.
	(tree_contains_struct_check_failed): New prototype.
	(DECL_CHECK): Removed.
	(DECL_MINIMAL_CHECK): New.
	(DECL_COMMON_CHECK): Ditto.
	(DECL_WRTL_CHECK): Ditto.
	(DECL_NON_COMMON_CHECK): Ditto.
	(DECL_WITH_VIS_CHECK): Ditto.
	(VAR_OR_FUNCTION_DECL_P): Ditto
	(struct tree_decl_minimal): New structure.
	(struct tree_decl_common): Ditto.
	(struct tree_decl_with_rtl): Ditto.
	(struct tree_decl_with_vis): Ditto.
	(struct tree_decl_non_common): Ditto.
	(struct tree_field_decl): Ditto.
	(struct tree_parm_decl): Ditto.
	(struct tree_var_decl): Ditto.
	(struct tree_function_decl): Ditto.
	(struct tree_const_decl): Ditto.
	(struct tree_result_decl): Ditto.
	(union tree_node): Add new structures.
	* var-tracking.c (track_expr_p): Reverse order of tests.

	* doc/c-tree.texi: Add documentation on DECL node internal structure.


2005-07-08  Daniel Berlin  <dberlin@dberlin.org>

	* utils.c (create_param_decl): DECL_ARG_TYPE_AS_WRITTEN is
	removed.

2005-07-08  Daniel Berlin  <dberlin@dberlin.org>

	* Make-lang.in: Add gt-cp-lang.h.
	(cp-lang.o): Ditto.
	* class.c (create_vtable_ptr): Stop setting DECL_ASSEMBLER_NAME on
	the field.
	* config-lang.in: Add cp-lang.c to gtfiles.
	* cp-lang.c: Include hashtab.h.
	(cp_init_ts): New function.
	(LANG_HOOK_INIT_TS): Use macro.
	(decl_shadowed_for_var_lookup): New function.
	(decl_shadowed_for_var_insert): Ditto.
	* cp-tree.h (THUNK_FUNCTION_CHECK): Use decl_common.
	(NON_THUNK_FUNCTION_CHECK): Ditto.
	(DECL_NAMESPACE_ASSOCIATIONS): Use decl_non_common.
	(DECL_INIT_PRIORITY): Ditto.
	(DECL_HAS_SHADOWED_FOR_VAR_P): Ditto.
	(DECL_SHADOWED_FOR_VAR): Use hashtable.
	(SET_DECL_SHADOWED_FOR_VAR): Ditto.
	* decl.c (duplicate_decls): Update for new/updated structures.
	(poplevel): Use SET_DECL_SHADOWED_FOR_VAR.
	* decl2.c (start_static_initialization_or_destruction): Deal with
	priority.
	* pt.c (tsubst_decl): Check TS_DECL_WRTL before doing
	SET_DECL_RTL.
	* tree.c (handle_init_priority_attribute): Handle priority.

2005-07-08  Daniel Berlin  <dberlin@dberlin.org>

	* objc-act.c (objc_push_parm): DECL_ARG_TYPE_AS_WRITTEN is
	removed.
	* objc-act.h (KEYWORD_ARG_NAME): Use decl_non_common.
	(KEYWORD_KEY_NAME): Use decl_minimal.
	(METHOD_SEL_NAME): Ditto..
	(METHOD_SEL_ARGS): Use decl_non_common.
	(METHOD_ADD_ARGS): Ditto.
	(METHOD_ADD_ARGS_ELLIPSIS_P): Use decl_common.
	(METHOD_DEFINITION): Ditto.
	(METHOD_ENCODING): Ditto.
	* objc-lang.c: (objc_init_ts): New function.

2005-07-08  Daniel Berlin  <dberlin@dberlin.org>

	* trans-decl.c (create_function_arglist): DECL_ARG_TYPE_AS_WRITTEN
	is removed.

From-SVN: r101799
2005-07-08 23:37:11 +00:00
Joseph Myers 692a7aa3a5 re PR c/22308 (Failure to diagnose violation of constraint 6.516p2)
PR c/22308
	* c-decl.c (finish_struct): Also copy C_TYPE_FIELDS_READONLY,
	C_TYPE_FIELDS_VOLATILE and C_TYPE_VARIABLE_SIZE to type variants.

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

From-SVN: r101629
2005-07-05 18:34:29 +01:00
Kazu Hirata 619519c89a c-decl.c, [...]: Fix comment typos.
* c-decl.c, tree-object-size.c, tree-vectorizer.c,
	config/arm/unwind-arm.c, config/arm/unwind-arm.h: Fix comment
	typos.

From-SVN: r101558
2005-07-03 16:11:42 +00:00
Gabriel Dos Reis 7f3b2bdaaf re PR c++/18279 (missing function bodies from -fdump-translation-unit)
PR c++/18279
        * c-decl.c (c_write_global_declarations): Dump contents of
        external scope to.
        * tree-dump.c (dequeue_and_dump): Dump abstract origin of a
        decl.
        <TRY_FINALLY_EXPR>, <RETURN_EXPR>, <CASE_LABEL_EXPR>,
        <LABEL_EXPR>,
        <GOTO_EXPR>, <SWITCH_EXPR>: Add.
        (dump_enabled_p): Return TRUE if PHASE is TDI_all and any dump
        is enabled.

Co-Authored-By: Christian Ehrhardt <ehrhardt@mathematik.uni-ulm.de>

From-SVN: r101544
2005-07-03 01:14:56 +00:00
Joseph Myers dee158440e toplev.c (default_tree_printer): Handle setting location with '+' flag.
2005-07-02  Zack Weinberg  <zack@codesourcery.com>
            Joseph S. Myers  <joseph@codesourcery.com>

	* toplev.c (default_tree_printer): Handle setting location with
	'+' flag.
	* c-objc.common.c (c_tree_printer): Likewise.
	* c-format.c (gcc_diag_flag_specs): Add '+'.
	(gcc_cdiag_char_table): Allow '+' flag for tree formats.
	(format_types_orig): Allow '+' flag for gcc_diag and gcc_cdiag
	formats.
	* c-common.c, c-decl.c, c-objc-common.c, c-pragma.c,
	config/arm/pe.c, config/i386/winnt.c, config/ia64/ia64.c,
	config/mcore/mcore.c, config/sh/symbian.c, config/sol2.c,
	config/v850/v850.c, function.c, stor-layout.c, toplev.c,
	tree-inline.c, tree-optimize.c, tree.c, varasm.c: Use '+' flag
	instead of %J or %H.  Use 'q' flag for quoting.  Avoid '.' at end
	of diagnostics.  Use %q+D not %s for a decl.  Do not pass excess
	format arguments where %J is used without %D.

cp:
	* error.c (location_of): Add comment.
	(locate_error, cp_error_at, cp_warning_at, cp_pedwarn_at): Remove.
	* cp-tree.h (cp_error_at, cp_warning_at, cp_pedwarn_at): Remove.
	* call.c, class.c, decl.c, decl2.c, friend.c, init.c,
	name-lookup.c, parser.c, pt.c, search.c, semantics.c, typeck.c,
	typeck2.c: Use '+' flag instead of %J, cp_error_at, cp_warning_at
	or cp_pedwarn_at.  Mark up some diagnostic strings with N_.

java:
	* class.c, decl.c, expr.c: Use '+' flag instead of %J.  Use 'q'
	flag for quoting.

objc:
	* objc-act.c: Use '+' flag instead of %J.  Use 'q' flag for
	quoting.

testsuite:
	* gcc.dg/format/gcc_diag-1.c: Update.

From-SVN: r101532
2005-07-02 11:55:32 +01:00
Steven Bosscher c2f7fa15c0 coretypes.h (tls_model): Add TLS_MODEL_NONE as 0.
* coretypes.h (tls_model): Add TLS_MODEL_NONE as 0.
	* tree.h (struct tree_decl): New field `tls_model'.
	(DECL_TLS_MODEL): New.
	(DECL_THREAD_LOCAL_P): Rename from DECL_THREAD_LOCAL, make it
	a predicate.
	* rtl.h (decl_default_tls_model): Add prototype for it.
	* varasm.c (decl_tls_model): Rewritten and renamed to ...
	(decl_default_tls_model): ... this.
	(default_encode_section_info): Use DECL_TLS_MODEL instead of
	decl_tls_model.
	(assemble_variable): Replace DECL_THREAD_LOCAL with
	DECL_THREAD_LOCAL_P.
	(default_section_type_flags_1): Likewise.
	(categorize_decl_for_section): Likewise.
	* tree.c (staticp): Likewise.
	(recompute_tree_invarant_for_addr_expr): Likewise.
	* drawf2out (loc_descriptor_from_tree_1): Likewise.
	* c-decl.c (diagnose_mismatched_decls): Likewise.
	with DECL_THREAD_LOCAL_P.
	(start_decl): Likewise.
	* print-tree.c (print_node): Likewise.  Print the TLS model.
	(grokdeclarator): Set the default DECL_TLS_MODEL here.
	* c-common.c (handle_tls_model_attribute): Rewrite to set the
	TLS model up based on the attribute.  Never add the attribute
	to the decl's attributes list.
	* config/sparc/sol2.h (ASM_DECLARE_OBJECT_NAME): Replace
	DECL_THREAD_LOCAL with DECL_THREAD_LOCAL_P.

cp/
	* decl.c (start_decl): Replace DECL_THREAD_LOCAL with
	DECL_THREAD_LOCAL_P.
	(cp_finish_decl): Likewise.
	(grokvardecl): Set the default DECL_TLS_MODEL here.

From-SVN: r101465
2005-06-30 12:17:52 +00:00
Eric Christopher 6663ee3b84 re PR c/22052 (redefinition of inline function succeeds)
2005-06-28  Eric Christopher  <echristo@redhat.com>

        PR c/22052
        PR c/21975
        * c-decl.c (diagnose_mismatched_decls): Define DECL_EXTERN_INLINE.
        Use. Fix detection of invalid extern inline redefinition.

2005-06-28  Eric Christopher  <echristo@redhat.com>

        PR c/22052
        PR c/21975
        * gcc.dg/inline1.c: New test.
        * gcc.dg/inline2.c: Ditto.
        * gcc.dg/inline3.c: Ditto.
        * gcc.dg/inline4.c: Ditto.
        * gcc.dg/inline5.c: Ditto.

From-SVN: r101400
2005-06-29 00:11:36 +00:00
Paul Brook 617a1b7144 Makefile.in: Set and use UNWIND_H.
2005-06-28  Paul Brook  <paul@codesourcery.com>

gcc/
	* Makefile.in: Set and use UNWIND_H.  Install as unwind.h.
	* c-decl.c (finish_decl): Call default_init_unwind_resume_libfunc.
	* except.c (add_ehspec_entry): Generate arm eabi filter lists.
	(assign_filter_values): Ditto.
	(output_ttype): New function.
	(output_function_exception_table): Use output_ttype.  Generate arm
	eabi filter lists.
	(default_init_unwind_resume_libfunc): New function.
	* except.h (default_init_unwind_resume_libfunc): Add prototype.
	* optabs.c (init_optabs): Don't set unwind_resume_libfunc.
	* opts.c (decode_options): Use targetm.unwind_tables_default.
	* target-def.h (TARGET_ASM_TTYPE): Provide and use definition.
	(TARGET_ARM_EABI_UNWINDER, TARGET_UNWIND_TABLES_DEFAULT): Ditto.
	* target.h (struct gcc_target): Add asm.ttype, unwind_tables_default
	and arm_eabi_unwinder.
	* unwind-c.c: Support Arm EABI unwinder.
	* unwind.h: Rename ...
	* unwind-generic.h: ... To this.
	* doc/tm.texi (TARGET_ASM_TTYPE, TARGET_ARM_EABI_UNWINDER): Document.
	(TARGET_UNWID_TABLES_DEFAULT): Document.

	* config/arm/arm-protos.h (arm_output_fn_unwind): Add prototype.
	* config/arm/arm.c (arm_unwind_emit, arm_output_ttype): New functions.
	(TARGET_UNWIND_EMIT, TARGET_ASM_TTYPE, TARGET_ARM_EABI_UNWINDER):
	Define.
	(thumb_pushpop, thumb_output_function_prologue): Output unwinding
	directives.
	(arm_unwind_emit_stm, arm_unwind_emit_set): New functions.
	* config/arm/arm.h (MUST_USE_SJLJ_EXCEPTIONS): Only define when
	!TARGET_UNWIND_INFO.
	(ARM_OUTPUT_FN_UNWIND, ARM_EABI_UNWIND_TABLES): Define.
	* config/arm/bpabi.h (TARGET_UNWIND_INFO): Define.
	* config/arm/elf.h (ASM_DECLARE_FUNCTION_NAME,
	ASM_DECLARE_FUNCTION_SIZE): Use ARM_OUTPUT_FN_UNWIND.
	* config/arm/lib1funcs.asm: Include libunwind.S.
	* config/arm/libgcc-bpabi.ver: Add unwinding routines.
	* config/arm/libunwind.S: New file.
	* config/arm/pr-support.c: New file.
	* config/arm/t-bpabi (LIB1ASMFUNCS): Add _unwind.
	(UNWIND_H, LIB2ADDEH, LIB2ADDEHDEP): Set.
	* config/arm/t-symbian (UNWIND_H, LIB2ADDEH, LIB2ADDEHDEP): Set.
	* config/arm/unwind-arm.c: New file.
	* config/arm/unwind-arm.h: New file.
	* config/i386/t-netware (USER_H): Remove unwind.h.
	* config/ia64/ia64.h (TARGET_UNWIND_TABLES_DEFAULT): Define.

gcc/cp/
	* Make-lang.in (cp/except.o): Depend on $(TARGET_H)
	* except.c: Include target.h.
	(init_exception_processing): Initialize unwind_resume_libfunc.
	* doc/tm.texi: Document TARGET_ASM_TTYPE
gcc/ada/
	* misc.c (gnat_init_gcc_eh): Call default_init_unwind_resume_libfunc.
gcc/java/
	* decl.c (java_init_decl_processing): Call
	default_init_unwind_resume_libfunc.
gcc/objc/
	* objc-act.c (objc_init_exceptions): Call
	default_init_unwind_resume_libfunc.
libstdc++/
	* acinclude.m4 (GLIBCXX_ENABLE_SJLJ_EXCEPTIONS): Check for
	__cxa_end_cleanup.
	* libsupc++/Makefile.am (sources): Add eh_call.c and eh_arm.c.
	* libsupc++/eh_arm.cc: New file.
	* libsupc++/eh_call.cc: New file.
	* libsupc++/eh_catch.cc (__cxa_get_exception_ptr): Use
	__gxx_caught_object.
	(__cxa_begin_catch): Ditto. Use __is_gxx_exception_class. Call
	_Unwind_Complete when using the ARM EABI.
	(__cxa_end_catch): Use __is_gxx_exception_class.
	* libsupc++/eh_personality.cc: Define NO_SIZE_OF_ENCODED_VALUE when
	using the ARM EABI.
	(save_caught_exception, restore_caught_exception): New functions.
	(_throw_typet): New typedef.
	(get_ttype_entry, get_adjusted_ptr, check_exception_spec): Add ARM
	EABI implementations.
	(PERSONALITY_FUNCTION): Use new functions.  Addd support for ARM EABI
	unwinding libary.
	(__cxa_unexpected): Disable when using the ARM EABI.
	* libsupc++/eh_throw.cc (__cxa_throw): Use __GXX_INIT_EXCEPTION_CLASS.
	(__cxa_rethrow): Use __is_gxx_exception_class.  Call
	_Unwind_RaiseException when using the ARM EABI.
	* libsupc++/unwind-cxx.h (struct __cxa_exception): Add fields for ARM
	EABI semantics.
	(struct __cxa_eh_globals): Ditto.
	(__cxa_call_terminate): Add prototype.
	(__cxa_type_match, __cxa_begin_cleanup, __cxa_end_cleanup): Add
	prototypes.
	(__get_exception_header_from_obj, __get_exception_header_from_ue):
	Move earlier in file.
	(__is_gxx_exception_class, __GXX_INIT_EXCEPTION_CLASS,
	__gxx_caught_object): New functions.
	* aclocal.m4: Regenerate.
	* configure: Regenerate.
	* Makefile.in: Regenerate.
	* include/Makefile.in: Regenerate.
	* libmath/Makefile.in: Regenerate.
	* libsupc++/Makefile.in: Regenerate.
	* po/Makefile.in: Regenerate.
	* src/Makefie.in: Regenerate.
	* testsuite/makefile.in: Regenerate.

From-SVN: r101385
2005-06-28 19:52:27 +00:00
DJ Delorie 3176a0c28f c-decl.c (pop_scope): Move warning control into warning call.
* c-decl.c (pop_scope): Move warning control into warning call.
(diagnose_mismatched_decls): Likewise.
(pushdecl): Likewise.
(start_decl): Likewise.
(grokparms): Likewise.
(start_function): Likewise.
(store_parm_decls_newstyle): Likewise.
(store_parm_decls_oldstyle): Likewise.
(finish_function): Likewise.
(declspecs_add_scspec): Likewise.
* c-format.c (decode_format_attr): Likewise.
(maybe_read_dollar_number): Likewise.
(avoid_dollar_number): Likewise.
(finish_dollar_format_checking): Likewise.
(check_format_info): Likewise.
(check_format_info_main): Likewise.
(check_format_types): Likewise.
(format_type_warning): Likewise.
* c-typeck.c (function_types_compatible_p): Likewise.
(build_array_ref): Likewise.
(convert_arguments): Likewise.
(build_c_cast): Likewise.
(store_init_value): Likewise.
(process_init_element): Likewise.
(c_start_case): Likewise.
* stor-layout.c (finalize_record_size): Likewise.
* tree-cfg.c (execute_warn_function_noreturn): Likewise.
* tree-inline.c (expand_call_inline): Likewise.

From-SVN: r101384
2005-06-28 15:33:23 -04:00
Kazu Hirata 987b67bc55 builtins.c, [...]: Use fold_buildN instead of fold (buildN (...)).
* builtins.c, c-common.c, c-convert.c, c-decl.c, c-typeck.c,
	convert.c, lambda-code.c, predict.c, tree-cfg.c,
	tree-complex.c, tree-data-ref.c, tree-if-conv.c,
	tree-mudflap.c, tree-scalar-evolution.c, tree-ssa-ccp.c,
	tree-ssa-loop-ivcanon.c, tree-ssa-loop-ivopts.c,
	tree-ssa-loop-manip.c, tree-ssa-phiopt.c, tree-ssa-pre.c,
	tree-vect-analyze.c, tree-vect-transform.c, tree-vectorizer.c,
	tree.c: Use fold_buildN instead of fold (buildN (...)).

From-SVN: r101338
2005-06-26 21:21:34 +00:00
Kelley Cook 366ccddb2b Update FSF address.
From-SVN: r101317
2005-06-25 02:02:01 +00:00
Roger Sayle 6414bad6d7 c-decl.c (grokdeclarator): Only check TREE_OVERFLOW on INTEGER_CST nodes.
* c-decl.c (grokdeclarator): Only check TREE_OVERFLOW on
	INTEGER_CST nodes.
	* c-typeck.c (build_c_cast): Only preserve TREE_OVERFLOW on
	CONSTANT_CLASS_P nodes.

From-SVN: r101187
2005-06-19 16:55:22 +00:00
Kaveh R. Ghazi eb2de0c09d c-decl.c (locate_old_decl): Add format attribute.
* c-decl.c (locate_old_decl): Add format attribute.
	(implicit_decl_warning): Likewise.

cp:
	* call.c (convert_like_real): Add format attribute.
	* typeck.c (check_for_casting_away_constness,
	build_static_cast_1): Likewise.
	* typeck2.c (readonly_error, cxx_incomplete_type_diagnostic):
	Likewise.

From-SVN: r101158
2005-06-18 15:07:28 +00:00
Jakub Jelinek 4b794eaf73 exgettext: Handle gmsgid and cmsgid arguments specially, as gcc-internal-format and c-format.
gcc/po/
	* exgettext: Handle gmsgid and cmsgid arguments specially,
	as gcc-internal-format and c-format.  Because of xgettext
	bug, invoke xgettext once with --language=c, once with
	--language=GCC-source and then merge together.  Fail if
	xgettext is not 0.14.5 or later.
gcc/
	* intl.h (G_): New macro.
	* rtl-error.c (error_for_asm, warning_for_asm): Use gmsgid
	instead of msgid for argument name.
	* tree-ssa.c (warn_uninit): Likewise.
	* c-parser.c (c_parser_error): Likewise.
	* config/rs6000/rs6000-c.c (SYNTAX_ERROR): Likewise.
	* config/darwin-c.c (BAD): Likewise.
	* config/c4x/c4x-c.c (BAD): Likewise.
	* c-pragma.c (GCC_BAD, GCC_BAD2): Likewise.
	* c-errors.c (pedwarn_c99, pedwarn_c90): Likewise.
	* c-common.c (c_parse_error): Likewise.
	* diagnostic.c (diagnostic_set_info, verbatim, inform, warning,
	warning0, pedwarn, error, sorry, fatal_error, internal_error):
	Likewise.
	(fnotice): Use cmsgid instead of msgid for argument name.
	* gcov.c (fnotice): Likewise.
	* protoize.c (notice): Likewise.
	* final.c (output_operand_lossage): Likewise.
	* gcc.c (fatal, notice): Likewise.
	(error): Use gmsgid instead of msgid for argument name.
	* collect2.c (notice, fatal_perror, fatal): Use cmsgid instead
	of msgid for argument name.
	(error): Use gmsgid instead of msgid for argument name.
	* c-decl.c (locate_old_decl, implicit_decl_warning): Use G_()
	instead of N_().
	* c-typeck.c (readonly_error, convert_for_assignment): Likewise.
	* tree-inline.c (inline_forbidden_p_1): Likewise.
	* ABOUT-GCC-NLS: Require gettext 0.14.5 or later.  Mention the new
	conventions for marking translations.
	* doc/install.texi: Mention gettext 0.14.5 or later requirement.
gcc/cp/
	* error.c (locate_error): Use gmsgid instead of msgid for argument
	name.
	(cp_error_at, cp_warning_at, cp_pedwarn_at): Likewise.
gcc/java/
	* jv-scan.c (fatal_error, warning, warning0): Use gmsgid instead of
	msgid for argument name.
	* gjavah.c (error): Likewise.
	* java-tree.h (parse_error_context): Likewise.
	* parse.y (parse_error_context, parse_warning_context,
	issue_warning_error_from_context): Likewise.

From-SVN: r100676
2005-06-06 21:31:40 +02:00
Joseph Myers d4d1cfd444 re PR c/21879 (Memory management problem)
PR c/21879
	* c-decl.c (start_function): Restore label_context_stack_se and
	label_context_stack_vm  if returning with an error.

From-SVN: r100557
2005-06-03 23:25:13 +01:00
Ian Lance Taylor ed3d0b1412 c-decl.c (add_stmt): Add C frontend specific version.
./:	* c-decl.c (add_stmt): Add C frontend specific version.
	(stmts_are_full_exprs_p): Remove.
	* c-common.h (STMT_IS_FULL_EXPR_P): Remove.
	(stmts_are_full_exprs_p): Don't declare.
	* c-semantics.c (add_stmt): Remove.
cp/:
	* semantics.c (add_stmt): Add C++ frontend specific version.
	* cp-tree.h (STMT_IS_FULL_EXPR_P): Define.
	(stmts_are_full_exprs_p): Declare.

From-SVN: r100289
2005-05-28 01:38:11 +00:00
DJ Delorie 5c498b10af common.opt (-Wattributes): New.
* common.opt (-Wattributes): New.  Default true.
* doc/invoke.texi (-Wno-attributes): Document.

* attribs.c (decl_attributes): Move warning control from if() to
warning(OPT_*).
* c-common.c (handle_packed_attribute): Likewise.
(handle_nocommon_attribute): Likewise.
(handle_common_attribute): Likewise.
(handle_noreturn_attribute): Likewise.
(handle_noinline_attribute): Likewise.
(handle_always_inline_attribute): Likewise.
(handle_used_attribute): Likewise.
(handle_unused_attribute): Likewise.
(handle_const_attribute): Likewise.
(handle_transparent_union_attribute): Likewise.
(handle_constructor_attribute): Likewise.
(handle_destructor_attribute): Likewise.
(handle_mode_attribute): Likewise.
(handle_alias_attribute): Likewise.
(handle_visibility_attribute): Likewise.
(handle_tls_model_attribute): Likewise.
(handle_malloc_attribute): Likewise.
(handle_returns_twice_attribute): Likewise.
(handle_pure_attribute): Likewise.
(handle_deprecated_attribute): Likewise.
(handle_vector_size_attribute): Likewise.
(handle_nothrow_attribute): Likewise.
(handle_cleanup_attribute): Likewise.
(handle_warn_unused_result_attribute): Likewise.
(handle_sentinel_attribute): Likewise.
* c-decl.c (diagnose_mismatched_decls): Likewise.
(start_decl): Likewise.
(grokdeclarator): Likewise.
(start_function): Likewise.
* c-format.c (check_function_format): Likewise.
* stor-layout.c (place_field): Likewise.
(finalize_record_size): Likewise.
* tree.c (handle_dll_attribute)): Likewise.
* varasm.c (default_assemble_visibility): Likewise.
* config/darwin.c (darwin_handle_weak_import_attribute): Likewise.
(darwin_assemble_visibility): Likewise.
* config/arc/arc.c (arc_handle_interrupt_attribute): Likewise.
* config/arm/arm.c (arm_handle_fndecl_attribute): Likewise.
(arm_handle_isr_attribute): Likewise.
* config/avr/avr.c (avr_handle_progmem_attribute): Likewise.
(avr_handle_fndecl_attribute): Likewise.
* config/bfin/bfin.c (handle_int_attribute): Likewise.
* config/c4x/c4x.c (c4x_handle_fntype_attribute): Likewise.
* config/h8300/h8300.c (h8300_handle_fndecl_attribute): Likewise.
(h8300_handle_eightbit_data_attribute): Likewise.
(h8300_handle_tiny_data_attribute): Likewise.
* config/i386/i386.c (ix86_handle_cdecl_attribute): Likewise.
(ix86_handle_regparm_attribute): Likewise.
(ix86_handle_struct_attribute): Likewise.
* config/i386/winnt.c (ix86_handle_shared_attribute): Likewise.
(i386_pe_encode_section_info): Likewise.
* config/ia64/ia64.c (ia64_handle_model_attribute): Likewise.
* config/ip2k/ip2k.c (ip2k_handle_progmem_attribute): Likewise.
(ip2k_handle_fndecl_attribute): Likewise.
* config/m32r/m32r.c (m32r_handle_model_attribute): Likewise.
* config/m68hc11/m68hc11 (m68hc11_handle_page0_attribute): Likewise.
(m68hc11_handle_fntype_attribute): Likewise.
(m68hc11_encode_section_info): Likewise.
* config/m68k/m68k.c (m68k_handle_fndecl_attribute): Likewise.
* config/mcore/mcore.c (mcore_handle_naked_attribute): Likewise.
* config/ns32k/ns32k.c (ns32k_handle_fntype_attribute): Likewise.
* config/rs6000/rs6000.c (rs6000_handle_longcall_attribute): Likewise.
* config/sh/sh.c (sh_handle_interrupt_handler_attribute): Likewise.
(sh_handle_sp_switch_attribute): Likewise.
(sh_handle_trap_exit_attribute): Likewise.
* config/sh/symbian.c (sh_symbian_dllimport_p): Likewise.
(sh_symbian_handle_dll_attribute): Likewise.
* config/stormy16/stormy16.c (xstormy16_handle_interrupt_attribute): Likewise.
(xstormy16_handle_below100_attribute): Likewise.
* config/v850/v850.c (v850_handle_interrupt_attribute): Likewise.

[testsuite]

* gcc.dg/Wattributes-1.c: New.
* gcc.dg/Wattributes-2.c: New.
* gcc.dg/Wattributes-3.c: New.

[cp]

* decl.c (duplicate_decls): Move warning control from if() to
warning(OPT_*).
* name-lookup.c (parse_using_directive): Likewise.
* parser.c (cp_parser_elaborated_type_specifier): Likewise.
(cp_parser_init_declarator): Likewise.
* tree.c (handle_com_interface_attribute): Likewise.

[java]

* class.c (set_constant_value): Move warning control from if() to
warning(OPT_*).

From-SVN: r100136
2005-05-25 00:18:19 -04:00
DJ Delorie 44c21c7f03 c-common.c (unsigned_conversion_warning): Move warning control from if() to warning(OPT_*).
* c-common.c (unsigned_conversion_warning): Move warning control
from if() to warning(OPT_*).
(c_common_truthvalue_conversion): Likewise.
(c_do_switch_warnings): Likewise.
* c-decl.c (diagnose_mismatched_decls): Likewise.
(diagnose_mismatched_decls): Likewise.
(define_label): Likewise.
(grokdeclarator): Likewise.
* c-format.c (check_format_info): Likewise.
* c-lex.c (interpret_integer): Likwise.
(lex_string): Likewise.
* c-opts.c (c_common_post_options): Likewise.
* c-parser.c (c_parser_unary_expression): Likewise.
* c-pragma.c (handle_pragma_redefine_extname): Likewise.
(handle_pragma_extern_prefix): Likewise.
* c-typeck.c (build_binary_op): Likewise.
* gcse.c (is_too_expensive): Likewise.
* opts.c (decode_options): Likewise.
* stor-layout.c (place_field): Likewise.
* tree-cfg.c (remove_bb): Likewise.

* c.opt (-Wreturn-type): Add Var(warn_return_type).
* flags.h (warn_return_type): Remove.
* toplev.c (warn_return_type): Likewise.

From-SVN: r100135
2005-05-24 23:59:00 -04:00
Ziemowit Laski 58393038d7 c-common.h (objc_comptypes): Remove prototype.
* c-common.h (objc_comptypes): Remove prototype.
        (objc_compare_types): New prototype.
        (objc_volatilized_decl): Likewise.
        (objc_type_quals_match): Likewise.
        * c-decl.c (objc_mark_locals_volatile): Streamline by calling
        objc_volatilize_decl().
        * c-typeck.c (comp_target_types): Remove third parameter; do
        not call objc_comptypes().
        (comptypes): Remove calls to objc_comptypes().
        (build_function_call): Extend compatible prototype check to ObjC.
        (build_conditional_expr): Adjust call to comp_target_types().
        (convert_for_assignment): Call objc_compare_types() instead of
        objc_comptypes(); adjust calls to comp_target_types(); call
        objc_type_quals_match() before issuing qualifier mismatch
        warnings.
        (build_binary_op): Call objc_compare_types() before issuing
        pointer mismatch warnings; adjust calls to
        comp_target_types().
        * stub-objc.c (objc_comptypes): Remove stub.
        (objc_compare_types): New stub.
        (objc_volatilized_decl): Likewise.
        (objc_type_quals_match): Likewise.

From-SVN: r100126
2005-05-24 22:24:38 +00:00
Ziemowit Laski 6e95543072 Yet more Objective-C++...
* c-common.h (objc_finish_try_stmt): Add.
        (objc_build_synchronized): Add.
        (objc_generate_write_barrier): Add.
        * stub-objc.c (objc_build_synchronized): Add return value.
        (objc_finish_try_stmt): Likewise.
        (objc_generate_write_barrier): Add.

        * c-common.h (objc_rewrite_function_call): Add.
        * c-typeck.c (build_function_call): Allow objc to rewrite
        FUNCTION_DECLs.
        (build_modify_expr): Allow objc to generate write barriers.
        * c.opt (Wassign-intercept): Add.
        (Wstrict-selector-match): Add.
        (fobjc-call-cxx-cdtors): Add.
        (fobjc-direct-dispatch): Add.
        (fobjc-gc): Add.
        * dbxout.c (get_lang_number): Add Objective-C++ support.
        * doc/invoke.texi (-fobjc-call-cxx-cdtors): Likewise.
        (-Wstrict-selector-match): Likewise.
        (-fobjc-direct-dispatch): Likewise.
        (-Wassign-intercept): Likewise.
        (Overall Options): Likewise.
        * gengtype.c (get_output_file_with_visibility): Likewise.
        * stub-objc.c (objc_rewrite_function_call): Add.
        * config/darwin.h (ASM_OUTPUT_LABELREF): Improved quoting support.

        * c-common.c (flag_objc_exceptions): Remove.
        (flag_objc_sjlj_exceptions): Remove.
        * c-decl.c (objc_mark_locals_volatile): Don't change decls
        that are already ok.
        * c-opts.c (c_common_handle_option, case
        OPT_fobjc_exceptions): Remove.
        (case OPT_fobjc_sjlj_exceptions): Remove
        * c.opt (fobjc-call-cxx-cdtors): Have opt create the flag.
        (fobjc-exceptions): Likewise.
        (fobjc-sjlj-exceptions): Likewise.
        * config/rs6000/darwin.h (OFFS_MSGSEND_FAST): Add.
        (OFFS_ASSIGNIVAR_FAST): Add.

From-SVN: r99858
2005-05-17 20:11:44 +00:00
Jan Hubicka 9da5888429 c-decl.c (finish_function): Suppress "control reaches end of non-void function" when...
* c-decl.c (finish_function): Suppress "control reaches end of
	non-void function" when "no return statement in function
	returning non-void" is issued.

From-SVN: r99659
2005-05-13 14:00:55 +00:00
Richard Henderson 317a9ac39e re PR c/21502 (small data relocation mismatch)
PR c/21502
        * c-decl.c (finish_decl): Propagate the completed array type of
        a global variable into the binding.

From-SVN: r99563
2005-05-11 00:33:31 -07:00
Joseph Myers 2798c11f46 re PR c/21342 (some incompatible external declarations not diagnosed)
PR c/21342
	* c-decl.c (pushdecl): When there is a declaration in the current
	scope and the declarations are external linkage, check for
	compatibility with the type in the external scope and update the
	type in the external scope with the composite type information.
	Do not form a composite type of the new type and the visible type
	if they are incompatible.

testsuite:
	* gcc.dg/redecl-11.c, gcc.dg/redecl-12.c, gcc.dg/redecl-13.c,
	gcc.dg/redecl-14.c, gcc.dg/redecl-15.c: New tests.

From-SVN: r99510
2005-05-10 13:38:34 +01:00
DJ Delorie ccf08a6ed7 c-decl.c (store_parm_decls_oldstyle): Let diagnostic machinery decide if the warning will be printed.
* c-decl.c (store_parm_decls_oldstyle): Let diagnostic machinery
decide if the warning will be printed.
* calls.c (expand_call): Likewise.
* function.c (init-function_start): Likewise.

* common.opt (-fdiagnostics-show-option): New.
* opts.c (option_enabled): Accept the option index instead of a
pointer to the option descriptor.
* opts.h (option_enabled): Likewise.
* toplev.c (print_switch_values): Pass option index, not option
descriptor.
* diagnostic.h (diagnostic_info): Add option_index.
* diagnostic.c: Include opts.h.
(diagnostic_set_info): Initialize option_index.
(diagnostic_report_diagnostic): Amend option name if appropriate.
(warning): Check to see if the specified warning is enabled.
Store option index.
* doc/invoke.texi (-fdiagnostics-show-options): Document.

From-SVN: r99169
2005-05-03 13:55:46 -04:00
Joseph Myers 6fb58bba49 re PR c/15698 (no error in presence of broken builtin fn + K&R declaration)
PR c/15698
	* c-tree.h (C_DECL_BUILTIN_PROTOTYPE): New.
	* c-decl.c (current_function_prototype_built_in,
	current_function_prototype_arg_types): New.
	(merge_decls): Keep source location of prototype followed by
	nonprototype declaration.  Update C_DECL_BUILTIN_PROTOTYPE.
	(builtin_function): Set C_DECL_BUILTIN_PROTOTYPE.
	(start_function): Always set current_function_prototype_locus,
	current_function_prototype_built_in and
	current_function_prototype_arg_types.  Check for external
	prototype whether or not visible for external function and set
	current_function_prototype_arg_types accordingly.
	(store_parm_decls_oldstyle): Use
	current_function_prototype_arg_types for checking old-style
	definition against prototype.  Give warnings only if
	current_function_prototype_built_in).

testsuite:
	* gcc.dg/builtins-30.c: Update expected messages.
	* gcc.dg/pr15698-1.c, gcc.dg/pr15698-2.c, gcc.dg/pr15698-3.c,
	gcc.dg/pr15698-4.c, gcc.dg/pr15698-5.c, gcc.dg/pr15698-6.c,
	gcc.dg/pr15698-7.c, pr15698-8.c: New tests.

From-SVN: r99118
2005-05-02 20:39:04 +01:00
Joseph Myers eb3490b96c re PR c/21213 (segfault declaring a transparent union)
PR c/21213
	* c-decl.c (finish_struct): Don't dereference NULL TYPE_FIELDS of
	transparent union.

testsuite:
	* gcc.dg/transparent-union-3.c: New test.

From-SVN: r98808
2005-04-27 01:47:06 +01:00
DJ Delorie d4ee4d2525 diagnostic.c (warning): Accept parameter to classify warning option.
* diagnostic.c (warning): Accept parameter to classify warning option.
(warning0): New, for when a pointer to an error() like function is needed.
* errors.c (warning): Likewise.
* errors.h (warning, warning0): Adjust prototypes.
* toplev.h (warning, warning0): Likewise.

* attribs.c, builtins.c, c-common.c, c-decl.c, c-format.c,
c-gimplify.c, c-lex.c, c-objc-common.c, c-opts.c, c-parser.c,
c-pragma.c, c-typeck.c, calls.c, cgraph.c, coverage.c, emit-rtl.c,
fold-const.c, fortran/trans-decl.c, function.c, gcse.c,
genautomata.c, haifa-sched.c, opts.c, passes.c, regclass.c,
reload1.c, stmt.c, stor-layout.c, toplev.c, tree-cfg.c,
tree-dump.c, tree-inline.c, tree-mudflap.c, tree-optimize.c,
tree-ssa.c, tree.c, varasm.c: Adjust warning() callers.

* config/alpha/alpha.c, config/arc/arc.c, config/arm/arm.c,
config/avr/avr.c, config/bfin/bfin.c, config/c4x/c4x-c.c,
config/c4x/c4x.c, config/cris/cris.c, config/darwin-c.c,
config/darwin.c, config/darwin.h, config/h8300/h8300.c,
config/i386/cygming.h, config/i386/djgpp.h, config/i386/i386.c,
config/i386/winnt.c, config/ia64/ia64-c.c, config/ia64/ia64.c,
config/ip2k/ip2k.c, config/m32r/m32r.c, config/m68hc11/m68hc11.c,
config/m68k/m68k.c, config/mcore/mcore.c, config/mips/mips.c,
config/mmix/mmix.c, config/ns32k/ns32k.c, config/pa/pa-hpux11.h,
config/pa/pa.c, config/rs6000/aix43.h, config/rs6000/aix51.h,
config/rs6000/aix52.h, config/rs6000/darwin.h,
config/rs6000/rs6000-c.c, config/rs6000/rs6000.c,
config/s390/s390.c, config/sh/sh.c, config/sh/sh.h,
config/sh/symbian.c, config/sol2-c.c, config/sol2.c,
config/stormy16/stormy16.c, config/v850/v850-c.c,
config/v850/v850.c, config/xtensa/xtensa.c: Adjust warning()
callers.

* ada/misc.c: Adjust warning() callers.

* cp/call.c, cp/class.c, cp/cvt.c, cp/decl.c, cp/decl2.c,
cp/except.c, cp/friend.c, cp/init.c, cp/lex.c, cp/mangle.c,
cp/method.c, cp/name-lookup.c, cp/parser.c, cp/repo.c, cp/rtti.c,
cp/tree.c, cp/typeck.c, cp/typeck2.c: Adjust warning() callers.

* fortran/trans-decl.c: Adjust warning() callers.

* java/class.c, java/decl.c, java/expr.c, java/jcf-io.c,
java/jcf-parse.c, java/jv-scan.c, java/parse.y: Adjust warning()
callers.

* objc/objc-act.c: Adjust warning() callers.

* treelang/parse.y: Adjust warning() callers.

From-SVN: r98633
2005-04-23 17:29:07 -04:00
Nathan Sidwell 41806d92af alias.c (true_dependence): Remove 'abort' from comments.
* alias.c (true_dependence): Remove 'abort' from comments. Use
	gcc_assert and gcc_unreachable as appropriate.
	(canon_true_dependence): Likewise.
	* bb-reorder.c (connect_traces): Likewise.
	* c-common.c (c_add_case_label): Likewise.
	* c-decl.c (finish_function): Likewise.
	* caller-save.c (insert_restore, insert_save): Likewise.
	* cfg.c (update_bb_profile_for_threading): Likewise.
	* cfganal.c (flow_active_insn_p): Likewise.
	* cfgexpand.c (add_reg_br_prob_note): Likewise.
	* cfgrtl.c (rtl_redirect_edge_and_branch_force, rtl_split_edge,
	cfg_layout_merge_blocks): Likewise.
	* ifcvt.c (cond_exec_process_insns, merge_if_block,
	find_if_block): Likewise.
	* integrate.c (allocate_initial_values): Likewise.
	* jump.c (reverse_condition, reverse_condition_maybe_unordered,
	swap_condition, unsigned_condition, signed_condition,
	mark_jump_label, invert_jump_1, rtx_renumbered_equal_p,
	reg_or_subregno): Likewise.
	* lambda-code.c (lambda_compute_auxillary_space,
	lambda_transform_legal_p): Likewise.
	* lambda-mat.c (lambda_matrix_inverse_hard): Likewise.
	* langhooks.c (lhd_set_decl_assembler_name, lhd_type_promotes_to,
	lhd_incomplete_type_error, lhd_expand_expr,
	lhd_types_compatible_p, lhd_tree_size): Likewise.
	* lcm.c (create_pre_exit, optimize_mode_switching): Likewise.
	* local-alloc.c (update_equiv_regs): Likewise.
	* loop-unroll.c (peel_loop_completely
	unroll_loop_constant_iterations, unroll_loop_runtime_iterations,
	peel_loop_simple, unroll_loop_stupid,
	analyze_iv_to_split_insn): Likewise.
	* loop.c (gen_prefetch, find_and_verify_loops,
	basic_induction_var): Likewise.
	* modulo-sched.c (normalize_sched_times, check_nodes_order): Likewise.
	* value-prof.c (tree_find_values_to_profile): Likewise.
	* varasm.c (named_section, default_assemble_integer,
	decode_addr_const): Likewise.

From-SVN: r98508
2005-04-21 15:47:33 +00:00
Joseph Myers 187230a795 re PR c/12913 (Jumps into variable length array scope not rejected)
PR c/12913
	* c-tree.h (struct c_label_list): Update comment.
	(struct c_label_context): Rename to struct c_label_context_se.
	(label_context_stack): Rename to label_context_stack_se.
	(C_DECL_UNJUMPABLE_VM, C_DECL_UNDEFINABLE_VM, struct
	c_label_context_vm, label_context_stack_vm, c_begin_vm_scope,
	c_end_vm_scope): New.
	(C_DECL_DECLARED_BUILTIN, C_DECL_USED): Use FUNCTION_DECL_CHECK.
	* c-decl.c (pop_scope): Call c_end_vm_scope.
	(pushdecl): Call c_begin_vm_scope for variably modified
	declarations.
	(define_label): Check for jumping into scope of identifier with
	variably modified type.  Push label on stack for those defined at
	current context of identifiers with variably modified type.
	(start_function): Create stack level for context of identifiers
	with variably modified type.
	(finish_function): Pop stack level for context of identifiers with
	variably modified type.
	* c-typeck.c (label_context_stack): Rename to
	label_context_stack_se.
	(label_context_stack_vm, c_begin_vm_scope, c_end_vm_scope): New.
	(c_finish_goto_label): Check for jumping into scope of identifier
	with variably modified type.  Push label on stack for those jumped
	to from current context of identifiers with variably modified
	type.
	(struct c_switch): Add blocked_vm.
	(c_start_case): Initialize blocked_vm.
	(do_case): Check blocked_vm.
	(c_finish_case): Add comment.
	(c_begin_stmt_expr, c_finish_stmt_expr): Update for renamed
	variable label_context_stack.

objc:
	* objc-act.c (objc_start_function): Create stack level for context
	of identifiers with variably modified type.

testsuite:
	* gcc.dg/c99-vla-jump-1.c, gcc.dg/c99-vla-jump-2.c,
	gcc.dg/c99-vla-jump-3.c, gcc.dg/c99-vla-jump-4.c,
	gcc.dg/c99-vla-jump-5.c: New tests.

From-SVN: r98464
2005-04-20 17:41:48 +01:00