Commit Graph

1227 Commits

Author SHA1 Message Date
Tristan Gingold 412cd71971 c-tree.h (c_default_pointer_mode): New variable.
2012-03-09  Tristan Gingold  <gingold@adacore.com>

        * c-tree.h (c_default_pointer_mode): New variable.
        * c-decl.c (c_default_pointer_mode): New variable.
        (c_build_pointer_type): New function.
        (grokdeclarator): Call c_build_pointer_type instead
        of build_pointer_type.

        * config/vms/vms-c.c: Include c-tree.h
        (saved_pointer_mode): New variable.
        (handle_pragma_pointer_size): New function.
        (vms_pragma_pointer_size, vms_pragma_required_pointer_size): Likewise.
        (vms_c_register_pragma): Register __pointer_size and
        __required_pointer_size pragmas.

From-SVN: r185136
2012-03-09 11:49:50 +00:00
Uros Bizjak 560ad30812 re PR c/52290 (internal compiler error: tree check: expected function_decl, have var_decl in start_function, at c-decl.c:7712)
PR c/52290
	* c-decl.c (start_function): Exit early if decl1 is not FUNTION_DECL.

testsuite/ChangeLog:

	PR c/52290
	* gcc.dg/noncompile/pr52290.c: New test.

From-SVN: r184511
2012-02-23 17:34:02 +01:00
Jakub Jelinek 45f41865ff re PR c/52181 (merge_decls doesn't handle DECL_USER_ALIGN properly)
PR c/52181
	* c-decl.c (merge_decls): Copy DECL_USER_ALIGN bit from olddecl to
	newdecl.

	* decl.c (duplicate_decls): If olddecl has bigger DECL_ALIGN than
	newdecl, copy DECL_ALIGN to newdecl and or DECL_USER_ALIGN bits.

	* c-c++-common/pr52181.c: New test.

From-SVN: r184193
2012-02-14 07:15:35 +01:00
Steven Bosscher 8554df86e0 c-decl.c: Do not include tree-mudflap.h
gcc/
	* c-decl.c: Do not include tree-mudflap.h
	* tree-optimize.c: Likewise.
	* Makefile.in: Update dependencies.

cp/
	* decl2.c: Do not include tree-mudflap.h
	* semantics.c: Likewise.

From-SVN: r183165
2012-01-13 22:14:21 +00:00
Arnaud Charlet 86d71fcabf c-decl.c (ext_block): Moved up.
* c-decl.c (ext_block): Moved up.
	(collect_all_refs, for_each_global_decl): Take ext_block into account.

From-SVN: r182953
2012-01-06 15:11:33 +01:00
Joseph Myers 48b0b19630 gcc:
* c-decl.c (diagnose_mismatched_decls, grokdeclarator, grokfield)
	(finish_struct): Refer to C11 in comments.  Use flag_isoc11.
	* c-parser.c (c_parser_static_assert_declaration)
	(c_parser_static_assert_declaration_no_semi, c_parser_declspecs)
	(c_parser_alignas_specifier, c_parser_alignof_expression): Refer
	to C11 in comments.  Use flag_isoc11.
	* c-typeck.c (comptypes_check_different_types): Refer to C11 in
	comment.
	* doc/cpp.texi (Overview): Refer to -std=c11 instead of -std=c1x.
	* doc/cppopts.texi (-std=c11, -std=gnu11): Document in preference
	to -std=c1x and -std=gnu1x.
	* doc/extend.texi (Inline, Alternate Keywords, Other Builtins)
	(__builtin_complex, Unnamed Fields): Refer to -std=c11 and C11
	instead of -std=c1x and C1X.
	* doc/invoke.texi (-std=c11, -std=iso9899:2011): Document in
	preference to -std=c1x.
	(-std=gnu11): Document in preference to -std=gnu1x.
	* doc/standards.texi: Document C11 instead of C1X.  Document C11
	as actual standard.  Document headers required from freestanding
	C11 implementations.
	* ginclude/float.h, ginclude/stddef.h: Test __STDC_VERSION__ >=
	201112L for C11.  Update comments to refer to C11.

gcc/c-family:
	* c-common.c (flag_isoc99): Update comment to refer to C11.
	(flag_isoc1x): Change to flag_isoc11.
	* c-common.h (flag_isoc99): Update comment to refer to C11.
	(flag_isoc1x): Change to flag_isoc11.
	* c-cppbuiltin.c (cpp_atomic_builtins): Change comment to refer to
	C11.
	* c-opts.c (set_std_c1x): Change to set_std_c11.
	(c_common_handle_option): Handle OPT_std_c11 and OPT_std_gnu11.
	Call set_std_c11.
	(set_std_c89, set_std_c99, set_std_c11): Use flag_isoc11.
	(set_std_c1): Use CLK_STDC11 and CLK_GNUC11.
	* c.opt (std=c1x): Change to std=c11.  Document as non-draft
	standard.
	(std=c1x, std=iso9899:2011): Add as aliases of std=c11.
	(std=gnu1x): Change to std=gnu11.  Refer to non-draft standard.
	(std=gnu1x): Make alias of std=gnu11.

gcc/testsuite:
	* gcc.dg/c11-version-1.c, gcc.dg/c11-version-2.c,
	gcc.dg/c94-version-1.c, gcc.dg/c99-version-1.c,
	gcc.dg/gnu11-version-1.c: New tests.

libcpp:
	* include/cpplib.h (CLK_GNUC1X): Change to CLK_GNUC11.
	(CLK_STDC1X): Change to CLK_STDC11.
	* init.c (lang_defaults): Update comments.
	(cpp_init_builtins): Update language tests.  Use 201112L for C11
	__STDC_VERSION__.

From-SVN: r182551
2011-12-20 20:44:13 +00:00
Jakub Jelinek 17fe0fdbad re PR debug/51410 (duplicate variable DIE)
PR debug/51410
	* c-decl.c (pop_scope): Don't add DECL_EXTERNAL decls
	for debug info if scope is file_scope.

	* gcc.dg/debug/dwarf2/pr51410.c: New test.

From-SVN: r182027
2011-12-05 21:51:07 +01:00
Jakub Jelinek 156030d35f re PR c/51339 (ICE: in convert_move, at expr.c:326 with -fopenmp and parallel for)
PR c/51339
	* c-decl.c (c_finish_incomplete_decl, finish_decl): Call
	relayout_decl instead of layout_decl.

	* gcc.dg/gomp/pr51339.c: New test.

From-SVN: r182026
2011-12-05 21:49:38 +01:00
Alan Modra 1d551e4dc3 c-decl.c (warn_if_shadowing): Don't warn if shadowed identifier is from system header.
* c-decl.c (warn_if_shadowing): Don't warn if shadowed
	identifier is from system header.

From-SVN: r181684
2011-11-24 13:15:21 +10:30
Joseph Myers d19fa6b5f1 c-decl.c (shadow_tag_warned, [...]): Handle _Alignas specifiers.
* c-decl.c (shadow_tag_warned, grokdeclarator): Handle _Alignas
	specifiers.
	(build_null_declspecs): Initialize align_log and alignas_p fields.
	(declspecs_add_alignas): New.
	* c-parser.c (c_token_starts_declspecs): Handle RID_ALIGNAS.
	(c_parser_declspecs): Handle _Alignas specifiers.
	(c_parser_alignas_specifier): New.
	(c_parser_alignof_expression): Diagnose alignof use for non-C1X.
	Diagnose _Alignof (expression).
	* c-tree.h (struct c_declspecs): Add align_log and alignas_p
	fields.
	(declspecs_add_alignas): Declare.
	* ginclude/stddef.h (max_align_t): Define for C1X and C++11.
	* ginclude/stdalign.h: New.
	* Makefile.in (USER_H): Add stdalign.h.

c-family:
	* c-common.c (c_common_reswords): Add _Alignas and _Alignof.
	(c_sizeof_or_alignof_type): Diagnose alignof applied to a function
	type.
	(check_user_alignment): New.  Split out of
	handle_aligned_attribute.  Disallow integer constants with
	noninteger types.  Conditionally allow zero.
	(handle_aligned_attribute): Use check_user_alignment.
	* c-common.h (RID_ALIGNAS, check_user_alignment): New.

testsuite:
	* g++.dg/cpp0x/alignof3.C, gcc.dg/c1x-align-1.c,
	gcc.dg/c1x-align-2.c, gcc.dg/c1x-align-3.c, gcc.dg/c1x-align-4.c,
	gcc.dg/c90-align-1.c, gcc.dg/c99-align-1.c: New tests.
	* gcc.dg/gnu89-const-expr-1.c, gcc.dg/gnu90-const-expr-1.c,
	gcc.dg/gnu99-const-expr-1.c, gcc.dg/gnu99-static-1.c: Update
	expected diagnostics.

From-SVN: r181048
2011-11-06 23:51:19 +00:00
Michael Meissner e79983f458 Convert standard builtin functions from being arrays to using a functional interface
From-SVN: r179820
2011-10-11 19:55:09 +00:00
Jakub Jelinek 8b57bfebe0 common.opt: Add -foptimize-strlen option.
* common.opt: Add -foptimize-strlen option.
	* Makefile.in (OBJS): Add tree-ssa-strlen.o.
	(tree-sssa-strlen.o): Add dependencies.
	* opts.c (default_options_table): Enable -foptimize-strlen
	by default at -O2 if not -Os.
	* passes.c (init_optimization_passes): Add pass_strlen
	after pass_object_sizes.
	* timevar.def (TV_TREE_STRLEN): New timevar.
	* params.def (PARAM_MAX_TRACKED_STRLENS): New parameter.
	* tree-pass.h (pass_strlen): Declare.
	* tree-ssa-strlen.c: New file.
	* c-decl.c (merge_decls): If compatible stpcpy prototype
	is seen, set implicit_built_in_decls[BUILT_IN_STPCPY].
cp/
	* decl.c (duplicate_decls): If compatible stpcpy prototype
	is seen, set implicit_built_in_decls[BUILT_IN_STPCPY].
testsuite/
	* gcc.dg/strlenopt-1.c: New test.
	* gcc.dg/strlenopt-1f.c: New test.
	* gcc.dg/strlenopt-2.c: New test.
	* gcc.dg/strlenopt-2f.c: New test.
	* gcc.dg/strlenopt-3.c: New test.
	* gcc.dg/strlenopt-4.c: New test.
	* gcc.dg/strlenopt-4g.c: New test.
	* gcc.dg/strlenopt-4gf.c: New test.
	* gcc.dg/strlenopt-5.c: New test.
	* gcc.dg/strlenopt-6.c: New test.
	* gcc.dg/strlenopt-7.c: New test.
	* gcc.dg/strlenopt-8.c: New test.
	* gcc.dg/strlenopt-9.c: New test.
	* gcc.dg/strlenopt-10.c: New test.
	* gcc.dg/strlenopt-11.c: New test.
	* gcc.dg/strlenopt-12.c: New test.
	* gcc.dg/strlenopt-12g.c: New test.
	* gcc.dg/strlenopt-13.c: New test.
	* gcc.dg/strlenopt-14g.c: New test.
	* gcc.dg/strlenopt-14gf.c: New test.
	* gcc.dg/strlenopt-15.c: New test.
	* gcc.dg/strlenopt-16g.c: New test.
	* gcc.dg/strlenopt-17g.c: New test.
	* gcc.dg/strlenopt-18g.c: New test.
	* gcc.dg/strlenopt.h: New file.

From-SVN: r179277
2011-09-27 18:15:46 +02:00
Dodji Seketeli 3797cb21ff PR c++/33255 - Support -Wunused-local-typedefs warning
gcc/

	* c-decl.c (lookup_name): Use the new
	maybe_record_typedef_use.
	(pushdecl): Use the new
	record_locally_defined_typedef.
	(store_parm_decls): Allocate cfun->language.
	(finish_function): Use the new maybe_warn_unused_local_typedefs,
	and free cfun->language.
	(c_push_function_context): Allocate cfun->language here only if
	needed.
	(c_pop_function_context): Likewise, mark cfun->language
	for collection only when it should be done.
	* c-common.c (handle_used_attribute): Don't ignore TYPE_DECL
	nodes.
	* c-typeck.c (c_expr_sizeof_type, c_cast_expr): Use the new
	maybe_record_local_typedef_use.

gcc/c-family

	* c-common.h (struct c_language_function::local_typedefs): New
	field.
	(record_locally_defined_typedef, maybe_record_typedef_use)
	(maybe_warn_unused_local_typedefs): Declare new functions.
	* c-common.c (record_locally_defined_typedef)
	(maybe_record_typedef_use)
	(maybe_warn_unused_local_typedefs): Define new functions.
	* c.opt: Declare new -Wunused-local-typedefs flag.

gcc/cp

	* name-lookup.c (pushdecl_maybe_friend_1): Use the new
	record_locally_defined_typedef.
	* decl.c (finish_function): Use the new
	maybe_warn_unused_local_typedefs.
	(grokfield): Use the new record_locally_defined_typedef.
	* parser.c (lookup_name): Use the new maybe_record_typedef_use.

gcc/doc/

	* invoke.texi: Update documentation for -Wunused-local-typedefs.

gcc/testsuite/

	* g++.dg/warn/Wunused-local-typedefs.C: New test file.
	* c-c++-common/Wunused-local-typedefs.c: Likewise.

libstdc++-v3/

	* include/ext/bitmap_allocator.h
	(__detail::__mini_vector::__lower_bound): Remove unused typedef.
	* src/istream.cc (std::operator>>(basic_istream<char>& __in,
	basic_string<char>& __str)): Likewise.
	(std::getline): Likewise.
	* src/valarray.cc (__valarray_product): Likewise.

From-SVN: r178692
2011-09-08 15:54:24 +02:00
Joseph Myers c4b3a0a0b9 c-decl.c (grokdeclarator): Diagnose _Noreturn for non-C1X if pedantic.
* c-decl.c (grokdeclarator): Diagnose _Noreturn for non-C1X if
	pedantic.
	* c-parser.c (c_parser_declspecs): Include _Noreturn in syntax
	comment.
	* ginclude/stdnoreturn.h (noreturn): Don't define for C++.

testsuite:
	* gcc.dg/c90-noreturn-1.c, gcc.dg/c99-noreturn-1.c: New tests.

From-SVN: r177899
2011-08-19 14:25:51 +01:00
Joseph Myers bbceee64be c-decl.c (shadow_tag_warned): Check for _Noreturn.
* c-decl.c (shadow_tag_warned): Check for _Noreturn.
	(quals_from_declspecs): Assert _Noreturn not present.
	(grokdeclarator): Handle _Noreturn.
	(build_null_declspecs): Initialize noreturn_p.
	(declspecs_add_scspec): Handle RID_NORETURN.
	* c-parser.c (c_token_starts_declspecs, c_parser_declspecs)
	(c_parser_attributes): Handle RID_NORETURN.
	* c-tree.h (struct c_declspecs): Add noreturn_p.
	* ginclude/stdnoreturn.h: New.
	* Makefile.in (USER_H): Add stdnoreturn.h.

c-family:
	* c-common.c (c_common_reswords): Add _Noreturn.
	(keyword_is_function_specifier): Handle RID_NORETURN.
	* c-common.h (RID_NORETURN): New.

testsuite:
	* gcc.dg/c1x-noreturn-1.c, gcc.dg/c1x-noreturn-2.c,
	gcc.dg/c1x-noreturn-3.c, gcc.dg/c1x-noreturn-4.c,
	gcc.dg/c1x-noreturn-5.c: New tests.

From-SVN: r177881
2011-08-18 22:35:42 +01:00
Romain Geissler 4309e92c98 plugin.def: Add event for finish_decl.
2011-08-11  Romain Geissler  <romain.geissler@gmail.com>
            Brian Hackett  <bhackett1024@gmail.com>

gcc/ChangeLog:

      * plugin.def: Add event for finish_decl.
      * plugin.c (register_callback, invoke_plugin_callbacks): Same.
      * c-decl.c (finish_decl): Invoke callbacks on above event.
      * doc/plugins.texi: Document above event.

gcc/cp/ChangeLog:

      * decl.c (cp_finish_decl): Invoke callbacks on finish_decl event.

gcc/testsuite/ChangeLog:

      * g++.dg/plugin/decl_plugin.c: New.
      * g++.dg/plugin/decl-plugin-test.C: New.
      * g++.dg/plugin/plugin.exp: Add above testcase.

Co-Authored-By: Brian Hackett <bhackett1024@gmail.com>

From-SVN: r177674
2011-08-11 11:57:38 -04:00
Jason Merrill 3a636414b2 re PR c++/30112 (pragma redefine_extname fails when namespaces are involved)
PR c++/30112
gcc/c-family/
	* c-common.h: Declare c_linkage_bindings.
	* c-pragma.c (handle_pragma_redefine_extname): Use it.
gcc/
	* c-decl.c (c_linkage_bindings): Define.
gcc/cp/
	* decl.c (cp_finish_decl): Apply pragma redefine_extname in
	other namespaces as well.
	* name-lookup.c (c_linkage_bindings): Define.
	(lookup_extern_c_fun_in_all_ns): Rename from
	lookup_extern_c_fun_binding_in_all_ns.  Return tree.
	(pushdecl_maybe_friend_1): Adjust.  Copy DECL_ASSEMBLER_NAME.

Co-Authored-By: Mark Glisse <marc.glisse@normalesup.org>

From-SVN: r176650
2011-07-22 15:59:49 -04:00
Richard Guenther 6d6c952527 re PR tree-optimization/49645 (g++.dg/tree-ssa/pr8781.C FAILs on Tru64 UNIX)
2011-07-06  Richard Guenther  <rguenther@suse.de>

	PR tree-optimization/49645
	* c-decl.c (finish_decl): Also set DECL_HARD_REGISTER for global
	register variables.
	* tree-ssa-sccvn.c (vn_reference_op_eq): Disregard differences
	in type qualification here ...
	(copy_reference_ops_from_ref): ... not here.
	(vn_reference_lookup_3): ... or here.
	(copy_reference_ops_from_ref): Record decl bases as MEM[&decl].
	(vn_reference_lookup): Do the lookup with a valueized ao-ref.

	* g++.dg/tree-ssa/pr8781.C: Disable SRA.

From-SVN: r175916
2011-07-06 14:05:54 +00:00
Richard Guenther fce5dddd3d c-common.c (c_common_nodes_and_builtins): Build all common tree nodes first.
2011-07-05  Richard Guenther  <rguenther@suse.de>

	c-family/
	* c-common.c (c_common_nodes_and_builtins): Build all common
	tree nodes first.

	* c-decl.c (c_init_decl_processing): Defer building common
	tree nodes to c_common_nodes_and_builtins.

	cp/
	* decl.c (cxx_init_decl_processing): Defer building common
	tree nodes to c_common_nodes_and_builtins.

From-SVN: r175856
2011-07-05 14:39:30 +00:00
Jakub Jelinek 563007852e c-common.h (c_tree_chain_next): New static inline function.
* c-common.h (c_tree_chain_next): New static inline function.

	* c-decl.c (union lang_tree_node): Use it in chain_next expression.

	* cp-tree.h (union lang_tree_node): Use it in chain_next expression.

From-SVN: r175542
2011-06-27 18:56:08 +02:00
Jakub Jelinek f796c43880 re PR c++/46400 (g++ Segmentation Fault on heavily templated project.)
PR c++/46400
	* cp-tree.h (union lang_tree_node): Use TYPE_NEXT_VARIANT
	instead of TYPE_CHAIN for chain_next for types.

	* c-decl.c (union lang_tree_node): Use TYPE_NEXT_VARIANT
	instead of TYPE_CHAIN for chain_next for types.

From-SVN: r175389
2011-06-24 23:11:16 +02:00
Paolo Carlini b504a91833 cp-tree.h (error_operand_p): Remove.
/gcc/cp
2011-06-10  Paolo Carlini  <paolo.carlini@oracle.com>

	* cp-tree.h (error_operand_p): Remove.

/gcc
2011-06-10  Paolo Carlini  <paolo.carlini@oracle.com>

	* tree.h (error_operand_p): Add.
	* dbxout.c (dbxout_type_fields): Use the latter.
	* c-decl.c (add_stmt): Likewise.
	* gimplify.c (omp_add_variable, omp_notice_variable,
	gimplify_scan_omp_clauses): Likewise.

From-SVN: r174899
2011-06-10 11:08:14 +00:00
Nathan Froyd 38e01f9ec9 move TS_STATEMENT_LIST to be a substructure of TS_TYPED
move TS_STATEMENT_LIST to be a substructure of TS_TYPED
gcc/
	* c-decl.c (c_push_function_context): Copy the current statement
	list stack.
	(add_stmt): Check building_stmt_list_p and push_stmt if necessary.
	(finish_struct): Call building_stmt_list_p instead of checking
	cur_stmt_list.
	* c-parser.c (c_parser_postfix_expression): Likewise.
	* c-typeck.c (c_end_compound_stmt): Likewise.
	* print-tree.c (print_node) [STATEMENT_LIST]: Don't print TREE_CHAIN.
	* tree-iterator.c (stmt_list_cache): Change to a VEC.
	(alloc_stmt_list): Adjust for stmt_list_cache's new type.
	(free_stmt_list): Likewise.
	* tree.h (struct tree_statement_list): Include typed_tree instead
	of tree_common.
	* tree.c (initialize_tree_contains_struct): Mark TS_STATEMENT_LIST
	as TS_TYPED instead of TS_COMMON.

gcc/c-family/
	* c-common.h (struct stmt_tree_s) [x_cur_stmt_list]: Change to a VEC.
	(stmt_list_stack): Define.
	(cur_stmt_list): Adjust for new type of x_cur_stmt_list.
	* c-semantics.c (push_stmt_list, pop_stmt_list): Likewise.

gcc/cp/
	* cp-tree.h (building_stmt_tree): Delete.
	* decl.c (save_function_data): Tweak initializer for x_cur_stmt_list.
	(build_aggr_init_full_exprs): Call building_stmt_list_p
	instead of building_stmt_tree.
	(initialize_local_var): Likewise.
	(finish_function): Likewise.
	* decl2.c (finish_anon_union): Likewise.
	* init.c (begin_init_stmts): Likewise.
	(finish_init_stmts): Likewise.
	(expand_aggr_init_1): Likewise.
	* name-lookup.c (do_local_using_decl): Likewise.
	(do_namespace_alias): Likewise.
	(do_using_directive): Likewise.
	(cp_emit_debug_info_for_using): Likewise.
	* semantics.c (add_stmt): Assert that stmt_list_stack is non-empty.

From-SVN: r174343
2011-05-27 17:43:44 +00:00
Jakub Jelinek 0e0d82a784 re PR c/49120 (bogus "value computed is not used" warning (variable-length array in compound statement))
PR c/49120
	* c-decl.c (start_decl): Convert expr to void_type_node.

	* gcc.dg/pr49120.c: New test.

From-SVN: r174081
2011-05-23 20:02:03 +02:00
Joseph Myers 96703596c4 c-decl.c (c_override_global_bindings_to_false): Remove.
* c-decl.c (c_override_global_bindings_to_false): Remove.
	(global_bindings_p): Don't check
	c_override_global_bindings_to_false.
	* c-tree.h (c_override_global_bindings_to_false): Remove.
	* c-typeck.c (composite_type): Don't set
	c_override_global_bindings_to_false.

From-SVN: r173632
2011-05-10 20:12:34 +01:00
Eric Botcazou c99c002630 langhooks.h (lang_hooks_for_types): Change global_bindings_p's return type to bool and adjust comment.
2011-05-07  Eric Botcazou  <ebotcazou@adacore.com>

	* langhooks.h (lang_hooks_for_types): Change global_bindings_p's return
	type to bool and adjust comment.
	* fold-const.c (fold_range_test): Adjust call to global_bindings_p.
	(fold_mathfn_compare): Remove calls to global_bindings_p.
	(fold_inf_compare): Likewise.
	* stor-layout.c (variable_size): Adjust call to global_bindings_p.
	* c-tree.h (global_bindings_p): Adjust prototype.
	* c-decl.c (global_bindings_p): Return bool and simplify.
ada/
	* gcc-interface/gigi.h (global_bindings_p): Adjust prototype.
	* gcc-interface/utils.c (global_bindings_p): Return bool and simplify.
cp/
	* name-lookup.h (global_bindings_p): Adjust prototype.
	* name-lookup.c (global_bindings_p): Return bool.
fortran/
	* f95-lang.c (global_bindings_p): Return bool and simplify.
go/
	* go-lang.c (global_bindings_p): Return bool and simplify.
java/
	* java-tree.h (global_bindings_p): Adjust prototype.
	* decl.c (global_bindings_p): Return bool.
lto/
	* lto-lang.c (global_bindings_p): Return bool.

From-SVN: r173535
2011-05-07 19:58:29 +00:00
Eric Botcazou 907a08d9b1 tree.h (get_pending_sizes): Remove prototype.
* tree.h (get_pending_sizes): Remove prototype.
	(put_pending_size): Likewise.
	(put_pending_sizes): Likewise.
	* stor-layout.c (pending_sizes): Delete.
	(get_pending_sizes): Likewise.
	(put_pending_size): Likewise.
	(put_pending_sizes): Likewise.
	(variable_size): Do not call put_pending_size and tidy up.
	* function.h (struct function): Remove dont_save_pending_sizes_p.
	* lto-streamer-in.c (input_function): Do not stream it.
	* lto-streamer-out.c (output_function): Likewise.
	* tree-inline.c (initialize_cfun): Do not copy it.
	* c-decl.c (store_parm_decls): Do not set it.
	* omp-low.c (create_task_copyfn): Likewise.
	* tree-optimize.c (tree_rest_of_compilation): Likewise.
cp/
	* decl.c (start_preparsed_function): Likewise.
fortran/
	* trans-decl.c (trans_function_start): Likewise.
ada/
	* gcc-interface/utils.c (begin_subprog_body): Do not call
	get_pending_sizes.
	(end_subprog_body): Likewise.

From-SVN: r173424
2011-05-05 11:49:05 +00:00
Joseph Myers a04a722b88 c-decl.c (finish_decl): Don't call get_pending_sizes.
* c-decl.c (finish_decl): Don't call get_pending_sizes.
	(grokparm): Add parameter expr.  Pass it to grokdeclarator.
	(push_parm_decl): Add parameter expr.  Pass it to grokdeclarator.
	(c_variable_size): Remove.
	(grokdeclarator): Use save_expr instead of c_variable_size.  Don't
	call put_pending_sizes.
	(get_parm_info): Add parameter expr.  Use it to set
	arg_info->pending_sizes.
	(store_parm_decls): Use arg_info->pending_sizes instead or calling
	get_pending_sizes.
	* c-parser.c (c_parser_parms_declarator): Update call to
	c_parser_parms_list_declarator.
	(c_parser_parms_list_declarator): Take parameter expr.  Update
	call to push_parm_decl.  Update recursive call.  Don't call
	get_pending_sizes.  Update calls to get_parm_info.
	(c_parser_objc_method_definition): Update calls to
	c_parser_objc_method_decl and objc_start_method_definition.
	(c_parser_objc_methodproto): Update call to
	c_parser_objc_method_decl.
	(c_parser_objc_method_decl): Add parameter expr.  Update call to
	grokparm.
	(c_parser_objc_try_catch_finally_statement): Update call to
	grokparm.
	* c-tree.h (struct c_arg_info.pending_sizes): Change to a tree.
	(get_parm_info, grokparm, push_parm_decl): Update prototypes.

c-family:
	* c-objc.h (objc_start_method_definition): Update prototype.
	* stub-objc.c (objc_start_method_definition): Add extra parameter.

cp:
	* parser.c (cp_parser_objc_method_definition_list): Update call to
	objc_start_method_definition.

objc:
	* objc-act.c (objc_start_method_definition): Add parameter expr.
	Update call to start_method_def.
	(objc_generate_cxx_ctor_or_dtor, objc_synthesize_getter,
	objc_synthesize_setter) Update calls to
	objc_start_method_definition.
	(objc_get_parm_info): Add parameter expr.  Update call to
	get_parm_info.
	(start_method_def): Add parameter expr.  Update call to
	objc_get_parm_info.
	* objc-gnu-runtime-abi-01.c (build_module_initializer_routine):
	Update call to objc_get_parm_info.
	* objc-runtime-shared-support.h (objc_get_parm_info): Add extra
	parameter.

From-SVN: r173422
2011-05-05 11:20:31 +01:00
Richard Guenther c62c040f16 c-decl.c (check_bitfield_type_and_width): Do not pass NULL to build_int_cst.
2011-05-04  Richard Guenther  <rguenther@suse.de>

	* c-decl.c (check_bitfield_type_and_width): Do not pass NULL
	to build_int_cst.
	* c-typeck.c (really_start_incremental_init): Use bitsize_int
	for constructor indices.
	(push_init_level): Likewise.

	c-family/
	* c-common.c (fix_string_type): Use size_int for index type bounds.
	(start_fname_decls): Do not pass NULL to build_int_cst.
	(c_init_attributes): Likewise.
	* c-lex.c (c_lex_with_flags): Likewise.

From-SVN: r173378
2011-05-04 14:56:14 +00:00
Richard Guenther 60a45536f1 c-decl.c (grokdeclarator): Instead of looking at TREE_OVERFLOW check if the constant fits in the index type.
2011-05-03  Richard Guenther  <rguenther@suse.de>

	* c-decl.c (grokdeclarator): Instead of looking at
	TREE_OVERFLOW check if the constant fits in the index type.

	* gcc.dg/large-size-array-5.c: New testcase.

From-SVN: r173297
2011-05-03 08:48:00 +00:00
Lawrence Crowl 575bfb0052 Upgrade the utility of timevars.
Index: gcc/ChangeLog

2011-04-27  Lawrence Crowl  <crowl@google.com>

	* timevar.h (timevar_cond_start): Remove unused POP_TIMEVAR_AND_RETURN.
	(timevar_cond_start): New for starting a timer only when it is not
	already running.
	(timevar_cond_stop): New for stopping a timer when it was not already
	running.

	* timevar.c (timevar_stop): Enable start/stop timers to start again.
	(timevar_cond_start): New as above.
	(timevar_cond_stop): New as above.

	* timevar.def: Add start/stop timers for compiler phases,
	TV_PHASE_SETUP, TV_PHASE_PARSING, TV_PHASE_DEFERRED, TV_PHASE_CGRAPH,
	TV_PHASE_DBGINFO (C), TV_PHASE_CHECK_DBGINFO (C++), TV_PHASE_GENERATE,
	and TV_PHASE_FINALIZE.
	Change push/pop timer TV_PARSE to TV_PARSE_GLOBAL.
	Add push/pop timers TV_PARSE_STRUCT, TV_PARSE_ENUM, TV_PARSE_FUNC,
	TV_PARSE_INLINE, TV_PARSE_INMETH, TV_TEMPLATE_INST.
	Change push/pop timer TV_NAME_LOOKUP into a start/stop timer.
	Make unused TV_OVERLOAD into a start/stop timer.

	Remove unused timers TV_OVERLOAD, TV_TEMPLATE_INSTANTIATION.
	Mark the strings for TV_NAME_LOOKUP and TV_OVERLOAD with a "|"
	to indicate that they are start/stop timers.

	* toplev.c (compile_file): Change TV_PARSE to TV_PARSE_GLOBAL.
	Add start/stop timers TV_PHASE_PARSING and TV_PHASE_GENERATE.
	Move initialization to do_compile.
	(do_compile): Add initialization from above.
	Add start/stop timers TV_PHASE_SETUP and TV_PHASE_FINALIZE.

	* c-decl.c (c_write_global_declarations): Add start/stop of
	TV_PHASE_DEFERRED, TV_PHASE_CGRAPH, TV_PHASE_DBGINFO.

	* c-parser.c (c_parser_declaration_or_fndef): Push/pop TV_PARSE_FUNC
	or TV_PARSE_INLINE, as appropriate.
	(c_parser_enum_specifier): Push/pop TV_PARSE_ENUM.
	(c_parser_struct_or_union_specifier): Push/pop TV_PARSE_STRUCT.

Index: gcc/cp/ChangeLog

2011-04-27  Lawrence Crowl  <crowl@google.com>

	* decl.c: (push_local_name): Change TV_NAME_LOOKUP to start/stop.
	(poplevel): Refactor POP_TIMEVAR_AND_RETURN to plain code.
	Change TV_NAME_LOOKUP to start/stop.
	(define_label): Refactor timevar calls out to a wrapper function.
	Change TV_NAME_LOOKUP to start/stop.
	(xref_tag): Likewise.
	(lookup_label): Refactor timevar calls out to a wrapper function.
	Change TV_NAME_LOOKUP to start_cond/stop_cond.

        * pt.c: (instantiate_class_template): Add a wrapper to push/pop new
	TV_TEMPLATE_INST.
	(instantiate_template): Add a wrapper to push/pop new TV_TEMPLATE_INST.
	(lookup_template_class): Refactor timevar calls out to a wrapper
	function.  Change use of TV_NAME_LOOKUP to TV_TEMPLATE_INST.
	(instantiate_decl): Change TV_PARSE to TV_TEMPLATE_INST.

	* name-lookup.c: (store_bindings): Change TV_NAME_LOOKUP to start/stop.
	(poplevel_class): Change TV_NAME_LOOKUP to start_cond/stop_cond.
	(push_namespace): Likewise.
	(pop_nested_namespace): Likewise.
	(pushdecl_namespace_level): Likewise.
	(store_class_bindings): Likewise.
	(push_to_top_level): Likewise.
	(identifier_type_value): Refactor timevar calls out to a wrapper
	function.  Change TV_NAME_LOOKUP to start/stop.
	(find_binding): Likewise.
	(push_using_decl): Likewise.
	(lookup_arg_dependent): Likewise.
	(push_using_directive): Likewise.
	(qualified_lookup_using_namespace): Refactor POP_TIMEVAR_AND_RETURN
	to plain code.  Change TV_NAME_LOOKUP to start/stop.
	(lookup_type_current_level): Likewise.  Refactor inner return to
	break.
	(pushdecl_class_level): Refactor POP_TIMEVAR_AND_RETURN to plain
	code.  Change TV_NAME_LOOKUP to start_cond/stop_cond.
	(pushdecl_top_level_1): Likewise.
	(lookup_using_namespace): Likewise.
	(pushdecl_with_scope): Refactor timevar calls out to a wrapper
	function.  Change TV_NAME_LOOKUP to start_cond/stop_cond.
	(push_overloaded_decl): Likewise.
	(push_class_level_binding): Likewise.
	(namespace_binding): Likewise.
	(set_namespace_binding): Likewise.
	(supplement_binding): Likewise.
	(unqualified_namespace_lookup): Likewise.
	(lookup_name_real): Likewise.
	(lookup_type_scope): Likewise.
	(namespace_ancestor): Likewise.
	(lookup_name_innermost_nonclass_level): Likewise.
	(pushtag): Likewise.
	(pop_from_top_level): Likewise.
	(pushdecl_maybe_friend): Refactor timevar calls out to a wrapper
	function.  Change TV_NAME_LOOKUP to start_cond/stop_cond.  Wrap long
	lines.
	(add_using_namespace): Refactor timevar calls out to a wrapper
	function.  Change TV_NAME_LOOKUP to start_cond/stop_cond.  Bypass
	wrapper on call to self.

	* decl2.c: (cp_write_global_declarations):  Add start/stop of
	new TV_PHASE_DEFERRED, TV_PHASE_CGRAPH, TV_PHASE_CHECK_DBGINFO.
	Remove push/pop calls to TV_VARCONST.

	* parser.c: Add include of "timevar.h".
	(cp_parser_explicit_instantiation): Add push/pop calls to
	TV_TEMPLATE_INST.
	(cp_parser_enum_specifier): Add push/pop calls to new TV_PARSE_ENUM.
	(cp_parser_class_specifier): Add wrapper to add push/pop calls to
	TV_PARSE_STRUCT.
	(cp_parser_function_definition_from_specifiers_and_declarator): Add
	push/pop calls to new TV_PARSE_FUNC or TV_PARSE_INLINE.
	(cp_parser_late_parsing_for_member):  Add push/pop calls to
	new TV_PARSE_INMETH.

	* call.c: Add include of "timevar.h".
        (convert_class_to_reference): Wrap and add push/pop calls to 
	TV_OVERLOAD.
	(build_op_call): Likewise.
	(build_conditional_expr): Likewise.
	(build_new_op): Likewise.
	(build_new_method_call): Likewise.
        (build_user_type_conversion): Reorganize to single return and add
	push/pop calls to TV_OVERLOAD.
        (perform_overload_resolution): Likewise.

	* Make-lang.in: Add dependence of call.o and parser.o on $(TIMEVAR_H).

From-SVN: r173277
2011-05-02 22:19:48 +00:00
Simon Martin 2609a0ce53 re PR c/35445 (ICE with conflicting declarations)
gcc/

2011-05-02  Simon Martin  <simartin@users.sourceforge.net>

    PR c/35445
    * c-decl.c (finish_decl): Only create a composite if the types are
    compatible.

gcc/testsuite/

2011-05-02  Simon Martin  <simartin@users.sourceforge.net>

    PR c/35445
    * gcc.dg/pr35445.c: New test.

From-SVN: r173269
2011-05-02 20:13:08 +00:00
Nicola Pero 0dc33c3c14 In gcc/c-family/: 2011-04-15 Nicola Pero <nicola.pero@meta-innovation.com>
In gcc/c-family/:
2011-04-15  Nicola Pero  <nicola.pero@meta-innovation.com>

	* c-objc.h (objc_get_interface_ivars): Removed.
	(objc_detect_field_duplicates): New.	
	* stub-objc.c: Likewise.
	
In gcc/:
2011-04-15  Nicola Pero  <nicola.pero@meta-innovation.com>

	* c-decl.c (detect_field_duplicates): Call
	objc_detect_field_duplicates instead of objc_get_interface_ivars.

In gcc/objc/:
2011-04-15  Nicola Pero  <nicola.pero@meta-innovation.com>

	* objc-act.c (objc_get_interface_ivars): Removed.
	(objc_detect_field_duplicates): New.
	(hash_instance_variable): New.
	(eq_instance_variable): New.
	
In gcc/objcp/:
2011-04-15  Nicola Pero  <nicola.pero@meta-innovation.com>

	* objcp-decl.c (objcp_finish_struct): Use
	objc_detect_field_duplicates instead of having a local
	implementation.

In gcc/testsuite/:
2011-04-15  Nicola Pero  <nicola.pero@meta-innovation.com>

	* objc.dg/naming-4.m: Updated.
	* objc.dg/naming-5.m: Updated.	
	* objc.dg/naming-6.m: New.
	* objc.dg/naming-7.m: New.	
	* obj-c++.dg/naming-1.mm: Updated.
	* obj-c++.dg/naming-2.mm: Updated.
	* obj-c++.dg/naming-3.mm: New.
	* obj-c++.dg/naming-4.mm: New.

From-SVN: r172511
2011-04-15 18:15:35 +00:00
Nathan Froyd 81f653d624 ada-tree.h (union lang_tree_node): Check for TS_COMMON before calling TREE_CHAIN.
gcc/ada/
	* gcc-interface/ada-tree.h (union lang_tree_node): Check for
	TS_COMMON before calling TREE_CHAIN.
	* gcc-interface/misc.c (gnat_init_ts): New function.
	(LANG_HOOKS_INIT_TS): Define.

gcc/
	* c-decl.c (union lang_tree_node): Check for TS_COMMON before
	calling TREE_CHAIN.
	* print-tree.c (print_node): Likewise.
	* tree-inline.c (copy_tree_r): Likewise.
	* c-lang.c (LANG_HOOKS_INIT_TS): Define.
	* lto-streamer-in.c (lto_input_tree_pointers): Check for TS_TYPED
	instead of TS_COMMON.
	* lto-streamer-out.c (lto_output_tree_pointers): Likewise.
	* tree.c (initialize_tree_contains_struct): Handle TS_TYPED.
	(copy_node_stat): Zero TREE_CHAIN only if necessary.
	(MARK_TS_BASE, MARK_TS_TYPED, MARK_TS_COMMON): Move these...
	(MARK_TS_DECL_COMMON, MARK_TS_DECL_COMMON, MARK_TS_DECL_WRTL):
	...and these...
	(MARK_TS_DECL_WITH_VIS, MARK_TS_DECL_NON_COMMON): ...and these...
	* tree.h: ...here.
	(TREE_CHAIN): Check for a TS_COMMON structure.
	(TREE_TYPE): Check for a TS_TYPED structure.

gcc/c-family/
	* c-common.h (c_common_init_ts): Declare.
	* c-common.c (c_common_init_ts): Define.

gcc/cp/
	* cp-lang.c (cp_init_ts): Call cp_common_init_ts.  Move
	tree_contains_struct initialization to...
	* cp-objcp-common.c (cp_common_init_ts): ...here.  Use MARK_*
	macros.
	* cp-objcp-common.h (cp_common_init_ts): Declare.
	* cp-tree.h (union lang_tree_node): Check for TS_COMMON before
	calling TREE_CHAIN.

gcc/fortran/
	* f95-lang.c (union lang_tree_node): Check for TS_COMMON before
	calling TREE_CHAIN.

gcc/go/
	* go-lang.c (union lang_tree_node): Check for TS_COMMON before
	calling TREE_CHAIN.

gcc/java/
	* java-tree.h (union lang_tree_node): Check for TS_COMMON before
	calling TREE_CHAIN.

gcc/lto/
	* lto-tree.h (union lang_tree_node): Check for TS_COMMON before
	calling TREE_CHAIN.
	* lto.c (lto_fixup_common): Likewise.

gcc/objc/
	* objc-lang.c (objc_init_ts): Move code for this function...
	* objc-act.c (objc_common_init_ts): ...here. Define.
	* objc-act.h (objc_common_init_ts): Declare.

gcc/objcp/
	* objcp-lang.c (objcxx_init_ts): Call objc_common_init_ts and
	cp_common_init_ts.

From-SVN: r172359
2011-04-13 03:09:53 +00:00
Martin Jambor a358e18845 cgraph.h (cgraph_node): Remove function declaration.
2011-04-12  Martin Jambor  <mjambor@suse.cz>

	* cgraph.h (cgraph_node): Remove function declaration.
	(cgraph_create_node): Declare.
	(cgraph_get_create_node): Likewise.
	* cgraph.c (cgraph_create_node): Renamed to cgraph_create_node_1.
	Updated all callers.
	(cgraph_node): Renamed to cgraph_create_node, assert that a node for
	the decl does not already exist.  Call cgraph_get_create_node instead
	of cgraph_node.
	(cgraph_get_create_node): New function.
	(cgraph_same_body_alias): Update comment.
	(cgraph_set_call_stmt): Call cgraph_get_node instead of cgraph_node,
	assert it does not return NULL.
	(cgraph_update_edges_for_call_stmt): Likewise.
	(cgraph_clone_edge): Likewise.
	(cgraph_create_virtual_clone): Likewise.
	(cgraph_update_edges_for_call_stmt_node): Call cgraph_get_create_node
	instead of cgraph_node.
	(cgraph_add_new_function): Call cgraph_create_node or
	cgraph_get_create_node instead of cgraph_node.
	* cgraphbuild.c (record_reference): Call cgraph_get_create_node
	instead of cgraph_node.
	(record_eh_tables): Likewise.
	(mark_address): Likewise.
	(mark_load): Likewise.
	(build_cgraph_edges): Call cgraph_get_create_node instead
	of cgraph_node.
	(rebuild_cgraph_edges): Likewise.
	* cgraphunit.c (cgraph_finalize_function): Call cgraph_get_create_node
	instead of cgraph_node.
	(cgraph_copy_node_for_versioning): Call cgraph_create_node instead of
	cgraph_node.
	* lto-symtab.c (lto_symtab_merge_cgraph_nodes_1): Call
	cgraph_create_node instead of cgraph_node.
	* c-decl.c (finish_function): Call cgraph_get_create_node instead
	of cgraph_node.
	* lto-cgraph.c (input_node): Likewise.
	* lto-streamer-in.c (input_function): Likewise.
	* varasm.c (mark_decl_referenced): Likewise.
	(assemble_alias): Likewise.

gcc/c-family/
	* c-gimplify.c (c_genericize): Call cgraph_get_create_node instead
	of cgraph_node.

gcc/cp/
	* cp/class.c (cp_fold_obj_type_ref): Call cgraph_get_create_node
	instead of cgraph_node.
	* cp/decl2.c (cxx_callgraph_analyze_expr): Likewise.
	(cp_write_global_declarations): Likewise.
	* cp/optimize.c (maybe_clone_body): Likewise.
	* cp/semantics.c (maybe_add_lambda_conv_op): Likewise.
	* cp/mangle.c (mangle_decl): Likewise.
	* cp/method.c (make_alias_for_thunk): Likewise.
	(use_thunk): Likewise.

gcc/ada/
	* gcc-interface/utils.c (end_subprog_body): Call
	cgraph_get_create_node instead of cgraph_node.

gcc/fortran/
	* trans-decl.c (gfc_generate_function_code): Call
	cgraph_get_create_node instead of cgraph_node.

gcc/objc/
	* objc-act.c (mark_referenced_methods): Call cgraph_get_create_node
	instead of cgraph_node.

From-SVN: r172307
2011-04-12 11:27:18 +02:00
Gary Funck 636b4106f6 c-decl.c (grokdeclarator): Fix formatting.
2011-04-01  Gary Funck <gary@intrepid.com>

	* c-decl.c (grokdeclarator): Fix formatting.

From-SVN: r171831
2011-04-01 14:07:52 +00:00
Richard Guenther 411cdbd841 re PR c/47939 (Missing DW_TAG_typedef for qualified types)
2011-03-21  Richard Guenther  <rguenther@suse.de>

	PR c/47939
	* c-decl.c (grokdeclarator): Drop to the main variant only
	for array types.  Drop flag_gen_aux_info check.

	* gcc.dg/debug/dwarf2/pr47939-1.c: New testcase.
	* gcc.dg/debug/dwarf2/pr47939-2.c: Likewise.
	* gcc.dg/debug/dwarf2/pr47939-3.c: Likewise.
	* gcc.dg/debug/dwarf2/pr47939-4.c: Likewise.

From-SVN: r171245
2011-03-21 15:32:21 +00:00
Joseph Myers 8bf872f9e8 c-decl.c (diagnose_mismatched_decls): Give an error for redefining a typedef with variably modified type.
* c-decl.c (diagnose_mismatched_decls): Give an error for
	redefining a typedef with variably modified type.

testsuite:
	* gcc.dg/c1x-typedef-1.c: Expect errors for redefinitions of
	variably modified typedefs.
	* gcc.dg/c1x-typedef-2.c: Remove.

From-SVN: r171172
2011-03-18 23:26:16 +00:00
Joseph Myers ff8e215992 c-decl.c (grokfield): Don't allow typedefs for structures or unions with no tag by default.
* c-decl.c (grokfield): Don't allow typedefs for structures or
	unions with no tag by default.
	* doc/extend.texi (Unnamed Fields): Update.

testsuite:
	* gcc.dg/c1x-anon-struct-1.c: Don't test use of typedefs.
	* gcc.dg/c1x-anon-struct-3.c: New test.
	* gcc.dg/anon-struct-11.c: Update.

From-SVN: r171170
2011-03-18 21:16:31 +00:00
Ian Lance Taylor 744f0946bc re PR tree-optimization/26854 (Inordinate compile times on large routines)
PR tree-optimization/26854
	* c-decl.c (struct c_scope): Add field has_jump_unsafe_decl.
	(decl_jump_unsafe): Move higher in file, with no other change.
	(bind): Set has_jump_unsafe_decl if appropriate.
	(update_label_decls): Test has_jump_unsafe_decl to avoid loop.
	(check_earlier_gotos): Likewise.
	(c_check_switch_jump_warnings): Likewise.

From-SVN: r169267
2011-01-26 01:26:48 +00:00
Joseph Myers b3c1008c10 re PR c/46889 (Missing diagnosis on duplicate struct member with anonymous union)
PR c/46889
	* c-decl.c (detect_field_duplicates): Ensure hash is used for
	finding duplicates when first field is anonymous.

testsuite:
	* gcc.dg/anon-struct-15.c: New test.

From-SVN: r168348
2010-12-30 18:24:03 +00:00
Nathan Froyd f4da8dce7a c-aux-info.c (gen_formal_list_for_type): Use prototype_p.
gcc/
	* c-aux-info.c (gen_formal_list_for_type): Use prototype_p.
	* c-decl.c (diagnose_arglist_conflict): Likewise.
	(diagnose_mismatched_decls, merge_decls): Likewise.
	(c_builtin_function, c_builtin_function_ext_scope): Likewise.
	(start_decl, start_function): Likewise.
	* c-tree.h (C_DECL_ISNT_PROTOTYPED): Likewise.
	* config/ia64/ia64.h (INIT_CUMULATIVE_ARGS): Likewise.
	* config/mep/mep.c (mep_validate_interrupt): Likewise.
	* config/pa/pa.h (INIT_CUMULATIVE_ARGS): Likewise.
	* config/rs6000/rs6000.c (init_cumulative_args): Likewise.
	* config/sh/sh.c (sh_init_cumulative_args): Likewise.
	* config/sparc/sparc.c (init_cumulative_args): Likewise.
	* dwarf2out.c (add_prototyped_attribute): Likewise.
	(gen_subprogram_die): Likewise.
	* ipa-type-escape.c (check_function_parameter_and_return_types):
	Likewise.
	(check_call): Likewise.
	* tree-ssa.c (useless_type_conversion_p): Likewise.

gcc/ada/
	* gcc-interface/utils.c (handle_nonnull_attribute): Use prototype_p.
	(handle_sentinel_attribute): Likewise.

gcc/c-family/
	* c-common.c (handle_nonnull_attribute, handle_sentinel_attribute):
	Use prototype_p.

gcc/cp/
	* decl.c (decls_match, duplicate_decls): Use prototype_p.
	* pt.c (push_template_decl_real): Likewise.

gcc/lto/
	* lto-lang.c (handle_nonnull_attribute, handle_sentinel_attribute):
	Use prototype_p.

gcc/objc/
	* objc-act.c (next_sjlj_build_enter_and_setjmp): Use prototype_p.

From-SVN: r168181
2010-12-22 19:45:58 +00:00
Paolo Bonzini 29ce73cb95 re PR c/20385 (Lame parse error message for undefined type)
gcc:
2010-12-17  Paolo Bonzini  <bonzini@gnu.org>

	PR c/20385
	* function.c (used_types_insert): Handle ERROR_MARK.
	* c-decl.c (grokdeclarator): Handle ERROR_MARK.
	(declspecs_add_type): Leave error_mark_node in specs->type.
	(finish_declspecs): Change it to integer_type_node here.
	* c-parser.c (c_parser_peek_2nd_token): Move earlier.
	(enum c_lookahead_kind): New.
	(c_parser_next_token_starts_typename): New name of
	c_parser_next_tokens_start_typename.  Accept lookahead enum
	and handle it here instead of...
	(c_parser_next_tokens_start_declaration): ... here.  Call it.
	(c_parser_declspecs): Accept another argument.  Do not exit
	on C_ID_ID if it is guessed to be an unknown typename.
	(c_parser_parms_declarator): Use 2nd token to distinguish a K&R
	declaration from an ANSI declaration starting with an unknown
	typename.
	(c_parser_struct_declaration, c_parser_objc_type_name,
	c_parser_typeof_specifier, c_parser_declarator,
	c_parser_direct_declarator_inner): Adjust calls.
	(c_parser_parameter_declaration): Likewise.
	(c_parser_type_name): Pass back an error_mark_node to the caller.
	(c_parser_postfix_expression): Do error recovery when 
	c_parser_type_name returns NULL.

testsuite:
2010-12-17  Paolo Bonzini  <bonzini@gnu.org>

	PR c/20385
	* objc.dg/tls/init-2.m: Adjust.
	* gcc.dg/noncompile/920923-1.c: Adjust.
	* gcc.dg/noncompile/pr44517.c: Adjust.
	* gcc.dg/declspec-18.c: New test.

From-SVN: r167999
2010-12-17 21:23:36 +00:00
Nicola Pero 61d3ce2026 In gcc/: 2010-12-06 Nicola Pero <nicola.pero@meta-innovation.com>
In gcc/:
2010-12-06  Nicola Pero  <nicola.pero@meta-innovation.com>

	* c-family/c-common.h: Removed the declarations of all the objc_
	callbacks, and moved them into c-objc.h.  Removed
	objc_ivar_visibility_kind and moved it into c-objc.h.
	* c-family/c-objc.h: New file.
	* c-family/c-common.c: Include c-objc.h.
	* c-family/c-format.c: Same change.
	* c-family/stub-objc.c: Same change.
	* c-decl.c: Include c-family/c-objc.h.
	* c-parser.c: Same change.	
	* c-typeck.c: Same change.
	* c-config-lang.in (gtfiles): Added c-family/c-objc.h.
	* Makefile.in (c-decl.o): Depend on c-family/c-objc.h.
	(c-parser.o): same change.
	(c-typeck.o): Same change.
	(c-family/c-format.o): Same change.
	(c-family/stub-objc.o): Same change.
	(c-family/c-common.o): Same change.
	(PLUGIN_HEADERS): Added c-family/c-objc.h.
	
In gcc/cp/:
2010-12-06  Nicola Pero  <nicola.pero@meta-innovation.com>

	* call.c: Include c-family/c-objc.h.
	* decl.c: Same change.
	* decl2.c: Same change.
	* error.c: Same change.
	* lex.c: Same change.
	* parser.c: Same change.
	* pt.c: Same change.
	* semantics.c: Same change.
	* typeck.c: Same change.
	* Make-lang.in (cp/decl.o): Depend on c-family/c-objc.h.
	(cp/decl2.o): Same change.
	(cp/call.o): Same change.
	(cp/error.o): Same change.
	(cp/lex.o): Same change.
	(cp/parser.o): Same change.
	(cp/pt.o): Same change.
	(cp/semantics.o): Same change.
	(cp/typeck.o): Same change.
	* config-lang.in (gtfiles): Added c-family/c-objc.h.
	
In gcc/objc/:
2010-12-06  Nicola Pero  <nicola.pero@meta-innovation.com>

	* objc-act.c: Include c-family/c-objc.h.
	* objc-lang.c: Same change.
	* Make-lang.in (objc/objc-act.o): Depend on
	c-family/c-objc.h.
	(objc/objc-lang.o): Same change.
	* config-lang.in (gtfiles): Added c-family/c-objc.h.
	
In gcc/objcp/:
2010-12-06  Nicola Pero  <nicola.pero@meta-innovation.com>

	* config-lang.in (gtfiles): Added c-family/c-objc.h.
	* Make-lang.in (objcp/objcp-act.o): Depend on
	c-family/c-objc.h.
	(objcp/objcp-lang.o): Same change.
	(objcp/objcp-decl.o): Same change.
	* objcp-lang.c: Include c-family/c-objc.h.
	* objcp-decl.c: Same change.

From-SVN: r167481
2010-12-06 00:56:06 +00:00
Nathan Froyd aa3ef09bf5 re PR c/45062 (Revision 162223 caused ICE at c-decl.c:4064)
PR c/45062
	* c-decl.c (grokparms): Set arg_info->parms to NULL_TREE when
	!funcdef_flag.

From-SVN: r167381
2010-12-02 18:00:21 +00:00
Nicola Pero 6c39e757f6 In gcc/c-family/: 2010-11-30 Nicola Pero <nicola.pero@meta-innovation.com>
In gcc/c-family/:
2010-11-30  Nicola Pero  <nicola.pero@meta-innovation.com>

	* c-common.h (objc_finish_function): New.
	(objc_non_volatilized_type): Removed.
	(objc_type_quals_match): Removed.
	* stub-objc.c (objc_finish_function): New.
	(objc_non_volatilized_type): Removed.
	(objc_type_quals_match): Removed.
	
In gcc/objc/:
2010-11-30  Nicola Pero  <nicola.pero@meta-innovation.com>

	* objc-act.c (objc_build_volatilized_type): Removed.
	(objc_non_volatilized_type): Removed.
	(objc_type_quals_match): Removed.
	(local_variables_to_volatilize): New.
	(objc_volatilize_decl): Add the decl to volatilize to
	local_variables_to_volatilize, but don't volatilize it yet.
	(objc_finish_function): New.
	* objc-act.h (local_variables_to_volatilize): New.

In gcc/cp/:
2010-11-30  Nicola Pero  <nicola.pero@meta-innovation.com>

	* decl.c (finish_function): Call objc_finish_function when
	compiling Objective-C++.
	* call.c (standard_conversion): Do not call
	objc_non_volatilized_type().
	(implicit_conversion): Same change.
	* typeck.c (comp_ptr_ttypes_real): Same change.

In gcc/:
2010-11-30  Nicola Pero  <nicola.pero@meta-innovation.com>

	* c-decl.c (finish_function): Call objc_finish_function in
	Objective-C.
	* c-typeck.c (convert_for_assignment): Do not call
	objc_type_quals_match().

From-SVN: r167318
2010-11-30 21:55:39 +00:00
Paolo Bonzini a5812bdc55 re PR c/46462 (Revision 166700 caused new C test failures)
2010-11-13  Paolo Bonzini  <bonzini@gnu.org>

	PR c/46462
	* c-decl.c (declspecs_add_type): Make variables with error types
	integers.
	* c-parser.c (c_parser_next_tokens_start_declaration): Two IDs
	do not start a declaration before an Objective-C foreach.
	(c_parser_declaration_or_fndef): Improve recovery after unknown
	type name.
	(c_parser_for_statement): Hoist entrance of "foreach context"
	before ifs, add corresponding reset where it was missing.  Do
	not set objc_could_be_foreach_context for C.

From-SVN: r166732
2010-11-14 13:10:41 +00:00
Paolo Bonzini 9e5b211566 c-tree.h (enum c_typespec_kind): Add ctsk_none.
2010-11-13  Paolo Bonzini  <bonzini@gnu.org>

	* c-tree.h (enum c_typespec_kind): Add ctsk_none.
	(struct c_declspecs): Replace tagdef_seen_p and type_seen_p
	with typespec_kind.
	* c-decl.c (build_null_declspecs): Initialize typespec_kind.
	(shadow_tag_warned, check_compound_literal_type): Adjust
	uses of tag_defined_p.
	(declspecs_add_type): Set typespec_kind.
	* c-parser.c (c_parser_declaration_or_fndef,
	c_parser_declspecs, c_parser_struct_declaration,
	c_parser_parameter_declaration, c_parser_type_name,
	c_parser_objc_diagnose_bad_element_prefix): Adjust uses
	of type_seen_p.
	* c-typeck.c (c_cast_expr): Use typespec_kind instead of
	tag_defined_p, pass ctsk_firstref through.

testsuite:
2010-11-13  Paolo Bonzini  <bonzini@gnu.org>

	* gcc.dg/Wcxx-compat-8.c: Add testcases involving incomplete types.

From-SVN: r166699
2010-11-13 09:52:00 +00:00
Simon Martin c58e98c83b re PR c/43384 (ICE: Segmentation fault with invalid K&R-like code)
gcc/

2010-11-16  Simon Martin  <simartin@users.sourceforge.net>

	PR c/43384
	* c-decl.c (lookup_label): Labels can only be referenced in a
	function's scope. 
	(store_parm_decls_oldstyle): Skip erroneous parameters.

gcc/testsuite/
 
2010-11-16  Simon Martin  <simartin@users.sourceforge.net>

	PR c/43384
	* gcc.dg/parser-error-3.c: New test.

From-SVN: r166408
2010-11-06 21:58:50 +00:00
Jakub Jelinek a75de69230 re PR c/44772 (-Wc++-compat warns incorrectly for anonymous unions)
PR c/44772
	* c-decl.c (warn_cxx_compat_finish_struct): Don't call
	pointer_set_contains if DECL_NAME is NULL.

	* gcc.dg/Wcxx-compat-21.c: New test.

From-SVN: r166384
2010-11-06 01:07:50 +01:00