From 5fb6a9126a7c9e63e0330e2e089f5a6c664335a9 Mon Sep 17 00:00:00 2001 From: manu Date: Tue, 7 Jul 2009 02:10:19 +0000 Subject: =?UTF-8?q?2009-07-07=20=20Manuel=20L=C3=B3pez-Ib=C3=A1=C3=B1ez=20?= =?UTF-8?q?=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * c-lex.c: Replace %H by an explicit location. Update all calls. * c-common.c: Likewise. * c-decl.c: Likewise. * c-typeck.c: Likewise. * fold-const.c: Likewise. * gimplify.c: Likewise. * stmt.c: Likewise. * tree-cfg.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-vrp.c: Likewise. * value-prof.c: Likewise. java/ * jcf-parse.c: Replace %H by an explicit location. Update all calls. objc/ * objc-act.c: Replace %H by an explicit location. Update all calls. testsuite/ * gcc.dg/plugin/selfassign.c: Replace %H by an explicit location. Update all calls. * g++.dg/plugin/selfassign.c: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@149310 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/c-decl.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'gcc/c-decl.c') diff --git a/gcc/c-decl.c b/gcc/c-decl.c index 9f852fff77a..fdceb20a831 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -2912,17 +2912,17 @@ undeclared_variable (location_t loc, tree id) if (current_function_decl == 0) { - error ("%H%qE undeclared here (not in a function)", &loc, id); + error_at (loc, "%qE undeclared here (not in a function)", id); scope = current_scope; } else { - error ("%H%qE undeclared (first use in this function)", &loc, id); + error_at (loc, "%qE undeclared (first use in this function)", id); if (!already) { - error ("%H(Each undeclared identifier is reported only once", &loc); - error ("%Hfor each function it appears in.)", &loc); + error_at (loc, "(Each undeclared identifier is reported only once"); + error_at (loc, "for each function it appears in.)"); already = true; } @@ -3356,8 +3356,8 @@ void pending_xref_error (void) { if (pending_invalid_xref != 0) - error ("%H%qE defined as wrong kind of tag", - &pending_invalid_xref_location, pending_invalid_xref); + error_at (pending_invalid_xref_location, "%qE defined as wrong kind of tag", + pending_invalid_xref); pending_invalid_xref = 0; } -- cgit v1.2.1 From 712d22976c2f8c0053865790f0e0674337864ab9 Mon Sep 17 00:00:00 2001 From: manu Date: Tue, 7 Jul 2009 02:55:59 +0000 Subject: =?UTF-8?q?2009-07-07=20=20Manuel=20L=C3=B3pez-Ib=C3=A1=C3=B1ez=20?= =?UTF-8?q?=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * cgraphunit.c: Replace %J by an explicit location. Update all calls. * c-decl.c: Likewise. * function.c: Likewise. * varasm.c: Likewise. * tree-ssa.c: Likewise. * c-common.c: Likewise. * tree-cfg.c: Likewise. * config/spu/spu.c: Likewise. * config/ia64/ia64.c: Likewise. * config/v850/v850.c: Likewise. java/ * class.c: Replace %J by an explicit location. Update all calls. objc/ * objc-act.c: Replace %J by an explicit location. Update all calls. cp/ * init.c: Replace %J by an explicit location. Update all calls. * decl.c: Likewise. * typeck2.c: Likewise. * pt.c: Likewise. * name-lookup.c: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@149312 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/c-decl.c | 55 ++++++++++++++++++++++++++++++------------------------- 1 file changed, 30 insertions(+), 25 deletions(-) (limited to 'gcc/c-decl.c') diff --git a/gcc/c-decl.c b/gcc/c-decl.c index fdceb20a831..fa578cb6529 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -1890,9 +1890,10 @@ diagnose_mismatched_decls (tree newdecl, tree olddecl, DECL_ATTRIBUTES (olddecl)) != NULL; if (newa != olda) { - error ("% attribute present on %q+D", - newa ? newdecl : olddecl); - error ("%Jbut not here", newa ? olddecl : newdecl); + error_at (input_location, "% attribute present on %q+D", + newa ? newdecl : olddecl); + error_at (DECL_SOURCE_LOCATION (newa ? olddecl : newdecl), + "but not here"); } } } @@ -2489,7 +2490,8 @@ warn_if_shadowing (tree new_decl) warning (OPT_Wshadow, "declaration of %q+D shadows a previous local", new_decl); - warning (OPT_Wshadow, "%Jshadowed declaration is here", old_decl); + warning_at (DECL_SOURCE_LOCATION (old_decl), OPT_Wshadow, + "shadowed declaration is here"); break; } @@ -6002,11 +6004,13 @@ grokparms (struct c_arg_info *arg_info, bool funcdef_flag) if (funcdef_flag) { if (DECL_NAME (parm)) - error ("parameter %u (%q+D) has incomplete type", - parmno, parm); + error_at (input_location, + "parameter %u (%q+D) has incomplete type", + parmno, parm); else - error ("%Jparameter %u has incomplete type", - parm, parmno); + error_at (DECL_SOURCE_LOCATION (parm), + "parameter %u has incomplete type", + parmno); TREE_VALUE (typelt) = error_mark_node; TREE_TYPE (parm) = error_mark_node; @@ -6014,11 +6018,13 @@ grokparms (struct c_arg_info *arg_info, bool funcdef_flag) else if (VOID_TYPE_P (type)) { if (DECL_NAME (parm)) - warning (0, "parameter %u (%q+D) has void type", - parmno, parm); + warning_at (input_location, 0, + "parameter %u (%q+D) has void type", + parmno, parm); else - warning (0, "%Jparameter %u has void type", - parm, parmno); + warning_at (DECL_SOURCE_LOCATION (parm), 0, + "parameter %u has void type", + parmno); } } @@ -6722,28 +6728,27 @@ finish_struct (location_t loc, tree t, tree fieldlist, tree attributes, if (TREE_CODE (t) == UNION_TYPE) { error_at (DECL_SOURCE_LOCATION (x), - "%Jflexible array member in union", x); + "flexible array member in union"); TREE_TYPE (x) = error_mark_node; } else if (TREE_CHAIN (x) != NULL_TREE) { error_at (DECL_SOURCE_LOCATION (x), - "%Jflexible array member not at end of struct", x); + "flexible array member not at end of struct"); TREE_TYPE (x) = error_mark_node; } else if (!saw_named_field) { error_at (DECL_SOURCE_LOCATION (x), - "%Jflexible array member in otherwise empty struct", - x); + "flexible array member in otherwise empty struct"); TREE_TYPE (x) = error_mark_node; } } - if (pedantic && !in_system_header && TREE_CODE (t) == RECORD_TYPE + if (pedantic && TREE_CODE (t) == RECORD_TYPE && flexible_array_type_p (TREE_TYPE (x))) - pedwarn (loc, OPT_pedantic, - "%Jinvalid use of structure with flexible array member", x); + pedwarn (DECL_SOURCE_LOCATION (x), OPT_pedantic, + "invalid use of structure with flexible array member"); if (DECL_NAME (x)) saw_named_field = 1; @@ -7465,8 +7470,9 @@ store_parm_decls_newstyle (tree fndecl, const struct c_arg_info *arg_info) if (current_scope->bindings) { - error ("%Jold-style parameter declarations in prototyped " - "function definition", fndecl); + error_at (DECL_SOURCE_LOCATION (fndecl), + "old-style parameter declarations in prototyped " + "function definition"); /* Get rid of the old-style declarations. */ pop_scope (); @@ -7478,9 +7484,8 @@ store_parm_decls_newstyle (tree fndecl, const struct c_arg_info *arg_info) its parameter list). */ else if (!in_system_header && !current_function_scope && arg_info->types != error_mark_node) - warning (OPT_Wtraditional, - "%Jtraditional C rejects ISO C style function definitions", - fndecl); + warning_at (DECL_SOURCE_LOCATION (fndecl), OPT_Wtraditional, + "traditional C rejects ISO C style function definitions"); /* Now make all the parameter declarations visible in the function body. We can bypass most of the grunt work of pushdecl. */ @@ -7496,7 +7501,7 @@ store_parm_decls_newstyle (tree fndecl, const struct c_arg_info *arg_info) warn_if_shadowing (decl); } else - error ("%Jparameter name omitted", decl); + error_at (DECL_SOURCE_LOCATION (decl), "parameter name omitted"); } /* Record the parameter list in the function declaration. */ -- cgit v1.2.1 From 389dd41bd043170e7dc7660304f14a5f16af3562 Mon Sep 17 00:00:00 2001 From: manu Date: Thu, 16 Jul 2009 22:29:52 +0000 Subject: =?UTF-8?q?2009-07-17=20=20Aldy=20Hernandez=20=20=20=09=20=20=20=20Manuel=20L=C3=B3pez-Ib=C3=A1=C3=B1ez=20=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR 40435 * tree-complex.c, tree-loop-distribution.c, tree.c, tree.h, builtins.c, fold-const.c, omp-low.c, cgraphunit.c, tree-ssa-ccp.c, tree-ssa-dom.c, gimple-low.c, expr.c, tree-ssa-ifcombine.c, c-decl.c, stor-layout.c, tree-if-conv.c, c-typeck.c, gimplify.c, calls.c, tree-sra.c, tree-mudflap.c, tree-ssa-copy.c, tree-ssa-forwprop.c, c-convert.c, c-omp.c, varasm.c, tree-inline.c, c-common.c, c-common.h, gimple.c, tree-switch-conversion.c, gimple.h, tree-cfg.c, c-parser.c, convert.c: Add location argument to fold_{unary,binary,ternary}, fold_build[123], build_call_expr, build_size_arg, build_fold_addr_expr, build_call_array, non_lvalue, size_diffop, fold_build1_initializer, fold_build2_initializer, fold_build3_initializer, fold_build_call_array, fold_build_call_array_initializer, fold_single_bit_test, omit_one_operand, omit_two_operands, invert_truthvalue, fold_truth_not_expr, build_fold_indirect_ref, fold_indirect_ref, combine_comparisons, fold_builtin_*, fold_call_expr, build_range_check, maybe_fold_offset_to_address, round_up, round_down. objc/ * objc-act.c: Add location argument to all calls to build_fold_addr_expr. testsuite/ * gcc.dg/pr36902.c: Add column info. * g++.dg/gcov/gcov-2.C: Change count for definition. cp/ * typeck.c, init.c, class.c, method.c, rtti.c, except.c, error.c, tree.c, cp-gimplify.c, cxx-pretty-print.c, pt.c, semantics.c, call.c, cvt.c, mangle.c: Add location argument to fold_{unary,binary,ternary}, fold_build[123], build_call_expr, build_size_arg, build_fold_addr_expr, build_call_array, non_lvalue, size_diffop, fold_build1_initializer, fold_build2_initializer, fold_build3_initializer, fold_build_call_array, fold_build_call_array_initializer, fold_single_bit_test, omit_one_operand, omit_two_operands, invert_truthvalue, fold_truth_not_expr, build_fold_indirect_ref, fold_indirect_ref, combine_comparisons, fold_builtin_*, fold_call_expr, build_range_check, maybe_fold_offset_to_address, round_up, round_down. fortran/ * trans-expr.c, trans-array.c, trans-openmp.c, trans-stmt.c, trans.c, trans-io.c, trans-decl.c, trans-intrinsic.c: Add location argument to fold_{unary,binary,ternary}, fold_build[123], build_call_expr, build_size_arg, build_fold_addr_expr, build_call_array, non_lvalue, size_diffop, fold_build1_initializer, fold_build2_initializer, fold_build3_initializer, fold_build_call_array, fold_build_call_array_initializer, fold_single_bit_test, omit_one_operand, omit_two_operands, invert_truthvalue, fold_truth_not_expr, build_fold_indirect_ref, fold_indirect_ref, combine_comparisons, fold_builtin_*, fold_call_expr, build_range_check, maybe_fold_offset_to_address, round_up, round_down. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@149722 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/c-decl.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'gcc/c-decl.c') diff --git a/gcc/c-decl.c b/gcc/c-decl.c index fa578cb6529..7ed646c257b 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -5224,10 +5224,10 @@ grokdeclarator (const struct c_declarator *declarator, - 1. Do the calculation in index_type, so that if it is a variable the computations will be done in the proper mode. */ - itype = fold_build2 (MINUS_EXPR, index_type, - convert (index_type, size), - convert (index_type, - size_one_node)); + itype = fold_build2_loc (loc, MINUS_EXPR, index_type, + convert (index_type, size), + convert (index_type, + size_one_node)); /* If that overflowed, the array is too big. ??? While a size of INT_MAX+1 technically shouldn't -- cgit v1.2.1 From bfec3452cfb96a7546809ee1af3fffb9eba9d658 Mon Sep 17 00:00:00 2001 From: rguenth Date: Fri, 17 Jul 2009 15:49:34 +0000 Subject: 2009-07-17 Richard Guenther PR c/40401 * tree-pass.h (pass_diagnose_omp_blocks): Declare. (pass_warn_unused_result): Likewise. (TODO_set_props): Remove. * omp-low.c (diagnose_omp_structured_block_errors): Change to run as a pass. (pass_diagnose_omp_blocks): Define. * c-decl.c (pop_file_scope): Do not finalize the CU here. (c_gimple_diagnostics_recursively): Remove. (finish_function): Do not call it. (c_write_global_declarations): Continue after errors. Finalize the CU here. * c-gimplify.c (c_genericize): Do not gimplify here. * c-common.c (c_warn_unused_result): Move ... * tree-cfg.c (do_warn_unused_result): ... here. (run_warn_unused_result): New function. (gate_warn_unused_result): New function. (pass_warn_unused_result): New pass. * c-common.h (c_warn_unused_result): Remove. * flags.h (flag_warn_unused_result): Declare. * c-opts.c (c_common_init_options): Enable flag_warn_unused_result. * opts.c (flag_warn_unused_result): Initialize to false. * toplev.c (compile_file): Add comment. * omp-low.c (create_omp_child_function): Do not register the function with the frontend. (diagnose_omp_structured_block_errors): Prepare to be called as optimization pass. (gate_diagnose_omp_blocks): New function. (pass_diagnose_omp_blocks): New pass. * cgraph.h (cgraph_optimize): Remove. (cgraph_analyze_function): Likewise. * cgraph.c (cgraph_add_new_function): Gimplify C++ thunks. * cgraphunit.c (cgraph_lower_function): Lower nested functions before their parents here. (cgraph_finalize_function): Not here. (cgraph_analyze_function): Gimplify functions here. (cgraph_finalize_compilation_unit): Continue after errors. Optimize the callgraph from here. (cgraph_optimize): Make static. * langhooks.c (write_global_declarations): Finalize the CU. * gimplify.c (gimplify_asm_expr): Do not emit ASMs with errors. (gimplify_function_tree): Assert we gimplify only once. Set PROP_gimple_any property. * tree-nested.c (gimplify_all_functions): New function. (lower_nested_functions): Gimplify all nested functions. * gimple.h (diagnose_omp_structured_block_errors): Remove. * passes.c (init_optimization_passes): Add pass_warn_unused_result and pass_diagnose_omp_blocks after gimplification. Do not set TODO_set_props on all_lowering_passes. (execute_one_pass): Do not handle TODO_set_props. * Makefile.in (cgraphunit.o): Add $(TREE_DUMP_H) dependency. (gimplify.o): Add tree-pass.h dependency. * tree-inline.c (copy_statement_list): Properly copy STATEMENT_LIST. (copy_tree_body_r): Properly handle TARGET_EXPR like SAVE_EXPR. (unsave_r): Likewise. * c-omp.c (c_finish_omp_atomic): Set DECL_CONTEXT on the temporary variable. cp/ * decl.c (finish_function): Do not emit unused result warnings from here. * cp-objcp-common.h (LANG_HOOKS_POST_GIMPLIFY_PASS): Use c_warn_unused_result_pass. * semantics.c (expand_or_defer_fn): Adjust assertion about IL status. * optimize.c (clone_body): Clone in GENERIC. (maybe_clone_body): Do not clear DECL_SAVED_TREE. * decl2.c (cp_write_global_declarations): Fix body test. Do not call cgraph_optimize. * Make-lang.in (optimize.o): Add tree-iterator.h dependency. * method.c (use_thunk): Register thunk with cgraph_finalize_function. * error.c (function_category): Guard access of DECL_LANG_SPECIFIC. java/ * java-gimplify.c (java_genericize): Do not gimplify here. But replace all local references. (java_gimplify_expr): Do not replace local references here. (java_gimplify_modify_expr): Likewise. * jcf-parse.c (java_parse_file): Do not finalize the CU or optimize the cgraph here. * decl.c (java_replace_reference): Make static. (java_replace_references): New function. (end_java_method): Clear base_decl_map. * java-tree.h (java_replace_references): Declare. (java_replace_reference): Remove. ada/ * utils.c (end_subprog_body): Revert to pre-tuples state. Remove unused parameter. (gnat_gimplify_function): Do not gimplify here. Fold into its only caller and remove. (gnat_builtin_function): Adjust for end_subprog_body signature change. (gnat_write_global_declarations): Also finalize the CU. * misc.c (gnat_parse_file): Do not finalize the CU here. * trans.c (gigi): Revert to pre-tuples state. (Subprogram_Body_to_gnu): Adjust for end_subprog_body signature change. * gigi.h (end_subprog_body): Remove unused parameter. fortran/ * f95-lang.c (gfc_be_parse_file): Do not finalize the CU here. * trans-decl.c (gfc_gimplify_function): Remove. (build_entry_thunks): Do not gimplify here. (create_main_function): Likewise. (gfc_generate_function_code): Likewise. * g++.dg/rtti/crash4.C: New testcase. * g++.dg/torture/20090706-1.C: Likewise. * gcc.dg/redecl-17.c: Likewise. * gfortran.dg/missing_optional_dummy_5.f90: Adjust pattern. * gcc.dg/declspec-9.c: Expect extra error. * gcc.dg/declspec-10.c: Likewise. * gcc.dg/declspec-11.c: Likewise. * gcc.dg/redecl-10.c: Expect extra warnings. * gcc.target/i386/pr39082-1.c: Adjust diagnostic location. * gcc.target/i386/pr39545-1.c: Likewise. * g++.dg/ext/asm3.C: Expect more errors. * g++.dg/gomp/block-1.C: Likewise. * g++.dg/gomp/block-2.C: Likewise. * g++.dg/gomp/block-3.C: Likewise. * g++.dg/gomp/block-5.C: Likewise. * g++.old-deja/g++.jason/report.C: Expect extra warnings. * g++.dg/warn/unused-result1.C: XFAIL. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@149750 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/c-decl.c | 31 ++++--------------------------- 1 file changed, 4 insertions(+), 27 deletions(-) (limited to 'gcc/c-decl.c') diff --git a/gcc/c-decl.c b/gcc/c-decl.c index 7ed646c257b..b594767d04c 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -1327,7 +1327,6 @@ pop_file_scope (void) file_scope = 0; maybe_apply_pending_pragma_weaks (); - cgraph_finalize_compilation_unit (); } /* Adjust the bindings for the start of a statement expression. */ @@ -7870,27 +7869,6 @@ store_parm_decls (void) cfun->dont_save_pending_sizes_p = 1; } -/* Emit diagnostics that require gimple input for detection. Operate on - FNDECL and all its nested functions. */ - -static void -c_gimple_diagnostics_recursively (tree fndecl) -{ - struct cgraph_node *cgn; - gimple_seq body = gimple_body (fndecl); - - /* Handle attribute((warn_unused_result)). Relies on gimple input. */ - c_warn_unused_result (body); - - /* Notice when OpenMP structured block constraints are violated. */ - if (flag_openmp) - diagnose_omp_structured_block_errors (fndecl); - - /* Finalize all nested functions now. */ - cgn = cgraph_node (fndecl); - for (cgn = cgn->nested; cgn ; cgn = cgn->next_nested) - c_gimple_diagnostics_recursively (cgn->decl); -} /* Finish up a function declaration and compile that function all the way to assembler language output. The free the storage @@ -7983,7 +7961,6 @@ finish_function (void) if (!decl_function_context (fndecl)) { c_genericize (fndecl); - c_gimple_diagnostics_recursively (fndecl); /* ??? Objc emits functions after finalizing the compilation unit. This should be cleaned up later and this conditional removed. */ @@ -9382,9 +9359,9 @@ c_write_global_declarations (void) if (pch_file) return; - /* Don't waste time on further processing if -fsyntax-only or we've - encountered errors. */ - if (flag_syntax_only || errorcount || sorrycount) + /* Don't waste time on further processing if -fsyntax-only. + Continue for warning and errors issued during lowering though. */ + if (flag_syntax_only) return; /* Close the external scope. */ @@ -9412,7 +9389,7 @@ c_write_global_declarations (void) /* We're done parsing; proceed to optimize and emit assembly. FIXME: shouldn't be the front end's responsibility to call this. */ - cgraph_optimize (); + cgraph_finalize_compilation_unit (); /* After cgraph has had a chance to emit everything that's going to be emitted, output debug information for globals. */ -- cgit v1.2.1 From 874993a5c0ad409134e3252044ce979724841ba5 Mon Sep 17 00:00:00 2001 From: rguenth Date: Thu, 20 Aug 2009 16:11:37 +0000 Subject: 2009-08-20 Richard Guenther * c-objc-common.h (LANG_HOOKS_DUP_LANG_SPECIFIC_DECL): Do not define. * c-tree.h (c_dup_lang_specific_decl): Remove. (struct lang_decl, struct lang_type): Move definitions ... * c-lang.h: ... here. New file. * c-decl.c: Include c-lang.h. (c_dup_lang_specific_decl): Remove. * c-typeck.c: Include c-lang.h. * Makefile.in (c-decl.o): Add c-lang.h dependency. (c-typeck.o): Likewise. * c-config-lang.in (gtfiles): Add c-lang.h. * gengtype.c (get_output_file_with_visibility): Handle c-lang.h like c-tree.h. objc/ * objc-act.c: Include c-lang.h * Make-lang.in (objc/objc-act.o): Add c-lang.h dependency. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@150966 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/c-decl.c | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) (limited to 'gcc/c-decl.c') diff --git a/gcc/c-decl.c b/gcc/c-decl.c index b594767d04c..9940f928ae8 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -50,6 +50,7 @@ along with GCC; see the file COPYING3. If not see #include "timevar.h" #include "c-common.h" #include "c-pragma.h" +#include "c-lang.h" #include "langhooks.h" #include "tree-mudflap.h" #include "gimple.h" @@ -8136,21 +8137,6 @@ c_pop_function_context (void) warn_about_return_type = p->warn_about_return_type; } -/* Copy the DECL_LANG_SPECIFIC data associated with DECL. */ - -void -c_dup_lang_specific_decl (tree decl) -{ - struct lang_decl *ld; - - if (!DECL_LANG_SPECIFIC (decl)) - return; - - ld = GGC_NEW (struct lang_decl); - memcpy (ld, DECL_LANG_SPECIFIC (decl), sizeof (struct lang_decl)); - DECL_LANG_SPECIFIC (decl) = ld; -} - /* The functions below are required for functionality of doing function at once processing in the C front end. Currently these functions are not called from anywhere in the C front end, but as -- cgit v1.2.1 From 038ca0d1be343465ff6791fbdba23a365eb376e0 Mon Sep 17 00:00:00 2001 From: rupp Date: Tue, 25 Aug 2009 23:19:16 +0000 Subject: * hwint.h (HOST_LONG_FORMAT): New macro * bitmap.c, c-decl.c, mips-tfile.c, print-rtl.c, print-tree.c: Use HOST_PTR_PRINTF. * system.h (HOST_PTR_PRINTF): Resurrect old macro * doc/hostconfig.texi (HOST_LONG_FORMAT): Document. (HOST_PTR_PRINTF): Document. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@151108 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/c-decl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gcc/c-decl.c') diff --git a/gcc/c-decl.c b/gcc/c-decl.c index 9940f928ae8..1bc97914f96 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -579,7 +579,7 @@ c_print_identifier (FILE *file, tree node, int indent) { tree rid = ridpointers[C_RID_CODE (node)]; indent_to (file, indent + 4); - fprintf (file, "rid %p \"%s\"", + fprintf (file, "rid " HOST_PTR_PRINTF " \"%s\"", (void *) rid, IDENTIFIER_POINTER (rid)); } } -- cgit v1.2.1 From 58d82cd04d30e16e38e5fcac6d2d120fa55d64ed Mon Sep 17 00:00:00 2001 From: rguenth Date: Sun, 13 Sep 2009 19:40:33 +0000 Subject: 2009-09-13 Richard Guenther Rafael Avila de Espindola * langhooks-def.h (LANG_HOOKS_EH_RUNTIME_TYPE): Define. (LANG_HOOKS_EH_PERSONALITY): Likewise. (LANG_HOOKS_INITIALIZER): Adjust. (lhd_pass_through_t): Declare. * langhooks.h (struct lang_hooks): Add eh_runtime_type and eh_personality. * langhooks.c (lhd_pass_through_t): New function. * dwarf2out.c (output_call_frame_info, dwarf2out_do_cfi_startproc, dwarf2out_begin_prologue): Use personality from current_function_decl. * expr.h (get_personality_function): Declare. * expr.c (get_personality_function): New function. (build_personality_function): Likewise. * libfuncs.h (libfunc_index): Remove LTI_eh_personality. (eh_personality_libfunc): Remove. * optabs.c (build_libfunc_function): New function split out from ... (init_one_libfunc): ... here. * tree.h (DECL_FUNCTION_PERSONALITY): New. (tree_function_decl): Add personality. (lhd_gcc_personality): Declare. (build_personality_function): Likewise. * tree.c (gcc_eh_personality_decl): New. (lhd_gcc_personality): New function. * except.h (lang_eh_runtime_type): Remove. (enum eh_personality_kind): New. (build_personality_function): Declare. (function_needs_eh_personality): Declare. * except.c (lang_eh_runtime_type): Remove. (function_needs_eh_personality): New function. (add_type_for_runtime): Call lang_hooks.type_for_runtime instead. (sjlj_emit_function_enter, output_function_exception_table): Use personality from current_function_decl. * tree-eh.c (lower_eh_constructs): Set DECL_FUNCTION_PERSONALITY. * tree-inline.c (tree_can_inline_p): Do not inline across different EH personalities. (expand_call_inline): Likewise. Adjust the callers EH personality. (tree_function_versioning): Copy DECL_FUNCTION_PERSONALITY. * cgraph.c (cgraph_add_new_function): Set DECL_FUNCTION_PERSONALITY. * Makefile.in (cgraph.o): Add $(EXCEPT_H) dependency. (c-parser.o): Likewise * c-tree.h (c_eh_initialized_p): Remove. (c_maybe_initialize_eh): Likewise. * c-decl.c (finish_decl): Don't call c_maybe_initialize_eh. (finish_decl): Don't call c_maybe_initialize_eh. (c_eh_initialized_p): Remove. (c_maybe_initialize_eh): Likewise. * c-parser.c (c_parser_omp_construct): Likewise. (c_parse_file): Initialize exception handling. objc/ * objc-act.c (objc_eh_runtime_type): Export. (objc_init_exceptions): Remove. Move warning code ... (objc_begin_try_stmt): ... here (objc_build_throw_stmt): ... and here. (objc_eh_personality_decl): New. (objc_eh_personality): New function. * objc-act.h (objc_eh_runtime_type): Declare. (objc_eh_personality): Likewise. * objc-lang.c (LANG_HOOKS_EH_RUNTIME_TYPE): Define. (LANG_HOOKS_EH_PERSONALITY): Likewise. cp/ * except.c (init_exception_processing): Do not set lang_eh_runtime_type. (choose_personality_routine): Do not set eh_personality_decl, set pragma_java_exceptions. * cp-lang.c (LANG_HOOKS_EH_RUNTIME_TYPE): Define. (LANG_HOOKS_EH_PERSONALITY): Likewise. (cp_eh_personality_decl): New. (cp_eh_personality): Likewise. * Make-lang.in (cp-lang.o): Add $(EXPR_H) and $(EXCEPT_H) dependencies. java/ * decl.c (do_nothing): Remove. (java_init_decl_processing): Do not set lang_eh_runtime_type. * Make-lang.in (lang.o): Add $(EXCEPT_H) dependency. * lang.c (java_eh_personality): New. (java_eh_personality_decl): Likewise. (LANG_HOOKS_EH_PERSONALITY): Define. ada/ * gcc-interface/misc.c (gnat_init_gcc_eh): Do not set lang_eh_runtime_type. (LANG_HOOKS_EH_PERSONALITY): Define. (gnat_eh_personality_decl): New. (gnat_eh_personality): Likewise. * Make-lang.in (misc.o): Add gt-ada-misc.h dependency. * config-lang.in (gtfiles): Add misc.c. fortran/ * f95-lang.c (gfc_maybe_initialize_eh): Do not init eh_personality_libfunc. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@151676 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/c-decl.c | 26 ++------------------------ 1 file changed, 2 insertions(+), 24 deletions(-) (limited to 'gcc/c-decl.c') diff --git a/gcc/c-decl.c b/gcc/c-decl.c index 1bc97914f96..ed8863dddd9 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -92,9 +92,6 @@ tree pending_invalid_xref; /* File and line to appear in the eventual error message. */ location_t pending_invalid_xref_location; -/* True means we've initialized exception handling. */ -bool c_eh_initialized_p; - /* The file and line that the prototype came from if this is an old-style definition; used for diagnostics in store_parm_decls_oldstyle. */ @@ -2365,7 +2362,8 @@ merge_decls (tree newdecl, tree olddecl, tree newtype, tree oldtype) TREE_USED (olddecl) = 1; /* Copy most of the decl-specific fields of NEWDECL into OLDDECL. - But preserve OLDDECL's DECL_UID and DECL_CONTEXT. */ + But preserve OLDDECL's DECL_UID, DECL_CONTEXT and + DECL_ARGUMENTS (if appropriate). */ { unsigned olddecl_uid = DECL_UID (olddecl); tree olddecl_context = DECL_CONTEXT (olddecl); @@ -4043,23 +4041,6 @@ start_decl (struct c_declarator *declarator, struct c_declspecs *declspecs, return tem; } -/* Initialize EH if not initialized yet and exceptions are enabled. */ - -void -c_maybe_initialize_eh (void) -{ - if (!flag_exceptions || c_eh_initialized_p) - return; - - c_eh_initialized_p = true; - eh_personality_libfunc - = init_one_libfunc (USING_SJLJ_EXCEPTIONS - ? "__gcc_personality_sj0" - : "__gcc_personality_v0"); - default_init_unwind_resume_libfunc (); - using_eh_for_cleanups (); -} - /* Finish processing of a declaration; install its initial value. If ORIGTYPE is not NULL_TREE, it is the original type of INIT. @@ -4360,9 +4341,6 @@ finish_decl (tree decl, location_t init_loc, tree init, TREE_USED (decl) = 1; TREE_USED (cleanup_decl) = 1; - /* Initialize EH, if we've been told to do so. */ - c_maybe_initialize_eh (); - push_cleanup (decl, cleanup, false); } } -- cgit v1.2.1 From 6e0982ac93b945a239af795e598e65073c4b4620 Mon Sep 17 00:00:00 2001 From: jakub Date: Thu, 17 Sep 2009 20:31:54 +0000 Subject: * c-decl.c (finish_struct): Adjust DECL_SOURCE_LOCATION of TYPE_STUB_DECL. * gcc.dg/debug/dwarf2/struct-loc1.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@151816 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/c-decl.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'gcc/c-decl.c') diff --git a/gcc/c-decl.c b/gcc/c-decl.c index ed8863dddd9..c44e35cff46 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -6859,6 +6859,11 @@ finish_struct (location_t loc, tree t, tree fieldlist, tree attributes, } C_TYPE_INCOMPLETE_VARS (TYPE_MAIN_VARIANT (t)) = 0; + /* Update type location to the one of the definition, instead of e.g. + a forward declaration. */ + if (TYPE_STUB_DECL (t)) + DECL_SOURCE_LOCATION (TYPE_STUB_DECL (t)) = loc; + /* Finish debugging output for this type. */ rest_of_type_compilation (t, toplevel); -- cgit v1.2.1 From 1a4c44c530a88024d10331a5213363152ff3d0fa Mon Sep 17 00:00:00 2001 From: dodji Date: Wed, 23 Sep 2009 16:07:13 +0000 Subject: Fix PR debug/41065 gcc/ChangeLog: PR debug/41065 * function.h (types_used_by_vars_hash): Declare new hash table. (types_used_by_vars_eq, types_used_by_var_decl_insert): Declare equality and hash function for the hash table. (types_used_by_cur_var_decl): Declare a new global chained list. (types_used_by_var_decl_insert): Declare new function. * function.c (types_used_by_vars_hash): Define the hashtable ... (types_used_by_vars_eq, types_used_by_vars_do_hash): ... as well as its equality and hash functions. (hash_types_used_by_vars_entry): New hash helper. (types_used_by_cur_var_decl): Define the global chained list. (used_types_insert): Update the list of types used by the global variable being parsed. (types_used_by_var_decl_insert): Define new function. * c-common.h (record_types_used_by_current_var_decl): Declare ... * c-common.c (record_types_used_by_current_var_decl): ... new function. * c-decl.c (finish_decl): Record the types used by the global variable declaration we've just parsed. * dwarf2out.c (premark_used_types): Insert a new line between comment and function. (premark_used_types_helper): Fix comment. (premark_types_used_by_global_vars_helper, premark_types_used_by_global_vars): New functions. (prune_unused_types): Do not prune types used by global variables. gcc/cp/ChangeLog: PR debug/41065 * decl.c (cp_finish_decl): Record the types used by the global variable declaration we've just parsed. gcc/testsuite/ChangeLog: PR debug/41065 * gcc.dg/debug/dwarf2/global-used-types.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@152085 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/c-decl.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'gcc/c-decl.c') diff --git a/gcc/c-decl.c b/gcc/c-decl.c index c44e35cff46..e237332f174 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -4064,6 +4064,13 @@ finish_decl (tree decl, location_t init_loc, tree init, if (asmspec_tree) asmspec = TREE_STRING_POINTER (asmspec_tree); + if (TREE_CODE (decl) == VAR_DECL + && TREE_STATIC (decl) + && global_bindings_p ()) + /* So decl is a global variable. Record the types it uses + so that we can decide later to emit debug info for them. */ + record_types_used_by_current_var_decl (decl); + /* If `start_decl' didn't like having an initialization, ignore it now. */ if (init != 0 && DECL_INITIAL (decl) == 0) init = 0; -- cgit v1.2.1 From 6d5d708e56103fe5b3909c9782d2ade3a982350a Mon Sep 17 00:00:00 2001 From: uweigand Date: Mon, 26 Oct 2009 21:58:06 +0000 Subject: 2009-10-26 Ben Elliston Michael Meissner Ulrich Weigand * doc/tm.texi (TARGET_ADDR_SPACE_KEYWORDS): Document. * c-common.c (c_common_reswords): If TARGET_ADDR_SPACE_KEYWORDS is defined, add the named address space keywords. (c_addr_space_name): New function. (complete_array_type): Preserve named address space. (handle_mode_attribute): Use targetm.addr_space.valid_pointer_mode instead of targetm.valid_pointer_mode. * c-common.h (enum rid): Add RID_ADDR_SPACE_0 .. RID_ADDR_SPACE_15, RID_FIRST_ADDR_SPACE and RID_LAST_ADDR_SPACE. (ADDR_SPACE_KEYWORD): New macro. (c_addr_space_name): Add prototype. * c-tree.h (struct c_declspecs): Add address_space member. (declspecs_add_addrspace): Add prototype. * c-pretty-print.c (pp_c_type_qualifier_list): Handle address spaces. * c-parser.c (c_parse_init): Add assertion. (typedef enum c_id_kind): Add C_ID_ADDRSPACE. (c_lex_one_token): Handle address space keywords. (c_token_starts_typename): Likewise. (c_token_starts_declspecs): Likewise. (c_parser_declspecs): Likewise. (c_parser_postfix_expression_after_paren_type): Diagnose compound literal within function qualified with named address space. * c-decl.c (diagnose_mismatched_decls): Diagnose conflicting named address space qualifiers. (shadow_tag_warned): Warn about useless address space qualifiers. (quals_from_declspecs): Handle address space qualifiers. (grokdeclarator): Likewise. (build_null_declspecs): Likewise. (declspecs_add_addrspace): New function. * c-typeck.c (addr_space_superset): New function. (qualify_type): Handle named address spaces. (composite_type): Likewise. (common_pointer_type): Likewise. (comp_target_types): Likewise. (build_conditional_expr): Likewise. (handle_warn_cast_qual): Likewise. (build_c_cast): Likewise. (convert_for_assignment): Likewise. (build_binary_op): Likewise. (pointer_diff): Handle named address spaces. Use intermediate integer type of sufficient size if required. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@153574 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/c-decl.c | 135 +++++++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 128 insertions(+), 7 deletions(-) (limited to 'gcc/c-decl.c') diff --git a/gcc/c-decl.c b/gcc/c-decl.c index e237332f174..492d2e673b7 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -1746,8 +1746,35 @@ diagnose_mismatched_decls (tree newdecl, tree olddecl, } else { - if (TYPE_QUALS (newtype) != TYPE_QUALS (oldtype)) - error ("conflicting type qualifiers for %q+D", newdecl); + int new_quals = TYPE_QUALS (newtype); + int old_quals = TYPE_QUALS (oldtype); + + if (new_quals != old_quals) + { + addr_space_t new_addr = DECODE_QUAL_ADDR_SPACE (new_quals); + addr_space_t old_addr = DECODE_QUAL_ADDR_SPACE (old_quals); + if (new_addr != old_addr) + { + if (ADDR_SPACE_GENERIC_P (new_addr)) + error ("conflicting named address spaces (generic vs %s) " + "for %q+D", + c_addr_space_name (old_addr), newdecl); + else if (ADDR_SPACE_GENERIC_P (old_addr)) + error ("conflicting named address spaces (%s vs generic) " + "for %q+D", + c_addr_space_name (new_addr), newdecl); + else + error ("conflicting named address spaces (%s vs %s) " + "for %q+D", + c_addr_space_name (new_addr), + c_addr_space_name (old_addr), + newdecl); + } + + if (CLEAR_QUAL_ADDR_SPACE (new_quals) + != CLEAR_QUAL_ADDR_SPACE (old_quals)) + error ("conflicting type qualifiers for %q+D", newdecl); + } else error ("conflicting types for %q+D", newdecl); diagnose_arglist_conflict (newdecl, olddecl, newtype, oldtype); @@ -3605,7 +3632,8 @@ shadow_tag_warned (const struct c_declspecs *declspecs, int warned) else if (!declspecs->tag_defined_p && (declspecs->const_p || declspecs->volatile_p - || declspecs->restrict_p)) + || declspecs->restrict_p + || declspecs->address_space)) { if (warned != 1) pedwarn (input_location, 0, @@ -3676,7 +3704,8 @@ shadow_tag_warned (const struct c_declspecs *declspecs, int warned) if (!warned && !in_system_header && (declspecs->const_p || declspecs->volatile_p - || declspecs->restrict_p)) + || declspecs->restrict_p + || declspecs->address_space)) { warning (0, "useless type qualifier in empty declaration"); warned = 2; @@ -3699,7 +3728,8 @@ quals_from_declspecs (const struct c_declspecs *specs) { int quals = ((specs->const_p ? TYPE_QUAL_CONST : 0) | (specs->volatile_p ? TYPE_QUAL_VOLATILE : 0) - | (specs->restrict_p ? TYPE_QUAL_RESTRICT : 0)); + | (specs->restrict_p ? TYPE_QUAL_RESTRICT : 0) + | (ENCODE_QUAL_ADDR_SPACE (specs->address_space))); gcc_assert (!specs->type && !specs->decl_attr && specs->typespec_word == cts_none @@ -4750,6 +4780,7 @@ grokdeclarator (const struct c_declarator *declarator, bool bitfield = width != NULL; tree element_type; struct c_arg_info *arg_info = 0; + addr_space_t as1, as2, address_space; location_t loc = UNKNOWN_LOCATION; const char *errmsg; tree expr_dummy; @@ -4880,6 +4911,10 @@ grokdeclarator (const struct c_declarator *declarator, constp = declspecs->const_p + TYPE_READONLY (element_type); restrictp = declspecs->restrict_p + TYPE_RESTRICT (element_type); volatilep = declspecs->volatile_p + TYPE_VOLATILE (element_type); + as1 = declspecs->address_space; + as2 = TYPE_ADDR_SPACE (element_type); + address_space = ADDR_SPACE_GENERIC_P (as1)? as2 : as1; + if (pedantic && !flag_isoc99) { if (constp > 1) @@ -4889,11 +4924,17 @@ grokdeclarator (const struct c_declarator *declarator, if (volatilep > 1) pedwarn (loc, OPT_pedantic, "duplicate %"); } + + if (!ADDR_SPACE_GENERIC_P (as1) && !ADDR_SPACE_GENERIC_P (as2) && as1 != as2) + error_at (loc, "conflicting named address spaces (%s vs %s)", + c_addr_space_name (as1), c_addr_space_name (as2)); + if (!flag_gen_aux_info && (TYPE_QUALS (element_type))) type = TYPE_MAIN_VARIANT (type); type_quals = ((constp ? TYPE_QUAL_CONST : 0) | (restrictp ? TYPE_QUAL_RESTRICT : 0) - | (volatilep ? TYPE_QUAL_VOLATILE : 0)); + | (volatilep ? TYPE_QUAL_VOLATILE : 0) + | ENCODE_QUAL_ADDR_SPACE (address_space)); /* Warn about storage classes that are invalid for certain kinds of declarations (parameters, typenames, etc.). */ @@ -5309,7 +5350,14 @@ grokdeclarator (const struct c_declarator *declarator, it, but here we want to make sure we don't ever modify the shared type, so we gcc_assert (itype) below. */ - type = build_array_type (type, itype); + { + addr_space_t as = DECODE_QUAL_ADDR_SPACE (type_quals); + if (!ADDR_SPACE_GENERIC_P (as) && as != TYPE_ADDR_SPACE (type)) + type = build_qualified_type (type, + ENCODE_QUAL_ADDR_SPACE (as)); + + type = build_array_type (type, itype); + } if (type != error_mark_node) { @@ -5515,6 +5563,59 @@ grokdeclarator (const struct c_declarator *declarator, /* Now TYPE has the actual type, apart from any qualifiers in TYPE_QUALS. */ + /* Warn about address space used for things other than static memory or + pointers. */ + address_space = DECODE_QUAL_ADDR_SPACE (type_quals); + if (!ADDR_SPACE_GENERIC_P (address_space)) + { + if (decl_context == NORMAL) + { + switch (storage_class) + { + case csc_auto: + error ("%qs combined with % qualifier for %qE", + c_addr_space_name (address_space), name); + break; + case csc_register: + error ("%qs combined with % qualifier for %qE", + c_addr_space_name (address_space), name); + break; + case csc_none: + if (current_function_scope) + { + error ("%qs specified for auto variable %qE", + c_addr_space_name (address_space), name); + break; + } + break; + case csc_static: + case csc_extern: + case csc_typedef: + break; + default: + gcc_unreachable (); + } + } + else if (decl_context == PARM && TREE_CODE (type) != ARRAY_TYPE) + { + if (name) + error ("%qs specified for parameter %qE", + c_addr_space_name (address_space), name); + else + error ("%qs specified for unnamed parameter", + c_addr_space_name (address_space)); + } + else if (decl_context == FIELD) + { + if (name) + error ("%qs specified for structure field %qE", + c_addr_space_name (address_space), name); + else + error ("%qs specified for structure field", + c_addr_space_name (address_space)); + } + } + /* Check the type and width of a bit-field. */ if (bitfield) check_bitfield_type_and_width (&type, width, name); @@ -8297,9 +8398,29 @@ build_null_declspecs (void) ret->volatile_p = false; ret->restrict_p = false; ret->saturating_p = false; + ret->address_space = ADDR_SPACE_GENERIC; return ret; } +/* Add the address space ADDRSPACE to the declaration specifiers + SPECS, returning SPECS. */ + +struct c_declspecs * +declspecs_add_addrspace (struct c_declspecs *specs, addr_space_t as) +{ + specs->non_sc_seen_p = true; + specs->declspecs_seen_p = true; + + if (!ADDR_SPACE_GENERIC_P (specs->address_space) + && specs->address_space != as) + error ("incompatible address space qualifiers %qs and %qs", + c_addr_space_name (as), + c_addr_space_name (specs->address_space)); + else + specs->address_space = as; + return specs; +} + /* Add the type qualifier QUAL to the declaration specifiers SPECS, returning SPECS. */ -- cgit v1.2.1 From 48e1416a24d50cacbb2a5e06a9ee61dd8cbee313 Mon Sep 17 00:00:00 2001 From: hjl Date: Wed, 25 Nov 2009 10:55:54 +0000 Subject: Remove trailing white spaces. 2009-11-25 H.J. Lu * alias.c: Remove trailing white spaces. * alloc-pool.c: Likewise. * alloc-pool.h: Likewise. * attribs.c: Likewise. * auto-inc-dec.c: Likewise. * basic-block.h: Likewise. * bb-reorder.c: Likewise. * bt-load.c: Likewise. * builtins.c: Likewise. * builtins.def: Likewise. * c-common.c: Likewise. * c-common.h: Likewise. * c-cppbuiltin.c: Likewise. * c-decl.c: Likewise. * c-format.c: Likewise. * c-lex.c: Likewise. * c-omp.c: Likewise. * c-opts.c: Likewise. * c-parser.c: Likewise. * c-pretty-print.c: Likewise. * c-tree.h: Likewise. * c-typeck.c: Likewise. * caller-save.c: Likewise. * calls.c: Likewise. * cfg.c: Likewise. * cfganal.c: Likewise. * cfgexpand.c: Likewise. * cfghooks.c: Likewise. * cfghooks.h: Likewise. * cfglayout.c: Likewise. * cfgloop.c: Likewise. * cfgloop.h: Likewise. * cfgloopmanip.c: Likewise. * cfgrtl.c: Likewise. * cgraph.c: Likewise. * cgraph.h: Likewise. * cgraphbuild.c: Likewise. * cgraphunit.c: Likewise. * cif-code.def: Likewise. * collect2.c: Likewise. * combine.c: Likewise. * convert.c: Likewise. * coverage.c: Likewise. * crtstuff.c: Likewise. * cse.c: Likewise. * cselib.c: Likewise. * dbgcnt.c: Likewise. * dbgcnt.def: Likewise. * dbgcnt.h: Likewise. * dbxout.c: Likewise. * dce.c: Likewise. * ddg.c: Likewise. * ddg.h: Likewise. * defaults.h: Likewise. * df-byte-scan.c: Likewise. * df-core.c: Likewise. * df-problems.c: Likewise. * df-scan.c: Likewise. * df.h: Likewise. * dfp.c: Likewise. * diagnostic.c: Likewise. * diagnostic.h: Likewise. * dominance.c: Likewise. * domwalk.c: Likewise. * double-int.c: Likewise. * double-int.h: Likewise. * dse.c: Likewise. * dwarf2asm.c: Likewise. * dwarf2asm.h: Likewise. * dwarf2out.c: Likewise. * ebitmap.c: Likewise. * ebitmap.h: Likewise. * emit-rtl.c: Likewise. * et-forest.c: Likewise. * except.c: Likewise. * except.h: Likewise. * expmed.c: Likewise. * expr.c: Likewise. * expr.h: Likewise. * final.c: Likewise. * flags.h: Likewise. * fold-const.c: Likewise. * function.c: Likewise. * function.h: Likewise. * fwprop.c: Likewise. * gcc.c: Likewise. * gcov-dump.c: Likewise. * gcov-io.c: Likewise. * gcov-io.h: Likewise. * gcov.c: Likewise. * gcse.c: Likewise. * genattr.c: Likewise. * genattrtab.c: Likewise. * genautomata.c: Likewise. * genchecksum.c: Likewise. * genconfig.c: Likewise. * genflags.c: Likewise. * gengtype-parse.c: Likewise. * gengtype.c: Likewise. * gengtype.h: Likewise. * genmddeps.c: Likewise. * genmodes.c: Likewise. * genopinit.c: Likewise. * genpreds.c: Likewise. * gensupport.c: Likewise. * ggc-common.c: Likewise. * ggc-page.c: Likewise. * ggc-zone.c: Likewise. * ggc.h: Likewise. * gimple-iterator.c: Likewise. * gimple-low.c: Likewise. * gimple-pretty-print.c: Likewise. * gimple.c: Likewise. * gimple.def: Likewise. * gimple.h: Likewise. * gimplify.c: Likewise. * graphds.c: Likewise. * graphite-clast-to-gimple.c: Likewise. * gthr-nks.h: Likewise. * gthr-posix.c: Likewise. * gthr-posix.h: Likewise. * gthr-posix95.h: Likewise. * gthr-single.h: Likewise. * gthr-tpf.h: Likewise. * gthr-vxworks.h: Likewise. * gthr.h: Likewise. * haifa-sched.c: Likewise. * hard-reg-set.h: Likewise. * hooks.c: Likewise. * hooks.h: Likewise. * hosthooks.h: Likewise. * hwint.h: Likewise. * ifcvt.c: Likewise. * incpath.c: Likewise. * init-regs.c: Likewise. * integrate.c: Likewise. * ipa-cp.c: Likewise. * ipa-inline.c: Likewise. * ipa-prop.c: Likewise. * ipa-pure-const.c: Likewise. * ipa-reference.c: Likewise. * ipa-struct-reorg.c: Likewise. * ipa-struct-reorg.h: Likewise. * ipa-type-escape.c: Likewise. * ipa-type-escape.h: Likewise. * ipa-utils.c: Likewise. * ipa-utils.h: Likewise. * ipa.c: Likewise. * ira-build.c: Likewise. * ira-color.c: Likewise. * ira-conflicts.c: Likewise. * ira-costs.c: Likewise. * ira-emit.c: Likewise. * ira-int.h: Likewise. * ira-lives.c: Likewise. * ira.c: Likewise. * jump.c: Likewise. * lambda-code.c: Likewise. * lambda-mat.c: Likewise. * lambda-trans.c: Likewise. * lambda.h: Likewise. * langhooks.c: Likewise. * lcm.c: Likewise. * libgcov.c: Likewise. * lists.c: Likewise. * loop-doloop.c: Likewise. * loop-init.c: Likewise. * loop-invariant.c: Likewise. * loop-iv.c: Likewise. * loop-unroll.c: Likewise. * lower-subreg.c: Likewise. * lto-cgraph.c: Likewise. * lto-compress.c: Likewise. * lto-opts.c: Likewise. * lto-section-in.c: Likewise. * lto-section-out.c: Likewise. * lto-streamer-in.c: Likewise. * lto-streamer-out.c: Likewise. * lto-streamer.c: Likewise. * lto-streamer.h: Likewise. * lto-symtab.c: Likewise. * lto-wpa-fixup.c: Likewise. * matrix-reorg.c: Likewise. * mcf.c: Likewise. * mode-switching.c: Likewise. * modulo-sched.c: Likewise. * omega.c: Likewise. * omega.h: Likewise. * omp-low.c: Likewise. * optabs.c: Likewise. * optabs.h: Likewise. * opts-common.c: Likewise. * opts.c: Likewise. * params.def: Likewise. * params.h: Likewise. * passes.c: Likewise. * plugin.c: Likewise. * postreload-gcse.c: Likewise. * postreload.c: Likewise. * predict.c: Likewise. * predict.def: Likewise. * pretty-print.c: Likewise. * pretty-print.h: Likewise. * print-rtl.c: Likewise. * print-tree.c: Likewise. * profile.c: Likewise. * read-rtl.c: Likewise. * real.c: Likewise. * recog.c: Likewise. * reg-stack.c: Likewise. * regcprop.c: Likewise. * reginfo.c: Likewise. * regmove.c: Likewise. * regrename.c: Likewise. * regs.h: Likewise. * regstat.c: Likewise. * reload.c: Likewise. * reload1.c: Likewise. * resource.c: Likewise. * rtl.c: Likewise. * rtl.def: Likewise. * rtl.h: Likewise. * rtlanal.c: Likewise. * sbitmap.c: Likewise. * sched-deps.c: Likewise. * sched-ebb.c: Likewise. * sched-int.h: Likewise. * sched-rgn.c: Likewise. * sched-vis.c: Likewise. * sdbout.c: Likewise. * sel-sched-dump.c: Likewise. * sel-sched-dump.h: Likewise. * sel-sched-ir.c: Likewise. * sel-sched-ir.h: Likewise. * sel-sched.c: Likewise. * sel-sched.h: Likewise. * sese.c: Likewise. * sese.h: Likewise. * simplify-rtx.c: Likewise. * stack-ptr-mod.c: Likewise. * stmt.c: Likewise. * stor-layout.c: Likewise. * store-motion.c: Likewise. * stringpool.c: Likewise. * stub-objc.c: Likewise. * sync-builtins.def: Likewise. * target-def.h: Likewise. * target.h: Likewise. * targhooks.c: Likewise. * targhooks.h: Likewise. * timevar.c: Likewise. * tlink.c: Likewise. * toplev.c: Likewise. * toplev.h: Likewise. * tracer.c: Likewise. * tree-affine.c: Likewise. * tree-affine.h: Likewise. * tree-browser.def: Likewise. * tree-call-cdce.c: Likewise. * tree-cfg.c: Likewise. * tree-cfgcleanup.c: Likewise. * tree-chrec.c: Likewise. * tree-chrec.h: Likewise. * tree-complex.c: Likewise. * tree-data-ref.c: Likewise. * tree-data-ref.h: Likewise. * tree-dfa.c: Likewise. * tree-dump.c: Likewise. * tree-dump.h: Likewise. * tree-eh.c: Likewise. * tree-flow-inline.h: Likewise. * tree-flow.h: Likewise. * tree-if-conv.c: Likewise. * tree-inline.c: Likewise. * tree-into-ssa.c: Likewise. * tree-loop-distribution.c: Likewise. * tree-loop-linear.c: Likewise. * tree-mudflap.c: Likewise. * tree-nested.c: Likewise. * tree-nomudflap.c: Likewise. * tree-nrv.c: Likewise. * tree-object-size.c: Likewise. * tree-optimize.c: Likewise. * tree-outof-ssa.c: Likewise. * tree-parloops.c: Likewise. * tree-pass.h: Likewise. * tree-phinodes.c: Likewise. * tree-predcom.c: Likewise. * tree-pretty-print.c: Likewise. * tree-profile.c: Likewise. * tree-scalar-evolution.c: Likewise. * tree-ssa-address.c: Likewise. * tree-ssa-alias.c: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-coalesce.c: Likewise. * tree-ssa-copy.c: Likewise. * tree-ssa-copyrename.c: Likewise. * tree-ssa-dce.c: Likewise. * tree-ssa-dom.c: Likewise. * tree-ssa-dse.c: Likewise. * tree-ssa-forwprop.c: Likewise. * tree-ssa-ifcombine.c: Likewise. * tree-ssa-live.c: Likewise. * tree-ssa-live.h: Likewise. * tree-ssa-loop-ch.c: Likewise. * tree-ssa-loop-im.c: Likewise. * tree-ssa-loop-ivcanon.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-ssa-loop-manip.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-ssa-loop-unswitch.c: Likewise. * tree-ssa-loop.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-operands.c: Likewise. * tree-ssa-operands.h: Likewise. * tree-ssa-phiopt.c: Likewise. * tree-ssa-phiprop.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-propagate.c: Likewise. * tree-ssa-reassoc.c: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-sink.c: Likewise. * tree-ssa-structalias.c: Likewise. * tree-ssa-ter.c: Likewise. * tree-ssa-threadedge.c: Likewise. * tree-ssa-threadupdate.c: Likewise. * tree-ssa-uncprop.c: Likewise. * tree-ssa.c: Likewise. * tree-ssanames.c: Likewise. * tree-switch-conversion.c: Likewise. * tree-tailcall.c: Likewise. * tree-vect-data-refs.c: Likewise. * tree-vect-generic.c: Likewise. * tree-vect-loop-manip.c: Likewise. * tree-vect-loop.c: Likewise. * tree-vect-patterns.c: Likewise. * tree-vect-slp.c: Likewise. * tree-vect-stmts.c: Likewise. * tree-vectorizer.c: Likewise. * tree-vectorizer.h: Likewise. * tree-vrp.c: Likewise. * tree.c: Likewise. * tree.def: Likewise. * tree.h: Likewise. * treestruct.def: Likewise. * unwind-compat.c: Likewise. * unwind-dw2-fde-glibc.c: Likewise. * unwind-dw2.c: Likewise. * value-prof.c: Likewise. * value-prof.h: Likewise. * var-tracking.c: Likewise. * varasm.c: Likewise. * varpool.c: Likewise. * vec.c: Likewise. * vec.h: Likewise. * vmsdbgout.c: Likewise. * web.c: Likewise. * xcoffout.c: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@154645 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/c-decl.c | 48 ++++++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 24 deletions(-) (limited to 'gcc/c-decl.c') diff --git a/gcc/c-decl.c b/gcc/c-decl.c index 492d2e673b7..59179dd5858 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -1102,7 +1102,7 @@ pop_scope (void) error ("label %q+D used but not defined", p); DECL_INITIAL (p) = error_mark_node; } - else + else warn_for_unused_label (p); /* Labels go in BLOCK_VARS. */ @@ -1897,7 +1897,7 @@ diagnose_mismatched_decls (tree newdecl, tree olddecl, } else if (warn_traditional) { - warned |= warning (OPT_Wtraditional, + warned |= warning (OPT_Wtraditional, "non-static declaration of %q+D " "follows static declaration", newdecl); } @@ -1975,7 +1975,7 @@ diagnose_mismatched_decls (tree newdecl, tree olddecl, } else if (warn_traditional) { - warned |= warning (OPT_Wtraditional, + warned |= warning (OPT_Wtraditional, "non-static declaration of %q+D " "follows static declaration", newdecl); } @@ -2046,14 +2046,14 @@ diagnose_mismatched_decls (tree newdecl, tree olddecl, if (DECL_DECLARED_INLINE_P (newdecl) && lookup_attribute ("noinline", DECL_ATTRIBUTES (olddecl))) { - warned |= warning (OPT_Wattributes, + warned |= warning (OPT_Wattributes, "inline declaration of %qD follows " "declaration with attribute noinline", newdecl); } else if (DECL_DECLARED_INLINE_P (olddecl) && lookup_attribute ("noinline", DECL_ATTRIBUTES (newdecl))) { - warned |= warning (OPT_Wattributes, + warned |= warning (OPT_Wattributes, "declaration of %q+D with attribute " "noinline follows inline declaration ", newdecl); } @@ -2812,8 +2812,8 @@ implicit_decl_warning (tree id, tree olddecl) if (flag_isoc99) warned = pedwarn (input_location, OPT_Wimplicit_function_declaration, "implicit declaration of function %qE", id); - else - warned = warning (OPT_Wimplicit_function_declaration, + else + warned = warning (OPT_Wimplicit_function_declaration, G_("implicit declaration of function %qE"), id); if (olddecl && warned) locate_old_decl (olddecl); @@ -3497,10 +3497,10 @@ c_make_fname_decl (location_t loc, tree id, int type_dep) if (current_function_decl /* For invalid programs like this: - + void foo() const char* p = __FUNCTION__; - + the __FUNCTION__ is believed to appear in K&R style function parameter declarator. In that case we still don't have function_scope. */ @@ -4653,7 +4653,7 @@ warn_variable_length_array (tree name, tree size) } else { - if (name) + if (name) pedwarn (input_location, OPT_Wvla, "ISO C90 forbids variable length array %qE", name); @@ -4880,11 +4880,11 @@ grokdeclarator (const struct c_declarator *declarator, else { if (name) - pedwarn_c99 (loc, flag_isoc99 ? 0 : OPT_Wimplicit_int, + pedwarn_c99 (loc, flag_isoc99 ? 0 : OPT_Wimplicit_int, "type defaults to % in declaration of %qE", name); else - pedwarn_c99 (input_location, flag_isoc99 ? 0 : OPT_Wimplicit_int, + pedwarn_c99 (input_location, flag_isoc99 ? 0 : OPT_Wimplicit_int, "type defaults to % in type name"); } } @@ -4946,8 +4946,8 @@ grokdeclarator (const struct c_declarator *declarator, || storage_class == csc_typedef)) { if (storage_class == csc_auto) - pedwarn (loc, - (current_scope == file_scope) ? 0 : OPT_pedantic, + pedwarn (loc, + (current_scope == file_scope) ? 0 : OPT_pedantic, "function definition declared %"); if (storage_class == csc_register) error_at (loc, "function definition declared %"); @@ -6833,7 +6833,7 @@ finish_struct (location_t loc, tree t, tree fieldlist, tree attributes, if (pedantic && TREE_CODE (t) == RECORD_TYPE && flexible_array_type_p (TREE_TYPE (x))) - pedwarn (DECL_SOURCE_LOCATION (x), OPT_pedantic, + pedwarn (DECL_SOURCE_LOCATION (x), OPT_pedantic, "invalid use of structure with flexible array member"); if (DECL_NAME (x)) @@ -7284,7 +7284,7 @@ build_enumerator (location_t loc, (6.4.4.3/2 in the C99 Standard). GCC allows any integer type as an extension. */ else if (!int_fits_type_p (value, integer_type_node)) - pedwarn (loc, OPT_pedantic, + pedwarn (loc, OPT_pedantic, "ISO C restricts enumerator values to range of %"); /* The ISO C Standard mandates enumerators to have type int, even @@ -7396,7 +7396,7 @@ start_function (struct c_declspecs *declspecs, struct c_declarator *declarator, } if (warn_about_return_type) - pedwarn_c99 (loc, flag_isoc99 ? 0 + pedwarn_c99 (loc, flag_isoc99 ? 0 : (warn_return_type ? OPT_Wreturn_type : OPT_Wimplicit_int), "return type defaults to %"); @@ -7693,7 +7693,7 @@ store_parm_decls_oldstyle (tree fndecl, const struct c_arg_info *arg_info) if (flag_isoc99) pedwarn (DECL_SOURCE_LOCATION (decl), 0, "type of %qD defaults to %", decl); - else + else warning_at (DECL_SOURCE_LOCATION (decl), OPT_Wmissing_parameter_type, "type of %qD defaults to %", decl); @@ -8039,7 +8039,7 @@ finish_function (void) c_determine_visibility (fndecl); /* For GNU C extern inline functions disregard inline limits. */ - if (DECL_EXTERNAL (fndecl) + if (DECL_EXTERNAL (fndecl) && DECL_DECLARED_INLINE_P (fndecl)) DECL_DISREGARD_INLINE_LIMITS (fndecl) = 1; @@ -8896,7 +8896,7 @@ declspecs_add_type (location_t loc, struct c_declspecs *specs, case RID_DFLOAT32: case RID_DFLOAT64: case RID_DFLOAT128: - { + { const char *str; if (i == RID_DFLOAT32) str = "_Decimal32"; @@ -9065,7 +9065,7 @@ declspecs_add_scspec (struct c_declspecs *specs, tree scspec) && C_IS_RESERVED_WORD (scspec)); i = C_RID_CODE (scspec); if (specs->non_sc_seen_p) - warning (OPT_Wold_style_declaration, + warning (OPT_Wold_style_declaration, "%qE is not at beginning of declaration", scspec); switch (i) { @@ -9187,7 +9187,7 @@ finish_declspecs (struct c_declspecs *specs) else if (specs->complex_p) { specs->typespec_word = cts_double; - pedwarn (input_location, OPT_pedantic, + pedwarn (input_location, OPT_pedantic, "ISO C does not support plain % meaning " "%"); } @@ -9232,7 +9232,7 @@ finish_declspecs (struct c_declspecs *specs) specs->type = char_type_node; if (specs->complex_p) { - pedwarn (input_location, OPT_pedantic, + pedwarn (input_location, OPT_pedantic, "ISO C does not support complex integer types"); specs->type = build_complex_type (specs->type); } @@ -9258,7 +9258,7 @@ finish_declspecs (struct c_declspecs *specs) : integer_type_node); if (specs->complex_p) { - pedwarn (input_location, OPT_pedantic, + pedwarn (input_location, OPT_pedantic, "ISO C does not support complex integer types"); specs->type = build_complex_type (specs->type); } -- cgit v1.2.1 From 0bac94cb594aa47c9a883f83daeaa628401baf8d Mon Sep 17 00:00:00 2001 From: espindola Date: Mon, 21 Dec 2009 20:37:49 +0000 Subject: 2009-12-21 Brian Hackett * decl.c (finish_function): Rename pre-genericize event. 2009-12-21 Brian Hackett * plugin.def: Rename pre-genericize event. * plugin.c (register_callback, invoke_plugin_callbacks): Same. * c-decl.c (finish_function): Invoke callbacks on above event. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@155379 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/c-decl.c | 1 + 1 file changed, 1 insertion(+) (limited to 'gcc/c-decl.c') diff --git a/gcc/c-decl.c b/gcc/c-decl.c index 59179dd5858..49a530c551b 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -8052,6 +8052,7 @@ finish_function (void) { if (!decl_function_context (fndecl)) { + invoke_plugin_callbacks (PLUGIN_PRE_GENERICIZE, fndecl); c_genericize (fndecl); /* ??? Objc emits functions after finalizing the compilation unit. -- cgit v1.2.1 From 59dc2654d4e16ababf4ef4a3f25ec24b65889d95 Mon Sep 17 00:00:00 2001 From: jsm28 Date: Wed, 30 Dec 2009 21:28:45 +0000 Subject: PR c/42439 * c-decl.c (check_bitfield_type_and_width): Only pedwarn if pedantic for bit-field width not an integer constant expression but folding to one. testsuite: * gcc.dg/bitfld-19.c, gcc.dg/bitfld-20.c, gcc.dg/bitfld-21.c: New tests. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@155526 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/c-decl.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'gcc/c-decl.c') diff --git a/gcc/c-decl.c b/gcc/c-decl.c index 49a530c551b..0655197f5bc 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -4570,14 +4570,26 @@ check_bitfield_type_and_width (tree *type, tree *width, tree orig_name) /* Detect and ignore out of range field width and process valid field widths. */ - if (!INTEGRAL_TYPE_P (TREE_TYPE (*width)) - || TREE_CODE (*width) != INTEGER_CST) + if (!INTEGRAL_TYPE_P (TREE_TYPE (*width))) { error ("bit-field %qs width not an integer constant", name); *width = integer_one_node; } else { + if (TREE_CODE (*width) != INTEGER_CST) + { + *width = c_fully_fold (*width, false, NULL); + if (TREE_CODE (*width) == INTEGER_CST) + pedwarn (input_location, OPT_pedantic, + "bit-field %qs width not an integer constant expression", + name); + } + if (TREE_CODE (*width) != INTEGER_CST) + { + error ("bit-field %qs width not an integer constant", name); + *width = integer_one_node; + } constant_expression_warning (*width); if (tree_int_cst_sgn (*width) < 0) { -- cgit v1.2.1 From f54ef8b6bdcb2db0a3bc5c76b028df7a75fe524d Mon Sep 17 00:00:00 2001 From: rguenth Date: Fri, 1 Jan 2010 17:19:02 +0000 Subject: 2010-01-01 Richard Guenther PR c/42570 * c-decl.c (grokdeclarator): For zero-size arrays force structural equality checks as layout_type does. * gcc.c-torture/execute/pr42570.c: New testcase. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@155557 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/c-decl.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'gcc/c-decl.c') diff --git a/gcc/c-decl.c b/gcc/c-decl.c index 0655197f5bc..a244a83e787 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -1,6 +1,6 @@ /* Process declarations and variables for C compiler. Copyright (C) 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, - 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 + 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. This file is part of GCC. @@ -5394,6 +5394,7 @@ grokdeclarator (const struct c_declarator *declarator, gcc_assert (itype); TYPE_SIZE (type) = bitsize_zero_node; TYPE_SIZE_UNIT (type) = size_zero_node; + SET_TYPE_STRUCTURAL_EQUALITY (type); } if (array_parm_vla_unspec_p) { @@ -5401,6 +5402,7 @@ grokdeclarator (const struct c_declarator *declarator, /* The type is complete. C99 6.7.5.2p4 */ TYPE_SIZE (type) = bitsize_zero_node; TYPE_SIZE_UNIT (type) = size_zero_node; + SET_TYPE_STRUCTURAL_EQUALITY (type); } } -- cgit v1.2.1 From 578d26950d917258b76b87128efea642b19e9f98 Mon Sep 17 00:00:00 2001 From: jakub Date: Thu, 14 Jan 2010 22:43:56 +0000 Subject: PR middle-end/42674 * c-decl.c (finish_function): Don't emit -Wreturn-type warnings in functions with noreturn attribute. * decl.c (finish_function): Don't emit -Wreturn-type warnings in functions with noreturn attribute. * c-c++-common/pr42674.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@155920 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/c-decl.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'gcc/c-decl.c') diff --git a/gcc/c-decl.c b/gcc/c-decl.c index a244a83e787..91d58844550 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -8032,6 +8032,8 @@ finish_function (void) && !current_function_returns_value && !current_function_returns_null /* Don't complain if we are no-return. */ && !current_function_returns_abnormally + /* Don't complain if we are declared noreturn. */ + && !TREE_THIS_VOLATILE (fndecl) /* Don't warn for main(). */ && !MAIN_NAME_P (DECL_NAME (fndecl)) /* Or if they didn't actually specify a return type. */ -- cgit v1.2.1 From 8df5a43d64487d03b55a5799f17a6c465e019062 Mon Sep 17 00:00:00 2001 From: jason Date: Thu, 21 Jan 2010 05:49:35 +0000 Subject: * tree.h (TYPE_TRANSPARENT_UNION): Replace with ... (TYPE_TRANSPARENT_AGGR): this, for union and record. * calls.c (initialize argument_information): Handle it. * c-common.c (handle_transparent_union_attribute): Use new name. * c-decl.c (finish_struct): Ditto. * c-typeck.c (type_lists_compatible_p): Ditto. (convert_for_assignment): Use new name and also handle record. * function.c (aggregate_value_p): Handle it. (pass_by_reference): Ditto. (assign_parm_data_types): Ditto. * print-tree.c (print_node): Ditto. * lto-streamer-in.c (unpack_ts_type_value_fields): Ditto. * lto-streamer-out.c (pack_ts_type_value_fields): Ditto. * tree.c (first_field): New fn. gcc/cp/ * mangle.c (write_type): Mangle transparent record as member type. * semantics.c (begin_class_definition): Recognize decimal classes and set TYPE_TRANSPARENT_AGGR. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@156106 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/c-decl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'gcc/c-decl.c') diff --git a/gcc/c-decl.c b/gcc/c-decl.c index 91d58844550..e48cdc88e4e 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -6953,10 +6953,10 @@ finish_struct (location_t loc, tree t, tree fieldlist, tree attributes, /* If this was supposed to be a transparent union, but we can't make it one, warn and turn off the flag. */ if (TREE_CODE (t) == UNION_TYPE - && TYPE_TRANSPARENT_UNION (t) + && TYPE_TRANSPARENT_AGGR (t) && (!TYPE_FIELDS (t) || TYPE_MODE (t) != DECL_MODE (TYPE_FIELDS (t)))) { - TYPE_TRANSPARENT_UNION (t) = 0; + TYPE_TRANSPARENT_AGGR (t) = 0; warning_at (loc, 0, "union cannot be made transparent"); } -- cgit v1.2.1 From 5b5632f73a3e4722ea361d9c11d9e53efd76606c Mon Sep 17 00:00:00 2001 From: mrs Date: Sat, 20 Feb 2010 17:28:14 +0000 Subject: PR middle-end/43125 * c-decl.c (merge_decls): Merge DECL_PRESERVE_P. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@156927 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/c-decl.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'gcc/c-decl.c') diff --git a/gcc/c-decl.c b/gcc/c-decl.c index e48cdc88e4e..e8e7a45f94f 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -2387,6 +2387,10 @@ merge_decls (tree newdecl, tree olddecl, tree newtype, tree oldtype) TREE_USED (newdecl) = 1; else if (TREE_USED (newdecl)) TREE_USED (olddecl) = 1; + if (DECL_PRESERVE_P (olddecl)) + DECL_PRESERVE_P (newdecl) = 1; + else if (DECL_PRESERVE_P (newdecl)) + DECL_PRESERVE_P (olddecl) = 1; /* Copy most of the decl-specific fields of NEWDECL into OLDDECL. But preserve OLDDECL's DECL_UID, DECL_CONTEXT and -- cgit v1.2.1 From 83d93c3bd0277f5ffb42061c91e6e32b68b49366 Mon Sep 17 00:00:00 2001 From: manu Date: Fri, 26 Feb 2010 16:56:09 +0000 Subject: =?UTF-8?q?2010-02-26=20=20Manuel=20L=C3=B3pez-Ib=C3=A1=C3=B1ez=20?= =?UTF-8?q?=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR c/24577 * c-decl.c (undeclared_variable): Use an informative note. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@157095 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/c-decl.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'gcc/c-decl.c') diff --git a/gcc/c-decl.c b/gcc/c-decl.c index e8e7a45f94f..f0b6463dc15 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -2949,11 +2949,10 @@ undeclared_variable (location_t loc, tree id) else { error_at (loc, "%qE undeclared (first use in this function)", id); - if (!already) { - error_at (loc, "(Each undeclared identifier is reported only once"); - error_at (loc, "for each function it appears in.)"); + inform (loc, "each undeclared identifier is reported only" + " once for each function it appears in"); already = true; } -- cgit v1.2.1 From 47321b26ff1e10ce56845864e63b1e9ba0421805 Mon Sep 17 00:00:00 2001 From: pinskia Date: Thu, 4 Mar 2010 19:59:19 +0000 Subject: 2010-03-04 Andrew Pinski PR c/43248 * c-decl.c (build_compound_literal): Return early if init is an error_mark_node. 2010-03-04 Andrew Pinski PR c/43248 * gcc.dg/compound-literal-1.c: New testcase. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@157233 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/c-decl.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'gcc/c-decl.c') diff --git a/gcc/c-decl.c b/gcc/c-decl.c index f0b6463dc15..87fb19a3d47 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -4462,7 +4462,8 @@ build_compound_literal (location_t loc, tree type, tree init, bool non_const) tree complit; tree stmt; - if (type == error_mark_node) + if (type == error_mark_node + || init == error_mark_node) return error_mark_node; decl = build_decl (loc, VAR_DECL, NULL_TREE, type); -- cgit v1.2.1 From 259105105fa27f64a0a1d6488b4a5658a29639f1 Mon Sep 17 00:00:00 2001 From: pinskia Date: Fri, 19 Mar 2010 22:52:41 +0000 Subject: 2010-03-19 Andrew Pinski PR C/43211 * c-decl.c (grokparms): Set arg_types to NULL_TREE if there was an error. 2010-03-19 Andrew Pinski PR C/43211 * gcc.dg/pr43211.c: New test. * gcc.dg/pr18809-1.c: Don't expect an error when calling foo. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@157585 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/c-decl.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'gcc/c-decl.c') diff --git a/gcc/c-decl.c b/gcc/c-decl.c index 87fb19a3d47..fed04dca9e9 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -6118,6 +6118,7 @@ grokparms (struct c_arg_info *arg_info, bool funcdef_flag) TREE_VALUE (typelt) = error_mark_node; TREE_TYPE (parm) = error_mark_node; + arg_types = NULL_TREE; } else if (VOID_TYPE_P (type)) { @@ -6138,6 +6139,7 @@ grokparms (struct c_arg_info *arg_info, bool funcdef_flag) error (errmsg); TREE_VALUE (typelt) = error_mark_node; TREE_TYPE (parm) = error_mark_node; + arg_types = NULL_TREE; } if (DECL_NAME (parm) && TREE_USED (parm)) -- cgit v1.2.1 From 1799fbab6a341bb44efe74b182c3e42e71d1ffd7 Mon Sep 17 00:00:00 2001 From: jsm28 Date: Fri, 26 Mar 2010 23:52:09 +0000 Subject: PR c/43381 * c-decl.c (get_parm_info): Assert that decl going in OTHERS has a nested binding iff it is a FUNCTION_DECL. (store_parm_decls_newstyle): Pass nested=true to bind for FUNCTION_DECLs amongst parameters. testsuite: * gcc.dg/parm-impl-decl-3.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@157766 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/c-decl.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'gcc/c-decl.c') diff --git a/gcc/c-decl.c b/gcc/c-decl.c index fed04dca9e9..b6ff3f476e6 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -6303,6 +6303,11 @@ get_parm_info (bool ellipsis) type itself. FUNCTION_DECLs appear when there is an implicit function declaration in the parameter list. */ + /* When we reinsert this decl in the function body, we need + to reconstruct whether it was marked as nested. */ + gcc_assert (TREE_CODE (decl) == FUNCTION_DECL + ? b->nested + : !b->nested); TREE_CHAIN (decl) = others; others = decl; /* fall through */ @@ -7624,7 +7629,9 @@ store_parm_decls_newstyle (tree fndecl, const struct c_arg_info *arg_info) DECL_CONTEXT (decl) = current_function_decl; if (DECL_NAME (decl)) bind (DECL_NAME (decl), decl, current_scope, - /*invisible=*/false, /*nested=*/false, UNKNOWN_LOCATION); + /*invisible=*/false, + /*nested=*/(TREE_CODE (decl) == FUNCTION_DECL), + UNKNOWN_LOCATION); } /* And all the tag declarations. */ -- cgit v1.2.1 From abc6c64fb2e068f6dab7035c99168fbca347a353 Mon Sep 17 00:00:00 2001 From: jakub Date: Wed, 7 Apr 2010 20:33:36 +0000 Subject: PR c/18624 * tree.h (DECL_READ_P): Define. (struct tree_decl_common): Add decl_read_flag. * c-decl.c (pop_scope): If TREE_USED but !DECL_READ_P, issue a set but not used warning. (merge_decls): Merge DECL_READ_P flag. (finish_decl, build_compound_literal): Set DECL_READ_P flag. (finish_function): Issue -Wunused-but-set-parameter diagnostics. * c-common.c (handle_used_attribute, handle_unused_attribute): Likewise. * c-tree.h (default_function_array_read_conversion, mark_exp_read): New prototypes. * c-typeck.c (default_function_array_read_conversion, mark_exp_read): New functions. (default_conversion, c_process_expr_stmt): Call mark_exp_read. * c-parser.c (c_parser_initializer, c_parser_expr_no_commas, c_parser_binary_expression, c_parser_cast_expression, c_parser_expr_list, c_parser_omp_atomic, c_parser_omp_for_loop): Call default_function_array_read_conversion instead of default_function_array_conversion where needed. (c_parser_unary_expression, c_parser_conditional_expression, c_parser_postfix_expression_after_primary, c_parser_initelt): Likewise. Call mark_exp_read where needed. (c_parser_statement_after_labels, c_parser_asm_operands, c_parser_typeof_specifier, c_parser_sizeof_expression, c_parser_alignof_expression, c_parser_initval): Call mark_exp_read where needed. * common.opt (Wunused-but-set-variable, Wunused-but-set-parameter): New. * toplev.c (warn_unused_but_set_variable): Default to warn_unused. (warn_unused_but_set_parameter): Default to warn_unused && extra_warnings. * doc/invoke.texi: Document -Wunused-but-set-variable and -Wunused-but-set-parameter. * objc-act.c (finish_var_decl, objc_begin_catch_clause, really_start_method, get_super_receiver, handle_class_ref): Set DECL_READ_P in addition to TREE_USED. * gcc.dg/Wunused-var-1.c: New test. * gcc.dg/Wunused-var-2.c: New test. * gcc.dg/Wunused-var-3.c: New test. * gcc.dg/Wunused-var-4.c: New test. * gcc.dg/Wunused-var-5.c: New test. * gcc.dg/Wunused-var-6.c: New test. * gcc.dg/Wunused-parm-1.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@158086 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/c-decl.c | 39 ++++++++++++++++++++++++++++++++++++--- 1 file changed, 36 insertions(+), 3 deletions(-) (limited to 'gcc/c-decl.c') diff --git a/gcc/c-decl.c b/gcc/c-decl.c index b6ff3f476e6..bc90fdd38dd 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -1164,14 +1164,21 @@ pop_scope (void) case VAR_DECL: /* Warnings for unused variables. */ - if (!TREE_USED (p) + if ((!TREE_USED (p) || !DECL_READ_P (p)) && !TREE_NO_WARNING (p) && !DECL_IN_SYSTEM_HEADER (p) && DECL_NAME (p) && !DECL_ARTIFICIAL (p) && scope != file_scope && scope != external_scope) - warning (OPT_Wunused_variable, "unused variable %q+D", p); + { + if (!TREE_USED (p)) + warning (OPT_Wunused_variable, "unused variable %q+D", p); + else if (DECL_CONTEXT (p) == current_function_decl) + warning_at (DECL_SOURCE_LOCATION (p), + OPT_Wunused_but_set_variable, + "variable %qD set but not used", p); + } if (b->inner_comp) { @@ -2387,6 +2394,8 @@ merge_decls (tree newdecl, tree olddecl, tree newtype, tree oldtype) TREE_USED (newdecl) = 1; else if (TREE_USED (newdecl)) TREE_USED (olddecl) = 1; + if (TREE_CODE (olddecl) == VAR_DECL || TREE_CODE (olddecl) == PARM_DECL) + DECL_READ_P (newdecl) |= DECL_READ_P (olddecl); if (DECL_PRESERVE_P (olddecl)) DECL_PRESERVE_P (newdecl) = 1; else if (DECL_PRESERVE_P (newdecl)) @@ -4232,7 +4241,10 @@ finish_decl (tree decl, location_t init_loc, tree init, } if (TREE_USED (type)) - TREE_USED (decl) = 1; + { + TREE_USED (decl) = 1; + DECL_READ_P (decl) = 1; + } } /* If this is a function and an assembler name is specified, reset DECL_RTL @@ -4380,6 +4392,7 @@ finish_decl (tree decl, location_t init_loc, tree init, /* Don't warn about decl unused; the cleanup uses it. */ TREE_USED (decl) = 1; TREE_USED (cleanup_decl) = 1; + DECL_READ_P (decl) = 1; push_cleanup (decl, cleanup, false); } @@ -4472,6 +4485,7 @@ build_compound_literal (location_t loc, tree type, tree init, bool non_const) TREE_STATIC (decl) = (current_scope == file_scope); DECL_CONTEXT (decl) = current_function_decl; TREE_USED (decl) = 1; + DECL_READ_P (decl) = 1; TREE_TYPE (decl) = type; TREE_READONLY (decl) = TYPE_READONLY (type); store_init_value (loc, decl, init, NULL_TREE); @@ -8060,6 +8074,25 @@ finish_function (void) TREE_NO_WARNING (fndecl) = 1; } + /* Complain about parameters that are only set, but never otherwise used. */ + if (warn_unused_but_set_parameter) + { + tree decl; + + for (decl = DECL_ARGUMENTS (fndecl); + decl; + decl = TREE_CHAIN (decl)) + if (TREE_USED (decl) + && TREE_CODE (decl) == PARM_DECL + && !DECL_READ_P (decl) + && DECL_NAME (decl) + && !DECL_ARTIFICIAL (decl) + && !TREE_NO_WARNING (decl)) + warning_at (DECL_SOURCE_LOCATION (decl), + OPT_Wunused_but_set_parameter, + "parameter %qD set but not used", decl); + } + /* Store the end of the function, so that we get good line number info for the epilogue. */ cfun->function_end_locus = input_location; -- cgit v1.2.1 From 15f854771f342ac87910102576494172705ae081 Mon Sep 17 00:00:00 2001 From: pzhao Date: Mon, 12 Apr 2010 03:43:21 +0000 Subject: gcc/ 2010-04-12 Shujing Zhao PR c/36774 * c-decl.c (start_function): Move forward check for nested function. gcc/testsuite/ 2010-04-12 Shujing Zhao PR c/36774 * gcc.dg/pr36774-1.c: New test. * gcc.dg/pr36774-2.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@158214 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/c-decl.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'gcc/c-decl.c') diff --git a/gcc/c-decl.c b/gcc/c-decl.c index bc90fdd38dd..bf8555715b0 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -7443,6 +7443,10 @@ start_function (struct c_declspecs *declspecs, struct c_declarator *declarator, error_mark_node is replaced below (in pop_scope) with the BLOCK. */ DECL_INITIAL (decl1) = error_mark_node; + /* A nested function is not global. */ + if (current_function_decl != 0) + TREE_PUBLIC (decl1) = 0; + /* If this definition isn't a prototype and we had a prototype declaration before, copy the arg type info from that prototype. */ old_decl = lookup_name_in_scope (DECL_NAME (decl1), current_scope); @@ -7543,10 +7547,6 @@ start_function (struct c_declspecs *declspecs, struct c_declarator *declarator, (This does not mean `static' in the C sense!) */ TREE_STATIC (decl1) = 1; - /* A nested function is not global. */ - if (current_function_decl != 0) - TREE_PUBLIC (decl1) = 0; - /* This is the earliest point at which we might know the assembler name of the function. Thus, if it's set before this, die horribly. */ gcc_assert (!DECL_ASSEMBLER_NAME_SET_P (decl1)); -- cgit v1.2.1 From ad086ed471d513856fff3cf8325b8d5e0ee571a4 Mon Sep 17 00:00:00 2001 From: ebotcazou Date: Sun, 18 Apr 2010 21:49:29 +0000 Subject: =?UTF-8?q?2010-04-18=20=C2=A0Eric=20Botcazou=20=C2=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fold-const.c (fold_comparison): Use ssizetype. * gimple-fold.c (maybe_fold_offset_to_array_ref): Likewise. * ipa-prop.c (ipa_modify_call_arguments): Use sizetype. * tree-loop-distribution.c (build_size_arg_loc): Likewise. * tree-object-size.c (compute_object_sizes): Use size_type_node. * tree.h (initialize_sizetypes): Remove parameter. (build_common_tree_nodes): Remove second parameter. * stor-layout.c (initialize_sizetypes): Remove parameter. Always create an unsigned type. (set_sizetype): Assert that the passed type is unsigned and simplify. * tree.c (build_common_tree_nodes): Remove second parameter. Adjust call to initialize_sizetypes. * c-decl.c (c_init_decl_processing): Remove second argument in call to build_common_tree_nodes. cp/ * decl.c (cxx_init_decl_processing): Remove second argument in call to build_common_tree_nodes. java/ * decl.c (java_init_decl_processing): Remove argument in call to initialize_sizetypes fortran/ * f95-lang.c (gfc_init_decl_processing): Remove second argument in call to build_common_tree_nodes. ada/ * gcc-interface/misc.c (gnat_init): Remove second argument in call to build_common_tree_nodes. lto/ * lto-lang.c (lto_init): Remove second argument in call to build_common_tree_nodes. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@158496 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/c-decl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gcc/c-decl.c') diff --git a/gcc/c-decl.c b/gcc/c-decl.c index bf8555715b0..230b4aada94 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -3454,7 +3454,7 @@ c_init_decl_processing (void) using preprocessed headers. */ input_location = BUILTINS_LOCATION; - build_common_tree_nodes (flag_signed_char, false); + build_common_tree_nodes (flag_signed_char); c_common_nodes_and_builtins (); -- cgit v1.2.1 From dcff3217c8608480cbe20b16ccef7da39cec1966 Mon Sep 17 00:00:00 2001 From: steven Date: Wed, 5 May 2010 21:32:44 +0000 Subject: * stor-layout.c (pending_sizes): Change the type to VEC(tree,gc) *. (get_pending_sizes, put_pending_size, put_pending_sizes): Update the uses of pending_sizes. * c-decl.c (store_parm_decls): Likewise. * c-tree.h (struct c_arg_info): Likewise. * tree.h: Update the prototype for get_pending_sizes and put_pending_sizes. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@159085 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/c-decl.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'gcc/c-decl.c') diff --git a/gcc/c-decl.c b/gcc/c-decl.c index 230b4aada94..dd07b6582d8 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -7990,9 +7990,12 @@ store_parm_decls (void) thus won't naturally see the SAVE_EXPR containing the increment. All other pending sizes would be handled by gimplify_parameters. */ { + VEC(tree,gc) *pending_sizes = get_pending_sizes (); tree t; - for (t = nreverse (get_pending_sizes ()); t ; t = TREE_CHAIN (t)) - add_stmt (TREE_VALUE (t)); + int i; + + for (i = 0; VEC_iterate (tree, pending_sizes, i, t); i++) + add_stmt (t); } /* Even though we're inside a function body, we still don't want to -- cgit v1.2.1 From 8af5341f047f26c12d43b721995426f3f177f245 Mon Sep 17 00:00:00 2001 From: jsm28 Date: Sun, 9 May 2010 16:19:28 +0000 Subject: PR c/4784 * c-decl.c (detect_field_duplicates_hash): New. Handle anonymous structures and unions recursively. (detect_field_duplicates): Move duplicate detection with a hash to detect_field_duplicates_hash. Always use a hash if anonymous structures or unions are present. * doc/extend.texi (Unnamed Fields): Document that duplicate fields give errors. testsuite: * gcc.dg/anon-struct-9.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@159204 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/c-decl.c | 48 +++++++++++++++++++++++++++++++++--------------- 1 file changed, 33 insertions(+), 15 deletions(-) (limited to 'gcc/c-decl.c') diff --git a/gcc/c-decl.c b/gcc/c-decl.c index dd07b6582d8..03211d674d7 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -6629,6 +6629,31 @@ grokfield (location_t loc, return value; } +/* Subroutine of detect_field_duplicates: add the fields of FIELDLIST + to HTAB, giving errors for any duplicates. */ + +static void +detect_field_duplicates_hash (tree fieldlist, htab_t htab) +{ + tree x, y; + void **slot; + + for (x = fieldlist; x ; x = TREE_CHAIN (x)) + if ((y = DECL_NAME (x)) != 0) + { + slot = htab_find_slot (htab, y, INSERT); + if (*slot) + { + error ("duplicate member %q+D", x); + DECL_NAME (x) = NULL_TREE; + } + *slot = y; + } + else if (TREE_CODE (TREE_TYPE (x)) == RECORD_TYPE + || TREE_CODE (TREE_TYPE (x)) == UNION_TYPE) + detect_field_duplicates_hash (TYPE_FIELDS (TREE_TYPE (x)), htab); +} + /* Generate an error for any duplicate field names in FIELDLIST. Munge the list such that this does not present a problem later. */ @@ -6647,11 +6672,16 @@ detect_field_duplicates (tree fieldlist) return; do { timeout--; + if (DECL_NAME (x) == NULL_TREE + && (TREE_CODE (TREE_TYPE (x)) == RECORD_TYPE + || TREE_CODE (TREE_TYPE (x)) == UNION_TYPE)) + timeout = 0; x = TREE_CHAIN (x); } while (timeout > 0 && x); - /* If there were "few" fields, avoid the overhead of allocating - a hash table. Instead just do the nested traversal thing. */ + /* If there were "few" fields and no anonymous structures or unions, + avoid the overhead of allocating a hash table. Instead just do + the nested traversal thing. */ if (timeout > 0) { for (x = TREE_CHAIN (fieldlist); x ; x = TREE_CHAIN (x)) @@ -6668,20 +6698,8 @@ detect_field_duplicates (tree fieldlist) else { htab_t htab = htab_create (37, htab_hash_pointer, htab_eq_pointer, NULL); - void **slot; - - for (x = fieldlist; x ; x = TREE_CHAIN (x)) - if ((y = DECL_NAME (x)) != 0) - { - slot = htab_find_slot (htab, y, INSERT); - if (*slot) - { - error ("duplicate member %q+D", x); - DECL_NAME (x) = NULL_TREE; - } - *slot = y; - } + detect_field_duplicates_hash (fieldlist, htab); htab_delete (htab); } } -- cgit v1.2.1 From afb3d3c49fad6249e0b85722105326e9031d9475 Mon Sep 17 00:00:00 2001 From: jsm28 Date: Sat, 15 May 2010 19:07:01 +0000 Subject: * c-decl.c (grokfield): Allow typedefs for anonymous structs and unions by default if those structs and unions have no tags. Do not condition anonymous struct and unions handling on flag_iso. Allow anonymous structs and unions for C1X. (finish_struct): Do not diagnose lack of named fields when anonymous structs and unions present for C1X. Accept flexible array members in structure with anonymous structs or unions but no directly named fields. * doc/extend.texi (Unnamed Fields): Update. testsuite: * gcc.dg/c1x-anon-struct-1.c, gcc.dg/c1x-anon-struct-2.c, gcc.dg/c90-anon-struct-1.c, gcc.dg/c99-anon-struct-1.c: New tests. * gcc.dg/20080820.c, gcc.dg/anon-struct-1.c: Update expected diagnostics and type sizes. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@159439 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/c-decl.c | 33 ++++++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 9 deletions(-) (limited to 'gcc/c-decl.c') diff --git a/gcc/c-decl.c b/gcc/c-decl.c index 03211d674d7..4bec97f1989 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -6567,6 +6567,8 @@ grokfield (location_t loc, Otherwise this is a forward declaration of a structure tag. If this is something of the form "foo;" and foo is a TYPE_DECL, then + If foo names a structure or union without a tag, then this + is an anonymous struct (this is permitted by C1X). If MS extensions are enabled and foo names a structure, then again this is an anonymous struct. Otherwise this is an error. @@ -6580,14 +6582,11 @@ grokfield (location_t loc, || TREE_CODE (type) == UNION_TYPE); bool ok = false; - if (type_ok - && (flag_ms_extensions || !declspecs->typedef_p)) + if (type_ok) { if (flag_ms_extensions) ok = true; - else if (flag_iso) - ok = false; - else if (TYPE_NAME (type) == NULL) + else if (TYPE_NAME (TYPE_MAIN_VARIANT (type)) == NULL) ok = true; else ok = false; @@ -6597,7 +6596,15 @@ grokfield (location_t loc, pedwarn (loc, 0, "declaration does not declare anything"); return NULL_TREE; } - pedwarn (loc, OPT_pedantic, "ISO C doesn%'t support unnamed structs/unions"); + if (!flag_isoc1x) + { + if (flag_isoc99) + pedwarn (loc, OPT_pedantic, + "ISO C99 doesn%'t support unnamed structs/unions"); + else + pedwarn (loc, OPT_pedantic, + "ISO C90 doesn%'t support unnamed structs/unions"); + } } value = grokdeclarator (declarator, declspecs, FIELD, false, @@ -6789,8 +6796,14 @@ finish_struct (location_t loc, tree t, tree fieldlist, tree attributes, if (pedantic) { for (x = fieldlist; x; x = TREE_CHAIN (x)) - if (DECL_NAME (x) != 0) - break; + { + if (DECL_NAME (x) != 0) + break; + if (flag_isoc1x + && (TREE_CODE (TREE_TYPE (x)) == RECORD_TYPE + || TREE_CODE (TREE_TYPE (x)) == UNION_TYPE)) + break; + } if (x == 0) { @@ -6893,7 +6906,9 @@ finish_struct (location_t loc, tree t, tree fieldlist, tree attributes, pedwarn (DECL_SOURCE_LOCATION (x), OPT_pedantic, "invalid use of structure with flexible array member"); - if (DECL_NAME (x)) + if (DECL_NAME (x) + || TREE_CODE (TREE_TYPE (x)) == RECORD_TYPE + || TREE_CODE (TREE_TYPE (x)) == UNION_TYPE) saw_named_field = 1; } -- cgit v1.2.1 From 115133dd5f44ff1bfd39b8186874f43b5c39e370 Mon Sep 17 00:00:00 2001 From: steven Date: Sat, 15 May 2010 20:02:11 +0000 Subject: gcc/ChangeLog * vecir.h: New file with VEC primitives for tree, gimple, and rtl. * Makefile.in: Add it. Fix all other Makefile dependencies for changes below. * tree.h: Include it instead of defining VEC primitives here. * gimple.h: Likewise. * rtl.h: Likewise. * tree-inline.h: Inlclude vecir.h instead of gimple.h. * except.h: Include vecir.h, break dependence on tree.h. * gimplify.c (append_to_statement_list_1, append_to_statement_list): Move from here... * tree-iterator.c: ...to here. * tree-iterator.h: Fix file introduction comment. Add extern markers. * c-lex.c: Include fixed-value.h instead of rtl.h. Do not include tm_p.h. * c-cppbuiltin.c: Explain why debug.h and tm_p.h are included. * c-objc-common.h: Do not include tm.h, rtl.h, insn-config.h, integrate.h, function.h, toplev.h, tree-inline.h, ggc.h, tree-mudflap.h, and target.h. * c-semantics.c: Do not include except.h, ggc.h, rtl.h, timevar.h, predict.h, tree-inline.h, gimple.h, and langhooks.h. * c-decl.c: Do not include expr.h, ggc.h, libfuncs.h, except.h. Add FIXME for why gimple.h is still included (should be unnecessary since GCC 4.5 gimplification unit-at-a-time). * c-typeck.c: Do not include rtl.h, tm_p.h, ggc.h, and gimple.h. * c-pragma.c: Add FIXME for why function.h needs to be included just for cfun, at front-end level. Add note that REGISTER_TARGET_PRAGMAS should probably be a target hook. Do not include ggc.h, but include vecprim.h for VEC(char). * c-opts.c: Do not include tm.h, tree-inline.h, and tm_p.h. Explain why target.h is included. * c-omp.h: Do not include tm.h, function.h, and bitmap.h. Explain why gimple.h is included. * c-ppoutput.c: Do not include tm.h. * c-common.c: Do not include gimple.h. Explain why expr.h is included. * c-parses.c: Explain why rtl.h is included, and that this (and only this) is also why tm.h must be included. Do not include except.h. * c-lang.c: Do not include ggc.h. cp/ChangeLog * decl.c: Include tree-iterator.h, as fixup for tree-inline.h changes. * Make-lang.in: Fix dependencies accordingly. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@159442 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/c-decl.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'gcc/c-decl.c') diff --git a/gcc/c-decl.c b/gcc/c-decl.c index 4bec97f1989..554817f5483 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -38,10 +38,8 @@ along with GCC; see the file COPYING3. If not see #include "flags.h" #include "function.h" #include "output.h" -#include "expr.h" #include "c-tree.h" #include "toplev.h" -#include "ggc.h" #include "tm_p.h" #include "cpplib.h" #include "target.h" @@ -53,17 +51,14 @@ along with GCC; see the file COPYING3. If not see #include "c-lang.h" #include "langhooks.h" #include "tree-mudflap.h" -#include "gimple.h" +#include "gimple.h" /* FIXME: For gimple_set_body and gimple_body, but why? */ #include "tree-iterator.h" #include "diagnostic.h" #include "tree-dump.h" #include "cgraph.h" #include "hashtab.h" -#include "libfuncs.h" -#include "except.h" #include "langhooks-def.h" #include "pointer-set.h" -#include "gimple.h" #include "plugin.h" /* In grokdeclarator, distinguish syntactic contexts of declarators. */ -- cgit v1.2.1 From 49c7f2ee4988aa6be1a2d0735a2e5003aac709bf Mon Sep 17 00:00:00 2001 From: steven Date: Sun, 16 May 2010 07:12:46 +0000 Subject: * c-decl.c: Don't include gimple.h. (merge_decls): Do not copy gimple_body. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@159451 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/c-decl.c | 5 ----- 1 file changed, 5 deletions(-) (limited to 'gcc/c-decl.c') diff --git a/gcc/c-decl.c b/gcc/c-decl.c index 554817f5483..af038e1783a 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -51,7 +51,6 @@ along with GCC; see the file COPYING3. If not see #include "c-lang.h" #include "langhooks.h" #include "tree-mudflap.h" -#include "gimple.h" /* FIXME: For gimple_set_body and gimple_body, but why? */ #include "tree-iterator.h" #include "diagnostic.h" #include "tree-dump.h" @@ -2370,7 +2369,6 @@ merge_decls (tree newdecl, tree olddecl, tree newtype, tree oldtype) DECL_INITIAL (newdecl) = DECL_INITIAL (olddecl); DECL_STRUCT_FUNCTION (newdecl) = DECL_STRUCT_FUNCTION (olddecl); DECL_SAVED_TREE (newdecl) = DECL_SAVED_TREE (olddecl); - gimple_set_body (newdecl, gimple_body (olddecl)); DECL_ARGUMENTS (newdecl) = copy_list (DECL_ARGUMENTS (olddecl)); for (t = DECL_ARGUMENTS (newdecl); t ; t = TREE_CHAIN (t)) DECL_CONTEXT (t) = newdecl; @@ -2412,9 +2410,6 @@ merge_decls (tree newdecl, tree olddecl, tree newtype, tree oldtype) switch (TREE_CODE (olddecl)) { case FUNCTION_DECL: - gimple_set_body (olddecl, gimple_body (newdecl)); - /* fall through */ - case FIELD_DECL: case VAR_DECL: case PARM_DECL: -- cgit v1.2.1 From ce3765bf44e49ef0568a1ad4a0b7f807591d6412 Mon Sep 17 00:00:00 2001 From: jsm28 Date: Sun, 23 May 2010 20:47:16 +0000 Subject: * c-decl.c (diagnose_mismatched_decls): Give error for duplicate typedefs with different but compatible types. Allow duplicate typedefs with the same type except for pedantic non-C1X, but give warning for variably modified types. * c-typeck.c (tagged_types_tu_compatible_p, function_types_compatible_p, type_lists_compatible_p, comptypes_internal): Add parameter different_types_p; set *different_types_p for different but compatible types. All callers changed. (comptypes_check_different_types): New. * c-tree.h (comptypes_check_different_types): Declare. testsuite: * gcc.dg/c1x-typedef-1.c, gcc.dg/c1x-typedef-2.c, gcc.dg/c90-typedef-1.c, gcc.dg/c99-typedef-1.c: New tests. * gcc.dg/decl-8.c: Use -std=gnu89 -pedantic-errors. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@159767 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/c-decl.c | 38 ++++++++++++++++++++++++++++++++++---- 1 file changed, 34 insertions(+), 4 deletions(-) (limited to 'gcc/c-decl.c') diff --git a/gcc/c-decl.c b/gcc/c-decl.c index af038e1783a..68b0f8cd556 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -1786,18 +1786,48 @@ diagnose_mismatched_decls (tree newdecl, tree olddecl, /* Redeclaration of a type is a constraint violation (6.7.2.3p1), but silently ignore the redeclaration if either is in a system - header. (Conflicting redeclarations were handled above.) */ + header. (Conflicting redeclarations were handled above.) This + is allowed for C1X if the types are the same, not just + compatible. */ if (TREE_CODE (newdecl) == TYPE_DECL) { + bool types_different = false; + int comptypes_result; + + comptypes_result + = comptypes_check_different_types (oldtype, newtype, &types_different); + + if (comptypes_result != 1 || types_different) + { + error ("redefinition of typedef %q+D with different type", newdecl); + locate_old_decl (olddecl); + return false; + } + if (DECL_IN_SYSTEM_HEADER (newdecl) || DECL_IN_SYSTEM_HEADER (olddecl) || TREE_NO_WARNING (newdecl) || TREE_NO_WARNING (olddecl)) return true; /* Allow OLDDECL to continue in use. */ - error ("redefinition of typedef %q+D", newdecl); - locate_old_decl (olddecl); - return false; + if (pedantic && !flag_isoc1x) + { + pedwarn (input_location, OPT_pedantic, + "redefinition of typedef %q+D", newdecl); + locate_old_decl (olddecl); + } + else if (variably_modified_type_p (newtype, NULL)) + { + /* Whether there is a constraint violation for the types not + being the same cannot be determined at compile time; a + warning that there may be one at runtime is considered + appropriate (WG14 reflector message 11743, 8 May 2009). */ + warning (0, "redefinition of typedef %q+D may be a constraint " + "violation at runtime", newdecl); + locate_old_decl (olddecl); + } + + return true; } /* Function declarations can either be 'static' or 'extern' (no -- cgit v1.2.1 From cb4070e00ced433c22465def62435fa9eee5a16e Mon Sep 17 00:00:00 2001 From: steven Date: Wed, 26 May 2010 08:36:49 +0000 Subject: gcc/ChangeLog: * rtl.h (decl_default_tls_model): Move prototype from here... * output.h: ...to here. * c-decl.c: Do not include rtl.h. * c-pragma.c: Likewise. * c-parser.c: Likewise. * c-gimplify.c: Likewise. And also not hard-reg-set. * c-common.c: Do not include rtl.h. Include tm_p.h and add a FIXME note for it. Add a FIXME note for expr.h. * config/i386/i386-protos.h (ix86_enum_va_list, ix86_fn_abi_va_list, ix86_canonical_va_list_type): Make visible even if RTX_CODE is not defined. cp/ChangeLog: * decl.c: Do not include rtl.h * semantics.c: Likewise. ada/ChangeLog: * gcc-interface/utils.c: Do not include rtl.h. fortran/ChangeLog: * trans-common.c: Do not include rtl.h, include output.h instead. * trans-decl.c: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@159856 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/c-decl.c | 1 - 1 file changed, 1 deletion(-) (limited to 'gcc/c-decl.c') diff --git a/gcc/c-decl.c b/gcc/c-decl.c index 68b0f8cd556..c4c4a57b94e 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -34,7 +34,6 @@ along with GCC; see the file COPYING3. If not see #include "intl.h" #include "tree.h" #include "tree-inline.h" -#include "rtl.h" #include "flags.h" #include "function.h" #include "output.h" -- cgit v1.2.1 From 6388cfe24f7ecbdc2ba2d4c80638ea6c95ba07c2 Mon Sep 17 00:00:00 2001 From: ktietz Date: Wed, 26 May 2010 16:13:55 +0000 Subject: libiberty/ 2010-05-26 Kai Tietz * testsuite/demangle-expected: Add tests for __int128 and unsigned __int128 types. gcc/testsuite 2010-05-26 Kai Tietz * lib/target-supports.exp (check_effective_target_int128): New function to check if __int128 types are available for target. * testsuite/c-c++-common/int128-types-1.c: New. * testsuite/c-c++-common/int128-1.c: New. * testsuite/c-c++-common/int128-2.c: New. * g++.dg/abi/mangle43.C: New. * g++.dg/init/enum1.C: Handle __int128 case and add -Wno-overflow. * g++.dg/cpp0x/nullptr04.C: Use __SIZE_TYPE__ for getting pointer-wide scalar. * g++.dg/other/pr25632.C: Likewise. * g++.dg/other/large-size-array.C (DIM): Use ULLONG_MAX for win64 case. * g++.dg/warn/pr13358-2.C: Add llp64 for check of special overflow warnings. * g++.dg/warn/pr13358-4.C: Likewise. * g++.dg/warn/Wconversion-null-2.C: Add 'long long' case. * g++.dg/warn/Wconversion-null.C: Likewise. gcc/ 2010-05-26 Kai Tietz * builtin-types.def (BT_INT128): New primitive type. (BT_UINT128): Likewise. * c-common.c (c_common_r): Add __int128 keyword. (c_common_type_for_size): Handle __int128. (c_common_type_for_mode): Likewise. (c_common_signed_or_unsigned_type): Likewise. (c_common_nodes_and_builtins): Add builtin type if target supports 128-bit integer scalar. * c-common.h (enum rid): Add RID_INT128. * c-cppbuiltin.c (c_cpp_builtins): Define __SIZEOF_INT128__ if target supports 128-bit integer scalar. * c-decl.c (declspecs_add_type): Handle new keyword __int128. (finish_declspecs): Likewise. * c-parser.c (c_token_starts_typename): Handle RID_INT128. (c_token_starts_declspecs): Likewise. (c_parser_declspecs): Likewise. (c_parser_attributes): Likewise. (c_parser_objc_selector): Likewise. * c-pretty-print.c (pp_c_integer_constant): Handle __int128. * c-tree.h (enum c_typespec_keyword): Add cts_int128. * gimple.c (gimple_signed_or_unsigned_type): Handle int128 types. * tree.c (make_or_reuse_type): Likewise. (make_unsigned_type): Likewise. (build_common_tree_nodes_2): Likewise. * tree.h (enum integer_type_kind): Add itk_int128 and itk_unsigned_int128. (int128_integer_type_node): New define.. (int128_unsigned_type_node): New define. * cp/cp-tree.h (cp_decl_specifier_seq): Add new bifield explicit_int128_p. * cp/decl.c (grokdeclarator): Handle __int128. * cp/parser.c (cp_lexer_next_token_is_decl_specifier_ke): Likewise. (cp_parser_simple_type_specifier): Likewise. * cp/rtti.c (emit_support_tinfos): Add int128 nodes for rtti. * cp/typeck.c (cp_common_type): Handle __int128. * cp/mangle.c (integer_type_codes): Add itk_int128 and itk_unsigned_int128. * doc/extend.texi: Add documentation about __int128 type. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@159879 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/c-decl.c | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 54 insertions(+), 2 deletions(-) (limited to 'gcc/c-decl.c') diff --git a/gcc/c-decl.c b/gcc/c-decl.c index c4c4a57b94e..96db92d0e39 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -8633,6 +8633,10 @@ declspecs_add_type (location_t loc, struct c_declspecs *specs, error_at (loc, ("both % and % in " "declaration specifiers")); + else if (specs->typespec_word == cts_int128) + error_at (loc, + ("both % and %<__int128%> in " + "declaration specifiers")); else if (specs->typespec_word == cts_bool) error_at (loc, ("both % and %<_Bool%> in " @@ -8670,6 +8674,10 @@ declspecs_add_type (location_t loc, struct c_declspecs *specs, error_at (loc, ("both % and % in " "declaration specifiers")); + else if (specs->typespec_word == cts_int128) + error_at (loc, + ("both % and %<__int128%> in " + "declaration specifiers")); else if (specs->typespec_word == cts_bool) error_at (loc, ("both % and %<_Bool%> in " @@ -8819,7 +8827,13 @@ declspecs_add_type (location_t loc, struct c_declspecs *specs, dupe = specs->saturating_p; pedwarn (loc, OPT_pedantic, "ISO C does not support saturating types"); - if (specs->typespec_word == cts_void) + if (specs->typespec_word == cts_int128) + { + error_at (loc, + ("both %<_Sat%> and %<__int128%> in " + "declaration specifiers")); + } + else if (specs->typespec_word == cts_void) error_at (loc, ("both %<_Sat%> and % in " "declaration specifiers")); @@ -8874,7 +8888,7 @@ declspecs_add_type (location_t loc, struct c_declspecs *specs, else { /* "void", "_Bool", "char", "int", "float", "double", "_Decimal32", - "_Decimal64", "_Decimal128", "_Fract" or "_Accum". */ + "__int128", "_Decimal64", "_Decimal128", "_Fract" or "_Accum". */ if (specs->typespec_word != cts_none) { error_at (loc, @@ -8883,6 +8897,31 @@ declspecs_add_type (location_t loc, struct c_declspecs *specs, } switch (i) { + case RID_INT128: + if (int128_integer_type_node == NULL_TREE) + { + error_at (loc, "%<__int128%> is not supported for this target"); + return specs; + } + if (!in_system_header) + pedwarn (loc, OPT_pedantic, + "ISO C does not support %<__int128%> type"); + + if (specs->long_p) + error_at (loc, + ("both %<__int128%> and % in " + "declaration specifiers")); + else if (specs->saturating_p) + error_at (loc, + ("both %<_Sat%> and %<__int128%> in " + "declaration specifiers")); + else if (specs->short_p) + error_at (loc, + ("both %<__int128%> and % in " + "declaration specifiers")); + else + specs->typespec_word = cts_int128; + return specs; case RID_VOID: if (specs->long_p) error_at (loc, @@ -9355,6 +9394,19 @@ finish_declspecs (struct c_declspecs *specs) specs->type = build_complex_type (specs->type); } break; + case cts_int128: + gcc_assert (!specs->long_p && !specs->short_p && !specs->long_long_p); + gcc_assert (!(specs->signed_p && specs->unsigned_p)); + specs->type = (specs->unsigned_p + ? int128_unsigned_type_node + : int128_integer_type_node); + if (specs->complex_p) + { + pedwarn (input_location, OPT_pedantic, + "ISO C does not support complex integer types"); + specs->type = build_complex_type (specs->type); + } + break; case cts_int: gcc_assert (!(specs->long_p && specs->short_p)); gcc_assert (!(specs->signed_p && specs->unsigned_p)); -- cgit v1.2.1 From 852f689eb9b7f6d7aafc2f72007e96129ac9bd45 Mon Sep 17 00:00:00 2001 From: jsm28 Date: Thu, 27 May 2010 20:16:07 +0000 Subject: * diagnostic-core.h: New. Contents moved from diagnostic.h and toplev.h. * diagnostic.c: Don't include toplev.h. (progname): Define. Moved from toplev.c. (seen_error): New function. * diagnostic.h: Include diagnostic-core.h. (diagnostic_t, emit_diagnostic): Don't declare here. * toplev.c (progname): Move to toplev.c. (emit_debug_global_declarations, compile_file, finalize, do_compile, toplev_main): Use seen_error. * toplev.h: Include diagnostic-core.h. (trim_filename, GCC_DIAG_STYLE, ATTRIBUTE_GCC_DIAG, internal_error, warning, warning_at, error, error_n, error_at, fatal_error, pedwarn, permerror, sorry, inform, inform_n, verbatim, fnotice, progname): Move to diagnostic-core.h. * builtins.c: Include diagnostic-core.h instead of diagnostic.h. (expand_builtin_expect): Use seen_error. * c-decl.c: Include diagnostic-core.h instead of diagnostic.h. (c_make_fname_decl, c_write_global_declarations): Use seen_error. * c-format.c: Include diagnostic-core.h instead of diagnostic.h. * c-gimplify.c: Include diagnostic-core.h instead of diagnostic.h. * c-lang.c: Include diagnostic-core.h instead of diagnostic.h. * c-lex.c (c_lex_with_flags, interpret_float): Don't increment errorcount for errors. * c-opts.c (c_common_finish): Use seen_error. * cgraph.c: Include diagnostic-core.h instead of diagnostic.h. * cgraphunit.c (verify_cgraph_node, verify_cgraph, cgraph_output_pending_asms, cgraph_optimize): Use seen_error. * coverage.c: Include diagnostic-core.h instead of diagnostic.h. (get_coverage_counts): Use seen_error. * dwarf2out.c (dwarf2out_finish): Use seen_error. * gimplify.c (gimplify_var_or_parm_decl, gimple_push_cleanup, gimplify_body): Use seen_error. * ipa-inline.c (cgraph_early_inlining): Use seen_error. * ipa-pure-const.c (gate_pure_const): Use seen_error. * ipa-reference.c (gate_reference): Use seen_error. * jump.c: Include diagnostic-core.h instead of diagnostic.h. * lambda-code.c: Include diagnostic-core.h instead of diagnostic.h. * lto-cgraph.c: Include diagnostic-core.h instead of diagnostic.h. * lto-compress.c: Include diagnostic-core.h instead of diagnostic.h. * lto-section-in.c: Include diagnostic-core.h instead of diagnostic.h. * lto-streamer-out.c: Include diagnostic-core.h instead of diagnostic.h. * lto-streamer.c: Include diagnostic-core.h instead of diagnostic.h. (gate_lto_out): Use seen_error. * matrix-reorg.c: Include diagnostic-core.h instead of diagnostic.h. * omega.c: Include diagnostic-core.h instead of diagnostic.h. * omp-low.c: Include diagnostic-core.h instead of diagnostic.h. (gate_expand_omp, lower_omp_1): Use seen_error. * passes.c: Include diagnostic-core.h instead of diagnostic.h. (rest_of_decl_compilation, rest_of_type_compilation, gate_rest_of_compilation, ipa_write_summaries): Use seen_error. * tree-cfg.c (label_to_block_fn): Use seen_error. * tree-inline.c (optimize_inline_calls): Use seen_error. * tree-mudflap.c (mudflap_finish_file): Use seen_error. * tree-optimize.c (gate_all_optimizations, gate_all_early_local_passes, gate_all_early_optimizations): Use seen_error. * tree-ssa-structalias.c (gate_ipa_pta): Use seen_error. * varpool.c: Include diagnostic-core.h instead of diagnostic.h. (varpool_remove_unreferenced_decls, varpool_assemble_pending_decls): Use seen_error. * Makefile.in (DIAGNOSTIC_CORE_H): Define. (TOPLEV_H, DIAGNOSTIC_H): Update. (c-decl.o, c-lang.o, c-format.o, lto-compress.o, lto-cgraph.o, lto-streamer-out.o, lto-section-in.o, lto-streamer.o, c-gimplify.o, omp-low.o, omega.o, diagnostic.o, passes.o, builtins.o, jump.o, cgraph.o, varpool.o, matrix-reorg.o, coverage.o, lambda-code.o): Update dependencies. cp: * call.c: Include diagnostic-core.h instead of diagnostic.h. * cp-lang.c: Don't include diagnostic.h * name-lookup.c: Include diagnostic-core.h instead of diagnostic.h. (cp_emit_debug_info_for_using): Use seen_error. * optimize.c: Include diagnostic-core.h instead of diagnostic.h. * parser.c: Include diagnostic-core.h instead of diagnostic.h. * pt.c (iterative_hash_template_arg): Use seen_error. * repo.c: Include diagnostic-core.h instead of diagnostic.h. * typeck2.c: Include diagnostic-core.h instead of diagnostic.h. * Make-lang.in (cp/cp-lang.o, cp/typeck2.o, cp/call.o, cp/repo.o, cp/optimize.o, cp/parser.o, cp/name-lookup.o): Update dependencies. lto: * lto.c: Include diagnostic-core.h instead of diagnostic.h. (read_cgraph_and_symbols, lto_main): Use seen_error. * Make-lang.in (lto/lto.o): Update dependencies. objc: * objc-act.c: Include diagnostic-core.h instead of diagnostic.h. * Make-lang.in (objc/objc-act.o): Update dependencies. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@159947 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/c-decl.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'gcc/c-decl.c') diff --git a/gcc/c-decl.c b/gcc/c-decl.c index 96db92d0e39..a49694007d2 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -51,7 +51,7 @@ along with GCC; see the file COPYING3. If not see #include "langhooks.h" #include "tree-mudflap.h" #include "tree-iterator.h" -#include "diagnostic.h" +#include "diagnostic-core.h" #include "tree-dump.h" #include "cgraph.h" #include "hashtab.h" @@ -3535,7 +3535,7 @@ c_make_fname_decl (location_t loc, tree id, int type_dep) the __FUNCTION__ is believed to appear in K&R style function parameter declarator. In that case we still don't have function_scope. */ - && (!errorcount || current_function_scope)) + && (!seen_error () || current_function_scope)) { DECL_CONTEXT (decl) = current_function_decl; bind (id, decl, current_function_scope, @@ -9660,7 +9660,7 @@ c_write_global_declarations (void) /* After cgraph has had a chance to emit everything that's going to be emitted, output debug information for globals. */ - if (errorcount == 0 && sorrycount == 0) + if (!seen_error ()) { timevar_push (TV_SYMOUT); for (t = all_translation_units; t; t = TREE_CHAIN (t)) -- cgit v1.2.1 From 6ad8abad783af88a9591b967932a810347637b4e Mon Sep 17 00:00:00 2001 From: steven Date: Fri, 28 May 2010 23:13:18 +0000 Subject: gcc/ChangeLog: * c-common.h: Add FIXME for awkward split of c_register_addr_space. * c-common.c (c_register_addr_space): Remove here. * c-decl.c (c_register_addr_space): Re-add here. cp/ChangeLog: * tree.c (c_register_addr_space): Add stub. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@160006 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/c-decl.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'gcc/c-decl.c') diff --git a/gcc/c-decl.c b/gcc/c-decl.c index a49694007d2..82632d99345 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -9672,4 +9672,23 @@ c_write_global_declarations (void) ext_block = NULL; } +/* Register reserved keyword WORD as qualifier for address space AS. */ + +void +c_register_addr_space (const char *word, addr_space_t as) +{ + int rid = RID_FIRST_ADDR_SPACE + as; + tree id; + + /* Address space qualifiers are only supported + in C with GNU extensions enabled. */ + if (c_dialect_objc () || flag_no_asm) + return; + + id = get_identifier (word); + C_SET_RID_CODE (id, rid); + C_IS_RESERVED_WORD (id) = 1; + ridpointers [rid] = id; +} + #include "gt-c-decl.h" -- cgit v1.2.1 From f608fcb75792e3f08e9bf909fbfcb00a4c503942 Mon Sep 17 00:00:00 2001 From: charlet Date: Tue, 1 Jun 2010 12:57:57 +0000 Subject: * doc/invoke.texi: Mention -fdump-ada-spec. * tree-dump.c (dump_files): Add ada-spec. (FIRST_AUTO_NUMBERED_DUMP): Bump to 8. * tree-pass.h (tree_dump_index): Add TDI_ada. * gcc.c: Add support for -C without -E and for -fdump-ada-spec. (cpp_unique_options): Do not reject -C or -CC when -E isn't present. (default_compilers) <@c-header>: Allow -fdump-ada-spec on header files. * c-decl.c: Include c-ada-spec.h. (collect_source_ref_cb, collect_all_refs, for_each_global_decl): New functions. (c_write_global_declarations): Add handling of -fdump-ada-spec. * c-lex.c (c_lex_with_flags): Add handling of CPP_COMMENT. * Makefile.in (C_AND_OBJC_OBJS): Add c-ada-spec.o. * c-ada-spec.h, c-ada-spec.c: New files. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@160100 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/c-decl.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) (limited to 'gcc/c-decl.c') diff --git a/gcc/c-decl.c b/gcc/c-decl.c index 82632d99345..cda6ce3ca77 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -58,6 +58,7 @@ along with GCC; see the file COPYING3. If not see #include "langhooks-def.h" #include "pointer-set.h" #include "plugin.h" +#include "c-ada-spec.h" /* In grokdeclarator, distinguish syntactic contexts of declarators. */ enum decl_context @@ -9614,6 +9615,43 @@ c_write_global_declarations_2 (tree globals) debug_hooks->global_decl (decl); } +/* Callback to collect a source_ref from a DECL. */ + +static void +collect_source_ref_cb (tree decl) +{ + if (!DECL_IS_BUILTIN (decl)) + collect_source_ref (LOCATION_FILE (decl_sloc (decl, false))); +} + +/* Collect all references relevant to SOURCE_FILE. */ + +static void +collect_all_refs (const char *source_file) +{ + tree t; + + for (t = all_translation_units; t; t = TREE_CHAIN (t)) + collect_ada_nodes (BLOCK_VARS (DECL_INITIAL (t)), source_file); +} + +/* Iterate over all global declarations and call CALLBACK. */ + +static void +for_each_global_decl (void (*callback) (tree decl)) +{ + tree t; + tree decls; + tree decl; + + for (t = all_translation_units; t; t = TREE_CHAIN (t)) + { + decls = DECL_INITIAL (t); + for (decl = BLOCK_VARS (decls); decl; decl = TREE_CHAIN (decl)) + callback (decl); + } +} + /* Preserve the external declarations scope across a garbage collect. */ static GTY(()) tree ext_block; @@ -9636,6 +9674,18 @@ c_write_global_declarations (void) external_scope = 0; gcc_assert (!current_scope); + /* Handle -fdump-ada-spec[-slim]. */ + if (dump_enabled_p (TDI_ada)) + { + /* Build a table of files to generate specs for */ + if (get_dump_file_info (TDI_ada)->flags & TDF_SLIM) + collect_source_ref (main_input_filename); + else + for_each_global_decl (collect_source_ref_cb); + + dump_ada_specs (collect_all_refs, NULL); + } + if (ext_block) { tree tmp = BLOCK_VARS (ext_block); -- cgit v1.2.1 From 7bedc3a05d34cd81e4835a2d3ff8c0ec7108eeb5 Mon Sep 17 00:00:00 2001 From: steven Date: Sat, 5 Jun 2010 20:33:22 +0000 Subject: gcc/ChangeLog: * c-common.c: Move to c-family/. * c-common.def: Likewise. * c-common.h: Likewise. * c-cppbuiltin.c: Likewise. * c-dump.c: Likewise. * c-format.c: Likewise. * c-format.h : Likewise. * c-gimplify.c: Likewise. * c-lex.c: Likewise. * c-omp.c: Likewise. * c.opt: Likewise. * c-opts.c: Likewise. * c-pch.c: Likewise. * c-ppoutput.c: Likewise. * c-pragma.c: Likewise. * c-pragma.h: Likewise. * c-pretty-print.c: Likewise. * c-pretty-print.h: Likewise. * c-semantics.c: Likewise. * stub-objc.c: Likewise. * gengtype.c (get_file_langdir): Special-case files in c-family/. (get_output_file_with_visibility): Fix name for c-common.h. * c-config-lang.in: Update paths in gtfiles for files in c-family/. * c-tree.h: Update include path for moved files. * c-lang.c: Likewise. * c-lang.h: Likewise. * c-parser.c: Likewise. * c-convert.c: Likewise. * c-decl.c: Likewise. * c-objc-common.c: Likewise. * configure.ac: Make sure c-family/ exists in the build directory. * configure: Regenerate. * Makefile.in: Update paths for moved files. Regroup files per location and update dependencies. Move generated_files down after ALL_GTFILES_H. * config/spu/spu-c.c: Update paths for moved files. * config/mep/mep-pragma.c: Likewise. * config/darwin-c.c: Likewise. * config/i386/msformat-c.c: Likewise. * config/i386/i386-c.c: Likewise. * config/avr/avr-c.c: Likewise. * config/sol2-c.c: Likewise. * config/ia64/ia64-c.c: Likewise. * config/rs6000/rs6000-c.c: Likewise. * config/arm/arm.c: Likewise. * config/arm/arm-c.c: Likewise. * config/h8300/h8300.c: Likewise. * config/v850/v850-c.c: Likewise. * config/t-darwin: Fix dependencies for moved files. * config/t-sol2: Fix dependencies for moved files. * config/mep/t-mep: Fix dependencies for moved files. * config/ia64/t-ia64: Fix dependencies for moved files. * config/rs6000/t-rs6000: Fix dependencies for moved files. * config/v850/t-v850: Fix dependencies for moved files. * config/v850/t-v850e: Fix dependencies for moved files. * config/m32c/m32c-pragma.c * po/exgettext: Look in c-family/ also. c-family/ChangeLog: * c-common.c: Include gt-c-family-c-common.h. * c-pragma.c: Include gt-c-family-c-pragma.h. objc/ChangeLog: * objc-act.c: Update include path for moved files. * objc-lang.c: Likewise. * config-lang.in: Update paths in gtfiles for files in c-family/. objcp/ChangeLog: * objcp-lang.c: Update include path for moved files. * config-lang.in: Update paths in gtfiles for files in c-family/. cp/ChangeLog: * typeck.c: Update include path for moved files. * decl.c: Likewise. * rtti.c: Likewise. * cp-gimplify.c: Likewise. * cp-lang.c: Likewise. * pt.c: Likewise. * semantics.c: Likewise. * cxx-pretty-print.h: Likewise. * decl2.c: Likewise. * parser.c: Likewise. * cp-objcp-common.c: Likewise. * cp-tree.h: Likewise. * name-lookup.c: Likewise. * lex.c: Likewise. * name-lookup.h: Likewise. * config-lang.in: Update paths in gtfiles for files in c-family/. * Make-lang.in: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@160330 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/c-decl.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'gcc/c-decl.c') diff --git a/gcc/c-decl.c b/gcc/c-decl.c index cda6ce3ca77..2485bf44c10 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -45,8 +45,8 @@ along with GCC; see the file COPYING3. If not see #include "debug.h" #include "opts.h" #include "timevar.h" -#include "c-common.h" -#include "c-pragma.h" +#include "c-family/c-common.h" +#include "c-family/c-pragma.h" #include "c-lang.h" #include "langhooks.h" #include "tree-mudflap.h" @@ -58,7 +58,7 @@ along with GCC; see the file COPYING3. If not see #include "langhooks-def.h" #include "pointer-set.h" #include "plugin.h" -#include "c-ada-spec.h" +#include "c-family/c-ada-spec.h" /* In grokdeclarator, distinguish syntactic contexts of declarators. */ enum decl_context -- cgit v1.2.1 From c0c1d342d7e5541730b4dfc57e5fc33568008a06 Mon Sep 17 00:00:00 2001 From: manu Date: Sun, 6 Jun 2010 16:40:18 +0000 Subject: =?UTF-8?q?2010-06-06=20=20Manuel=20L=C3=B3pez-Ib=C3=A1=C3=B1ez=20?= =?UTF-8?q?=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR c/20000 * c-decl.c (grokdeclarator): Delete warning. testsuite/ * c-c++-common/pr20000.c: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@160346 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/c-decl.c | 6 ------ 1 file changed, 6 deletions(-) (limited to 'gcc/c-decl.c') diff --git a/gcc/c-decl.c b/gcc/c-decl.c index 2485bf44c10..96ef2999844 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -5901,12 +5901,6 @@ grokdeclarator (const struct c_declarator *declarator, pedwarn (loc, OPT_pedantic, "ISO C forbids qualified function types"); - /* GNU C interprets a volatile-qualified function type to indicate - that the function does not return. */ - if ((type_quals & TYPE_QUAL_VOLATILE) - && !VOID_TYPE_P (TREE_TYPE (TREE_TYPE (decl)))) - warning_at (loc, 0, "% function returns non-void value"); - /* Every function declaration is an external reference (DECL_EXTERNAL) except for those which are not at file scope and are explicitly declared "auto". This is -- cgit v1.2.1 From ba72912a012b97cad825eebee3f5f22253d0afe4 Mon Sep 17 00:00:00 2001 From: lauras Date: Tue, 8 Jun 2010 07:25:24 +0000 Subject: gcc/ada: 2010-06-08 Laurynas Biveinis * gcc-interface/utils.c (init_gnat_to_gnu): Use typed GC allocation. (init_dummy_type): Likewise. (gnat_pushlevel): Likewise. * gcc-interface/trans.c (Attribute_to_gnu): Likewise. (Subprogram_Body_to_gnu): Likewise. (Compilation_Unit_to_gnu): Likewise. (start_stmt_group): Likewise. (extract_encoding): Likewise. (decode_name): Likewise. * gcc-interface/misc.c (gnat_printable_name): Likewise. * gcc-interface/decl.c (annotate_value): Likewise. * gcc-interface/ada-tree.h (struct lang_type): Add variable_size GTY option. (struct lang_decl): Likewise. (SET_TYPE_LANG_SPECIFIC): Use typed GC allocation. (SET_DECL_LANG_SPECIFIC): Likewise. gcc/c-family: 2010-06-08 Laurynas Biveinis * c-pragma.c (push_alignment): Use typed GC allocation. (handle_pragma_push_options): Likewise. * c-common.c (parse_optimize_options): Likewise. * c-common.h (struct sorted_fields_type): Add variable_size GTY option. gcc/cp: 2010-06-08 Laurynas Biveinis * typeck2.c (abstract_virtuals_error): Likewise. * pt.c (maybe_process_partial_specialization): Likewise. (register_specialization): Likewise. (add_pending_template): Likewise. (lookup_template_class): Likewise. (push_tinst_level): Likewise. * parser.c (cp_lexer_new_main): Likewise. (cp_lexer_new_from_tokens): Likewise. (cp_token_cache_new): Likewise. (cp_parser_context_new): Likewise. (cp_parser_new): Likewise. (cp_parser_nested_name_specifier_opt): Likewise. (cp_parser_template_id): Likewise. * name-lookup.c (binding_entry_make): Likewise. (binding_table_construct): Likewise. (binding_table_new): Likewise. (cxx_binding_make): Likewise. (pushdecl_maybe_friend): Likewise. (begin_scope): Likewise. (push_to_top_level): Likewise. * lex.c (init_reswords): Likewise. (retrofit_lang_decl): Likewise. (cxx_dup_lang_specific_decl): Likewise. (copy_lang_type): Likewise. (cxx_make_type): Likewise. * decl.c (make_label_decl): Likewise. (check_goto): Likewise. (start_preparsed_function): Likewise. (save_function_data): Likewise. * cp-tree.h (TYPE_SET_PTRMEMFUNC_TYPE): Likewise. * cp-objcp-common.c (decl_shadowed_for_var_insert): Likewise. * class.c (finish_struct_1): Likewise. * cp-tree.h (struct lang_type): Add variable_size GTY option. (struct lang_decl): Likewise. * parser.c (cp_parser_new): Update comment to not reference ggc_alloc. gcc/fortran: 2010-06-08 Laurynas Biveinis * trans-types.c (gfc_get_nodesc_array_type): Use typed GC allocation. (gfc_get_array_type_bounds): Likewise. * trans-decl.c (gfc_allocate_lang_decl): Likewise. (gfc_find_module): Likewise. * f95-lang.c (pushlevel): Likewise. * trans.h (struct lang_type): Add variable_size GTY option. (struct lang_decl): Likewise. gcc/java: 2010-06-08 Laurynas Biveinis * jcf-reader.c (jcf_parse_constant_pool): Use typed GC allocation. * jcf-parse.c (java_parse_file): Likewise. (process_zip_dir): Likewise. * java-tree.h (MAYBE_CREATE_VAR_LANG_DECL_SPECIFIC): Likewise. (MAYBE_CREATE_TYPE_TYPE_LANG_SPECIFIC): Likewise. * expr.c (add_type_assertion): Likewise. * decl.c (make_binding_level): Likewise. (java_dup_lang_specific_decl): Likewise. * constants.c (set_constant_entry): Likewise. (cpool_for_class): Likewise. * class.c (add_method_1): Likewise. (java_treetreehash_new): Likewise. * java-tree.h (struct lang_type): Add variable_size GTY option. (struct lang_decl): Likewise. * jch.h (struct cpool_entry): Likewise. * java-tree.h (java_treetreehash_create): Remove parameter ggc. * except.c (prepare_eh_table_type): Update java_treetreehash_create call. * class.c (add_method_1): Update java_treetreehash_create call. (java_treetreehash_create): Remove parameter gc. Use htab_create_ggc. gcc/lto: 2010-06-08 Laurynas Biveinis * lto.c (lto_read_in_decl_state): Use typed GC allocation. (lto_file_read): Likewise. (new_partition): Likewise. (read_cgraph_and_symbols): Likewise. gcc/objc: 2010-06-08 Laurynas Biveinis * objc-act.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Use typed GC allocation. * objc-act.c (objc_volatilize_decl): Likewise. (objc_build_string_object): Likewise. (hash_init): Likewise. (hash_enter): Likewise. (hash_add_attr): Likewise. (add_class): Likewise. (start_class): Likewise. gcc/objcp: 2010-06-08 Laurynas Biveinis * objcp-decl.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Use typed GC allocation. gcc: 2010-06-08 Laurynas Biveinis * doc/tm.texi (Per-Function Data): Do not reference ggc_alloc. * doc/gty.texi (GTY Options): Document typed GC allocation and variable_size GTY option. * ggc-internal.h: New. * ggc.h: Update copyright year. (digit_string): Move to stringpool.c. (ggc_mark_stringpool, ggc_purge_stringpool, ggc_mark_roots) (gt_pch_save_stringpool, gt_pch_fixup_stringpool) (gt_pach_restore_stringpool, gt_pch_p_S, gt_pch_note_object) (init_ggc_pch, ggc_pch_count_object, ggc_pch_total_size) (ggc_pch_this_base, ggc_pch_alloc_object, ggc_pch_prepare_write) (ggc_pch_write_object, ggc_pch_finish, ggc_pch_read) (ggc_force_collect, ggc_get_size, ggc_statistics) (ggc_print_common_statistics): Move to ggc-internal.h. (digit_vector, new_ggc_zone, destroy_ggc_zone, ggc_alloc_stat) (ggc_alloc, ggc_alloc_cleared, ggc_realloc, ggc_calloc, GGC_NEW) (GGC_CNEW, GGC_NEWVEC, GGC_CNEWVEC, GGC_NEWVAR, ggc_alloc_rtvec) (ggc_alloc_tree, gt_pch_save, ggc_min_expand_heuristic) (ggc_min_heapsize_heuristic, ggc_alloc_zone) (ggc_alloc_zone_pass_stat): Remove. (ggc_internal_alloc_stat, ggc_internal_alloc) (ggc_internal_cleared_alloc_stat): New. (GGC_RESIZEVEC, GGC_RESIZEVAR): Redefine. (ggc_internal_vec_alloc_stat) (ggc_internal_cleared_vec_alloc_stat) (ggc_internal_vec_alloc_stat, ggc_internal_cleared_vec_alloc) (ggc_alloc_atomic_stat, ggc_alloc_atomic) (ggc_alloc_cleared_atomic, ggc_cleared_alloc_htab_ignore_args) (ggc_cleared_alloc_ptr_array_two_args): New. (htab_create_ggc, splay_tree_new_ggc): Redefine. (ggc_splay_alloc): Change the type of the first argument to enum gt_types_enum. (ggc_alloc_string): Make macro. (ggc_alloc_string_stat): New. (ggc_strdup): Redefine. (rtl_zone, tree_zone, tree_id_zone): Declare unconditionally. (ggc_alloc_rtvec_sized): New. (ggc_alloc_zone_stat): Rename to ggc_internal_alloc_zone_stat. (ggc_internal_alloc_zone_pass_stat, ggc_internal_alloc_zone_stat) (ggc_internal_cleared_alloc_zone_stat) (ggc_internal_zone_alloc_stat) (ggc_internal_zone_cleared_alloc_stat) (ggc_internal_zone_vec_alloc_stat) (ggc_alloc_zone_rtx_def_stat) (ggc_alloc_zone_tree_node_stat) (ggc_alloc_zone_cleared_tree_node_stat) (ggc_alloc_cleared_gimple_statement_d_stat): New. * ggc-common.c: Include ggc-internal.h. (ggc_internal_cleared_alloc_stat): Rename from ggc_alloc_cleared_stat. (ggc_realloc_stat): Use ggc_internal_alloc_stat. (ggc_calloc): Remove. (ggc_cleared_alloc_htab_ignore_args): New. (ggc_cleared_alloc_ptr_array_two_args): New. (ggc_splay_alloc): Add obj_type parameter. (init_ggc_heuristics): Formatting fixes. * ggc-none.c: Update copyright year. (ggc_alloc_stat): Rename to ggc_alloc_stat. (ggc_alloc_cleared_stat): Rename to ggc_internal_cleared_alloc_stat. (struct alloc_zone, rtl_zone, tree_zone, tree_id_zone): New. * ggc-page.c: Update copyright year. Include ggc-internal.h. Remove references to ggc_alloc in comments. (ggc_alloc_typed_stat): Call ggc_internal_alloc_stat. (ggc_alloc_stat): Rename to ggc_internal_alloc_stat. (new_ggc_zone, destroy_ggc_zone): Remove. (struct alloc_zone, rtl_zone, tree_zone, tree_id_zone): New. * ggc-zone.c: Include ggc-internal.h. Remove references to ggc_alloc in comments. (ggc_alloc_zone_stat): ggc_internal_alloc_zone_stat. (ggc_internal_alloc_zone_pass_stat): New. (ggc_internal_cleared_alloc_zone_stat): New. (ggc_alloc_typed_stat): Use ggc_internal_alloc_zone_pass_stat. (ggc_alloc_stat): Rename ggc_internal_alloc_stat. (new_ggc_zone, destroy_ggc_zone): Remove. * stringpool.c: Update copyright year. Include ggc-internal.h (digit_vector): Make static. (digit_string): Moved from ggc.h. (stringpool_ggc_alloc): Use ggc_alloc_atomic. (ggc_alloc_string): Rename to ggc_alloc_string_stat. * Makefile.in (GGC_INTERNAL_H): New. (ggc_common.o, ggc-page.o, ggc-zone.o, stringpool.o): Add $(GGC_INTERNAL_H) to dependencies. * gentype.c: Update copyright year. (walk_type): Accept variable_size GTY option. (USED_BY_TYPED_GC_P): New macro. (write_enum_defn): Use USED_BY_TYPED_GC_P. Do not output whitespace at the end of strings. (get_type_specifier, variable_size_p): New functions. (alloc_quantity, alloc_zone): New enums. (write_typed_alloc_def): New function. (write_typed_struct_alloc_def): Likewise. (write_typed_typed_typedef_alloc_def): Likewise. (write_typed_alloc_defns): Likewise. (output_typename, write_splay_tree_allocator_def): Likewise. (write_splay_tree_allocators): Likewise. (main): Call write_typed_alloc_defns and write_splay_tree_allocators. * lto-streamer.h (lto_file_decl_data_ptr): New. * passes.c (order): Define using cgraph_node_ptr. * strinpool.c (struct string_pool_data): Declare nested_ptr using ht_identifier_ptr. * gimple.h (union gimple_statement_d): Likewise. * rtl.h (struct rtx_def): Likewise. (struct rtvec_def): Likewise. * tree.h (union tree_node): Likewise. * tree-ssa-operands.h (struct ssa_operand_memory_d): Likewise. * cfgloop.c (record_loop_exits): Use htab_create_ggc. * tree-scalar-evolution.c (scev_initialize): Likewise. * alias.c (record_alias_subset): Update splay_tree_new_ggc call. * dwarf2asm.c (dw2_force_const_mem): Likewise. * omp-low.c (lower_omp_critical): Likewise. * bitmap.h (struct bitmap_head_def): Update comment to not reference ggc_alloc. * config/pa/pa.c (get_deferred_label): Use GGC_RESIZEVEC. * ira.c (fix_reg_equiv_init): Use GGC_RESIZEVEC. * ipa-prop.c (duplicate_ggc_array): Rename to duplicate_ipa_jump_func_array. Use typed GC allocation. (ipa_edge_duplication_hook): Call duplicate_ipa_jump_func_array. * gimple.c (gimple_alloc_stat): Use ggc_alloc_cleared_gimple_statement_d_stat. * varasm.c (create_block_symbol): Use ggc_alloc_zone_rtx_def. * tree.c (make_node_stat): Use ggc_alloc_zone_cleared_tree_node_stat. (make_tree_vec_stat): Likewise. (build_vl_exp_stat): Likewise. (copy_node_stat): Use ggc_alloc_zone_tree_node_stat. (make_tree_binfo_stat): Likewise. (tree_cons_stat): Likewise. * rtl.c (rtx_alloc_stat): Use ggc_alloc_zone_rtx_def_stat. (shallow_copy_rtx_stat): Likewise. (make_node_stat): Likewise. * lto-symtab.c: Fix comment. * tree-cfg.c (create_bb): Update comment to not reference ggc_alloc_cleared. * tree-ssa-structalias.c (struct heapvar_for_stmt): Fix param_is value. * varpool.c (varpool_node): Use typed GC allocation. (varpool_extra_name_alias): Likewise. * varasm.c (emutls_decl): Likewise. (get_unnamed_section): Likewise. (get_noswitch_section): Likewise. (get_section): Likewise. (get_block_for_section): Likewise. (build_constant_desc): Likewise. (create_constant_pool): Likewise. (force_const_mem): Likewise. * tree.c (build_vl_exp_stat): Likewise. (build_real): Likewise. (build_string): Likewise. (decl_debug_expr_insert): Likewise. (decl_value_expr_insert): Likewise. (type_hash_add): Likewise. (build_omp_clause): Likewise. * tree-ssanames.c (duplicate_ssa_name_ptr_info): Likewise. * tree-ssa.c (init_tree_ssa): Likewise. * tree-ssa-structalias.c (heapvar_insert): Likewise. * tree-ssa-operands.c (ssa_operand_alloc): Likewise. * tree-ssa-loop-niter.c (record_estimate): Likewise. * tree-ssa-alias.c (get_ptr_info): Likewise. * tree-scalar-evolution.c (new_scev_info_str): Likewise. * tree-phinodes.c (allocate_phi_node): Likewise. * tree-iterator.c (tsi_link_before): Likewise. (tsi_link_after): Likewise. * tree-eh.c (add_stmt_to_eh_lp_fn): Likewise. * tree-dfa.c (create_var_ann): Likewise. * tree-cfg.c (create_bb): Likewise. * toplev.c (alloc_for_identifier_to_locale): Likewise. (general_init): Likewise. * stringpool.c (stringpool_ggc_alloc): Likewise. (gt_pch_save_stringpool): Likewise. * sese.c (if_region_set_false_region): Likewise. * passes.c (do_per_function_toporder): Likewise. * optabs.c (set_optab_libfunc): Likewise. (set_conv_libfunc): Likewise. * lto-symtab.c (lto_symtab_register_decl): Likewise. * lto-streamer-in.c (lto_input_eh_catch_list): Likewise. (input_eh_region): Likewise. (input_eh_lp): Likewise. (make_new_block): Likewise. (unpack_ts_real_cst_value_fields): Likewise. * lto-section-in.c (lto_new_in_decl_state): Likewise. * lto-cgraph.c (input_node_opt_summary): Likewise. * loop-init.c (loop_optimizer_init): Likewise. * lambda.h (lambda_vector_new): Likewise. * lambda-code.c (replace_uses_equiv_to_x_with_y): Likewise. * ira.c (update_equiv_regs): Likewise. * ipa.c (cgraph_node_set_new): Likewise. (cgraph_node_set_add): Likewise. (varpool_node_set_new): Likewise. (varpool_node_set_add): Likewise. * ipa-prop.c (ipa_compute_jump_functions_for_edge): Likewise. (duplicate_ipa_jump_func_array): Likewise. (ipa_read_node_info): Likewise. * ipa-cp.c (ipcp_create_replace_map): Likewise. * integrate.c (get_hard_reg_initial_val): Likewise. * gimple.c (gimple_alloc_stat): Likewise. (gimple_build_omp_for): Likewise. (gimple_seq_alloc): Likewise. (gimple_copy): Likewise. * gimple-iterator.c (gsi_insert_before_without_update): Likewise. (gsi_insert_after_without_update): Likewise. * function.c (add_frame_space): Likewise. (insert_temp_slot_address): Likewise. (assign_stack_temp_for_type): Likewise. (allocate_struct_function): Likewise. (types_used_by_var_decl_insert): Likewise. * except.c (init_eh_for_function): Likewise. (gen_eh_region): Likewise. (gen_eh_region_catch): Likewise. (gen_eh_landing_pad): Likewise. (add_call_site): Likewise. * emit-rtl.c (get_mem_attrs): Likewise. (get_reg_attrs): Likewise. (start_sequence): Likewise. (init_emit): Likewise. * dwarf2out.c (new_cfi): Likewise. (queue_reg_save): Likewise. (dwarf2out_frame_init): Likewise. (new_loc_descr): Likewise. (find_AT_string): Likewise. (new_die): Likewise. (add_var_loc_to_decl): Likewise. (clone_die): Likewise. (clone_as_declaration): Likewise. (break_out_comdat_types): Likewise. (new_loc_list): Likewise. (loc_descriptor): Likewise. (add_loc_descr_to_each): Likewise. (add_const_value_attribute): Likewise. (tree_add_const_value_attribute): Likewise. (add_comp_dir_attribute): Likewise. (add_name_and_src_coords_attributes): Likewise. (lookup_filename): Likewise. (store_vcall_insn): Likewise. (dwarf2out_init): Likewise. * dbxout.c (dbxout_init): Likewise. * config/xtensa/xtensa.c (xtensa_init_machine_status): Likewise. * config/sparc/sparc.c (sparc_init_machine_status): Likewise. * config/score/score7.c (score7_output_external): Likewise. * config/score/score3.c (score3_output_external): Likewise. * config/s390/s390.c (s390_init_machine_status): Likewise. * config/rs6000/rs6000.c (builtin_function_type): Likewise. (rs6000_init_machine_status): Likewise. (output_toc): Likewise. * config/pa/pa.c (pa_init_machine_status): Likewise. (get_deferred_plabel): Likewise. * config/moxie/moxie.c (moxie_init_machine_status): Likewise. * config/mmix/mmix.c (mmix_init_machine_status): Likewise. * config/mips/mips.c (mflip_mips16_use_mips16_p): Likewise. * config/mep/mep.c (mep_init_machine_status): Likewise. (mep_note_pragma_flag): Likewise. * config/m32c/m32c.c (m32c_init_machine_status): Likewise. * config/iq2000/iq2000.c (iq2000_init_machine_status): Likewise. * config/ia64/ia64.c (ia64_init_machine_status): Likewise. * config/i386/winnt.c (i386_pe_record_external_function): Likewise. (i386_pe_maybe_record_exported_symbol): Likewise. * config/i386/i386.c (get_dllimport_decl): Likewise. (ix86_init_machine_status): Likewise. (assign_386_stack_local): Likewise. * config/frv/frv.c (frv_init_machine_status): Likewise. * config/darwin.c (machopic_indirection_name): Likewise. * config/cris/cris.c (cris_init_machine_status): Likewise. * config/bfin/bfin.c (bfin_init_machine_status): Likewise. * config/avr/avr.c (avr_init_machine_status): Likewise. * config/arm/arm.c (arm_init_machine_status): Likewise. * config/alpha/alpha.c (alpha_init_machine_status): Likewise. (alpha_need_linkage): Likewise. (alpha_use_linkage): Likewise. * cgraph.c (cgraph_allocate_node): Likewise. (cgraph_create_edge_1): Likewise. (cgraph_create_indirect_edge): Likewise. (cgraph_add_asm_node): Likewise. * cfgrtl.c (init_rtl_bb_info): Likewise. * cfgloop.c (alloc_loop): Likewise. (rescan_loop_exit): Likewise. * cfg.c (init_flow): Likewise. (alloc_block): Likewise. (unchecked_make_edge): Likewise. * c-parser.c (c_parse_init): Likewise. (c_parse_file): Likewise. * c-decl.c (bind): Likewise. (record_inline_static): Likewise. (push_scope): Likewise. (make_label): Likewise. (lookup_label_for_goto): Likewise. (finish_struct): Likewise. (finish_enum): Likewise. (c_push_function_context): Likewise. * bitmap.c (bitmap_element_allocate): Likewise. (bitmap_gc_alloc_stat): Likewise. * alias.c (record_alias_subset): Likewise. (init_alias_analysis): Likewise. include: 2010-06-08 Laurynas Biveinis * splay-tree.h: Update copyright years. (splay_tree_s): Document fields. (splay_tree_new_typed_alloc): New. * hashtab.h: Update copyright years. (htab_create_typed_alloc): New. libcpp: 2010-06-08 Laurynas Biveinis * include/symtab.h (ht_identifier_ptr): New. libiberty: 2010-06-08 Laurynas Biveinis * splay-tree.c: Update copyright years. (splay_tree_new_typed_alloc): New. (splay_tree_new_with_allocator): Use it. * hashtab.c: Update copyright years. (htab_create_typed_alloc): New. (htab_create_alloc): Use it. * functions.texi: Regenerate. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@160425 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/c-decl.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'gcc/c-decl.c') diff --git a/gcc/c-decl.c b/gcc/c-decl.c index 96ef2999844..740ca3588f0 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -590,7 +590,7 @@ bind (tree name, tree decl, struct c_scope *scope, bool invisible, binding_freelist = b->prev; } else - b = GGC_NEW (struct c_binding); + b = ggc_alloc_c_binding (); b->shadowed = 0; b->decl = decl; @@ -704,7 +704,7 @@ void record_inline_static (location_t loc, tree func, tree decl, enum c_inline_static_type type) { - struct c_inline_static *csi = GGC_NEW (struct c_inline_static); + struct c_inline_static *csi = ggc_alloc_c_inline_static (); csi->location = loc; csi->function = func; csi->static_decl = decl; @@ -928,7 +928,7 @@ push_scope (void) scope_freelist = scope->outer; } else - scope = GGC_CNEW (struct c_scope); + scope = ggc_alloc_cleared_c_scope (); /* The FLOAT_CONST_DECIMAL64 pragma applies to nested scopes. */ if (current_scope) @@ -3007,7 +3007,7 @@ make_label (location_t location, tree name, bool defining, DECL_CONTEXT (label) = current_function_decl; DECL_MODE (label) = VOIDmode; - label_vars = GGC_NEW (struct c_label_vars); + label_vars = ggc_alloc_c_label_vars (); label_vars->shadowed = NULL; set_spot_bindings (&label_vars->label_bindings, defining); label_vars->decls_in_scope = make_tree_vector (); @@ -3105,7 +3105,7 @@ lookup_label_for_goto (location_t loc, tree name) { struct c_goto_bindings *g; - g = GGC_NEW (struct c_goto_bindings); + g = ggc_alloc_c_goto_bindings (); g->loc = loc; set_spot_bindings (&g->goto_bindings, true); VEC_safe_push (c_goto_bindings_p, gc, label_vars->gotos, g); @@ -6987,9 +6987,9 @@ finish_struct (location_t loc, tree t, tree fieldlist, tree attributes, ensure that this lives as long as the rest of the struct decl. All decls in an inline function need to be saved. */ - space = GGC_CNEW (struct lang_type); - space2 = GGC_NEWVAR (struct sorted_fields_type, - sizeof (struct sorted_fields_type) + len * sizeof (tree)); + space = ggc_alloc_cleared_lang_type (sizeof (struct lang_type)); + space2 = ggc_alloc_sorted_fields_type + (sizeof (struct sorted_fields_type) + len * sizeof (tree)); len = 0; space->s = space2; @@ -7270,7 +7270,7 @@ finish_enum (tree enumtype, tree values, tree attributes) /* Record the min/max values so that we can warn about bit-field enumerations that are too small for the values. */ - lt = GGC_CNEW (struct lang_type); + lt = ggc_alloc_cleared_lang_type (sizeof (struct lang_type)); lt->enum_min = minnode; lt->enum_max = maxnode; TYPE_LANG_SPECIFIC (enumtype) = lt; @@ -8293,7 +8293,7 @@ void c_push_function_context (void) { struct language_function *p; - p = GGC_NEW (struct language_function); + p = ggc_alloc_language_function (); cfun->language = p; p->base.x_stmt_tree = c_stmt_tree; -- cgit v1.2.1 From fc6df01edaec925f81ea043ad7e53bebcc705451 Mon Sep 17 00:00:00 2001 From: jsm28 Date: Sat, 19 Jun 2010 10:42:02 +0000 Subject: 2010-06-19 Philip Herron * c-decl.c (c_write_global_declarations): Don't check flag_syntax_only. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@161024 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/c-decl.c | 5 ----- 1 file changed, 5 deletions(-) (limited to 'gcc/c-decl.c') diff --git a/gcc/c-decl.c b/gcc/c-decl.c index 740ca3588f0..2033a3b1e9f 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -9658,11 +9658,6 @@ c_write_global_declarations (void) if (pch_file) return; - /* Don't waste time on further processing if -fsyntax-only. - Continue for warning and errors issued during lowering though. */ - if (flag_syntax_only) - return; - /* Close the external scope. */ ext_block = pop_scope (); external_scope = 0; -- cgit v1.2.1 From dcf94f3a03fc0326bca41df5004c0ebe04dbb87a Mon Sep 17 00:00:00 2001 From: manu Date: Tue, 13 Jul 2010 01:40:22 +0000 Subject: =?UTF-8?q?2010-07-13=20=20Manuel=20L=C3=B3pez-Ib=C3=A1=C3=B1ez=20?= =?UTF-8?q?=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * c-decl.c (finish_function): Fix typo in comment. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@162121 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/c-decl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gcc/c-decl.c') diff --git a/gcc/c-decl.c b/gcc/c-decl.c index 2033a3b1e9f..73a8dc01aec 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -8054,7 +8054,7 @@ store_parm_decls (void) /* Finish up a function declaration and compile that function - all the way to assembler language output. The free the storage + all the way to assembler language output. Then free the storage for the function definition. This is called after parsing the body of the function definition. */ -- cgit v1.2.1 From 1767a056f10a2ccbc900df04d01193da73a3d272 Mon Sep 17 00:00:00 2001 From: froydnj Date: Thu, 15 Jul 2010 14:31:28 +0000 Subject: gcc/ * tree.h (DECL_CHAIN): Define. * alias.c: Carefully replace TREE_CHAIN with DECL_CHAIN. * c-decl.c: Likewise. * c-parser.c: Likewise. * c-typeck.c: Likewise. * cfgexpand.c: Likewise. * cgraph.c: Likewise. * cgraphunit.c: Likewise. * combine.c: Likewise. * config/alpha/alpha.c: Likewise. * config/arm/arm.c: Likewise. * config/frv/frv.c: Likewise. * config/i386/i386.c: Likewise. * config/i386/winnt-cxx.c: Likewise. * config/ia64/ia64.c: Likewise. * config/iq2000/iq2000.c: Likewise. * config/mep/mep.c: Likewise. * config/mips/mips.c: Likewise. * config/pa/som.h: Likewise. * config/rs6000/rs6000.c: Likewise. * config/s390/s390.c: Likewise. * config/sh/sh.c: Likewise. * config/sh/symbian-cxx.c: Likewise. * config/sparc/sparc.c: Likewise. * config/spu/spu.c: Likewise. * config/stormy16/stormy16.c: Likewise. * config/vxworks.c: Likewise. * config/xtensa/xtensa.c: Likewise. * coverage.c: Likewise. * dbxout.c: Likewise. * dwarf2out.c: Likewise. * emit-rtl.c: Likewise. * expr.c: Likewise. * function.c: Likewise. * gimple-low.c: Likewise. * gimple-pretty-print.c: Likewise. * gimplify.c: Likewise. * integrate.c: Likewise. * ipa-inline.c: Likewise. * ipa-prop.c: Likewise. * ipa-split.c: Likewise. * ipa-struct-reorg.c: Likewise. * ipa-type-escape.c: Likewise. * langhooks.c: Likewise. * lto-cgraph.c: Likewise. * omp-low.c: Likewise. * stor-layout.c: Likewise. * tree-cfg.c: Likewise. * tree-complex.c: Likewise. * tree-dfa.c: Likewise. * tree-dump.c: Likewise. * tree-inline.c: Likewise. * tree-mudflap.c: Likewise. * tree-nested.c: Likewise. * tree-object-size.c: Likewise. * tree-pretty-print.c: Likewise. * tree-sra.c: Likewise. * tree-ssa-live.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-reassoc.c: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-structalias.c: Likewise. * tree-tailcall.c: Likewise. * tree-vrp.c: Likewise. * tree.c: Likewise. * var-tracking.c: Likewise. * varasm.c: Likewise. gcc/ada/ * gcc-interface/decl.c: Carefully replace TREE_CHAIN with DECL_CHAIN. * gcc-interface/trans.c: Likewise. * gcc-interface/utils.c: Likewise. * gcc-interface/utils2.c: Likewise. gcc/c-family/ * c-common.c: Carefully replace TREE_CHAIN with DECL_CHAIN. * c-format.c: Likewise. gcc/cp/ * cp-tree.h: Carefully replace TREE_CHAIN with DECL_CHAIN. * call.c: Likewise. * class.c: Likewise. * cp-gimplify.c: Likewise. * decl.c: Likewise. * decl2.c: Likewise. * init.c: Likewise. * mangle.c: Likewise. * name-lookup.c: Likewise. * optimize.c: Likewise. * parser.c: Likewise. * pt.c: Likewise. * rtti.c: Likewise. * search.c: Likewise. * semantics.c: Likewise. * typeck.c: Likewise. * typeck2.c: Likewise. gcc/fortran/ * f95-lang.c: Carefully replace TREE_CHAIN with DECL_CHAIN. * trans-common.c: Likewise. * trans-decl.c: Likewise. * trans-types.c: Likewise. * trans.c: Likewise. gcc/java/ * java-tree.h: Carefully replace TREE_CHAIN with DECL_CHAIN. * boehm.c: Likewise. * class.c: Likewise. * decl.c: Likewise. * expr.c: Likewise. * jcf-parse.c: Likewise. * typeck.c: Likewise. * verify-glue.c: Likewise. gcc/objc/ * objc-act.c: Carefully replace TREE_CHAIN with DECL_CHAIN. gcc/testsuite/ * g++.dg/plugin/attribute_plugin.c: Carefully replace TREE_CHAIN with DECL_CHAIN. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@162223 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/c-decl.c | 81 ++++++++++++++++++++++++++++++------------------------------ 1 file changed, 41 insertions(+), 40 deletions(-) (limited to 'gcc/c-decl.c') diff --git a/gcc/c-decl.c b/gcc/c-decl.c index 73a8dc01aec..cd56513a66b 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -1076,7 +1076,7 @@ pop_scope (void) { tree file_decl = build_decl (UNKNOWN_LOCATION, TRANSLATION_UNIT_DECL, 0, 0); - TREE_CHAIN (file_decl) = all_translation_units; + DECL_CHAIN (file_decl) = all_translation_units; all_translation_units = file_decl; context = file_decl; } @@ -1100,7 +1100,7 @@ pop_scope (void) warn_for_unused_label (p); /* Labels go in BLOCK_VARS. */ - TREE_CHAIN (p) = BLOCK_VARS (block); + DECL_CHAIN (p) = BLOCK_VARS (block); BLOCK_VARS (block) = p; gcc_assert (I_LABEL_BINDING (b->id) == b); I_LABEL_BINDING (b->id) = b->shadowed; @@ -1188,7 +1188,7 @@ pop_scope (void) binding in the home scope. */ if (!b->nested) { - TREE_CHAIN (p) = BLOCK_VARS (block); + DECL_CHAIN (p) = BLOCK_VARS (block); BLOCK_VARS (block) = p; } else if (VAR_OR_FUNCTION_DECL_P (p)) @@ -1211,7 +1211,7 @@ pop_scope (void) } if (b->locus != UNKNOWN_LOCATION) DECL_SOURCE_LOCATION (extp) = b->locus; - TREE_CHAIN (extp) = BLOCK_VARS (block); + DECL_CHAIN (extp) = BLOCK_VARS (block); BLOCK_VARS (block) = extp; } /* If this is the file scope, and we are processing more @@ -1293,7 +1293,7 @@ push_file_scope (void) start_fname_decls (); - for (decl = visible_builtins; decl; decl = TREE_CHAIN (decl)) + for (decl = visible_builtins; decl; decl = DECL_CHAIN (decl)) bind (DECL_NAME (decl), decl, file_scope, /*invisible=*/false, /*nested=*/true, DECL_SOURCE_LOCATION (decl)); } @@ -2400,7 +2400,7 @@ merge_decls (tree newdecl, tree olddecl, tree newtype, tree oldtype) DECL_STRUCT_FUNCTION (newdecl) = DECL_STRUCT_FUNCTION (olddecl); DECL_SAVED_TREE (newdecl) = DECL_SAVED_TREE (olddecl); DECL_ARGUMENTS (newdecl) = copy_list (DECL_ARGUMENTS (olddecl)); - for (t = DECL_ARGUMENTS (newdecl); t ; t = TREE_CHAIN (t)) + for (t = DECL_ARGUMENTS (newdecl); t ; t = DECL_CHAIN (t)) DECL_CONTEXT (t) = newdecl; /* See if we've got a function to instantiate from. */ @@ -3567,7 +3567,7 @@ c_builtin_function (tree decl) needing to be explicitly declared. See push_file_scope. */ if (name[0] == '_' && (name[1] == '_' || ISUPPER (name[1]))) { - TREE_CHAIN (decl) = visible_builtins; + DECL_CHAIN (decl) = visible_builtins; visible_builtins = decl; } @@ -3593,7 +3593,7 @@ c_builtin_function_ext_scope (tree decl) needing to be explicitly declared. See push_file_scope. */ if (name[0] == '_' && (name[1] == '_' || ISUPPER (name[1]))) { - TREE_CHAIN (decl) = visible_builtins; + DECL_CHAIN (decl) = visible_builtins; visible_builtins = decl; } @@ -4061,7 +4061,7 @@ start_decl (struct c_declarator *declarator, struct c_declspecs *declspecs, if (ce->kind == cdk_function) { tree args = ce->u.arg_info->parms; - for (; args; args = TREE_CHAIN (args)) + for (; args; args = DECL_CHAIN (args)) { tree type = TREE_TYPE (args); if (type && INTEGRAL_TYPE_P (type) @@ -4574,8 +4574,8 @@ flexible_array_type_p (tree type) x = TYPE_FIELDS (type); if (x == NULL_TREE) return false; - while (TREE_CHAIN (x) != NULL_TREE) - x = TREE_CHAIN (x); + while (DECL_CHAIN (x) != NULL_TREE) + x = DECL_CHAIN (x); if (TREE_CODE (TREE_TYPE (x)) == ARRAY_TYPE && TYPE_SIZE (TREE_TYPE (x)) == NULL_TREE && TYPE_DOMAIN (TREE_TYPE (x)) != NULL_TREE @@ -4583,7 +4583,7 @@ flexible_array_type_p (tree type) return true; return false; case UNION_TYPE: - for (x = TYPE_FIELDS (type); x != NULL_TREE; x = TREE_CHAIN (x)) + for (x = TYPE_FIELDS (type); x != NULL_TREE; x = DECL_CHAIN (x)) { if (flexible_array_type_p (TREE_TYPE (x))) return true; @@ -6125,7 +6125,7 @@ grokparms (struct c_arg_info *arg_info, bool funcdef_flag) for (parm = arg_info->parms, typelt = arg_types, parmno = 1; parm; - parm = TREE_CHAIN (parm), typelt = TREE_CHAIN (typelt), parmno++) + parm = DECL_CHAIN (parm), typelt = TREE_CHAIN (typelt), parmno++) { type = TREE_VALUE (typelt); if (type == error_mark_node) @@ -6272,7 +6272,7 @@ get_parm_info (bool ellipsis) else { /* Valid parameter, add it to the list. */ - TREE_CHAIN (decl) = parms; + DECL_CHAIN (decl) = parms; parms = decl; /* Since there is a prototype, args are passed in their @@ -6336,7 +6336,7 @@ get_parm_info (bool ellipsis) gcc_assert (TREE_CODE (decl) == FUNCTION_DECL ? b->nested : !b->nested); - TREE_CHAIN (decl) = others; + DECL_CHAIN (decl) = others; others = decl; /* fall through */ @@ -6659,7 +6659,7 @@ detect_field_duplicates_hash (tree fieldlist, htab_t htab) tree x, y; void **slot; - for (x = fieldlist; x ; x = TREE_CHAIN (x)) + for (x = fieldlist; x ; x = DECL_CHAIN (x)) if ((y = DECL_NAME (x)) != 0) { slot = htab_find_slot (htab, y, INSERT); @@ -6688,7 +6688,7 @@ detect_field_duplicates (tree fieldlist) This is trivially true if there are zero or one fields. */ if (!fieldlist) return; - x = TREE_CHAIN (fieldlist); + x = DECL_CHAIN (fieldlist); if (!x) return; do { @@ -6697,7 +6697,7 @@ detect_field_duplicates (tree fieldlist) && (TREE_CODE (TREE_TYPE (x)) == RECORD_TYPE || TREE_CODE (TREE_TYPE (x)) == UNION_TYPE)) timeout = 0; - x = TREE_CHAIN (x); + x = DECL_CHAIN (x); } while (timeout > 0 && x); /* If there were "few" fields and no anonymous structures or unions, @@ -6705,7 +6705,8 @@ detect_field_duplicates (tree fieldlist) the nested traversal thing. */ if (timeout > 0) { - for (x = TREE_CHAIN (fieldlist); x ; x = TREE_CHAIN (x)) + for (x = TREE_CHAIN (fieldlist); x ; + x = TREE_CHAIN (x)) if (DECL_NAME (x)) { for (y = fieldlist; y != x; y = TREE_CHAIN (y)) @@ -6760,7 +6761,7 @@ warn_cxx_compat_finish_struct (tree fieldlist) ++ix) pointer_set_insert (tset, DECL_NAME (x)); - for (x = fieldlist; x != NULL_TREE; x = TREE_CHAIN (x)) + for (x = fieldlist; x != NULL_TREE; x = DECL_CHAIN (x)) { if (pointer_set_contains (tset, DECL_NAME (x))) { @@ -6809,7 +6810,7 @@ finish_struct (location_t loc, tree t, tree fieldlist, tree attributes, if (pedantic) { - for (x = fieldlist; x; x = TREE_CHAIN (x)) + for (x = fieldlist; x; x = DECL_CHAIN (x)) { if (DECL_NAME (x) != 0) break; @@ -6846,7 +6847,7 @@ finish_struct (location_t loc, tree t, tree fieldlist, tree attributes, until now.) */ saw_named_field = 0; - for (x = fieldlist; x; x = TREE_CHAIN (x)) + for (x = fieldlist; x; x = DECL_CHAIN (x)) { if (TREE_TYPE (x) == error_mark_node) continue; @@ -6901,7 +6902,7 @@ finish_struct (location_t loc, tree t, tree fieldlist, tree attributes, "flexible array member in union"); TREE_TYPE (x) = error_mark_node; } - else if (TREE_CHAIN (x) != NULL_TREE) + else if (DECL_CHAIN (x) != NULL_TREE) { error_at (DECL_SOURCE_LOCATION (x), "flexible array member not at end of struct"); @@ -6954,7 +6955,7 @@ finish_struct (location_t loc, tree t, tree fieldlist, tree attributes, DECL_INITIAL (*fieldlistp) = 0; } else - fieldlistp = &TREE_CHAIN (*fieldlistp); + fieldlistp = &DECL_CHAIN (*fieldlistp); } /* Now we have the truly final field list. @@ -6968,7 +6969,7 @@ finish_struct (location_t loc, tree t, tree fieldlist, tree attributes, { int len = 0; - for (x = fieldlist; x; x = TREE_CHAIN (x)) + for (x = fieldlist; x; x = DECL_CHAIN (x)) { if (len > 15 || DECL_NAME (x) == NULL) break; @@ -6994,7 +6995,7 @@ finish_struct (location_t loc, tree t, tree fieldlist, tree attributes, len = 0; space->s = space2; field_array = &space2->elts[0]; - for (x = fieldlist; x; x = TREE_CHAIN (x)) + for (x = fieldlist; x; x = DECL_CHAIN (x)) { field_array[len++] = x; @@ -7666,7 +7667,7 @@ store_parm_decls_newstyle (tree fndecl, const struct c_arg_info *arg_info) /* Now make all the parameter declarations visible in the function body. We can bypass most of the grunt work of pushdecl. */ - for (decl = arg_info->parms; decl; decl = TREE_CHAIN (decl)) + for (decl = arg_info->parms; decl; decl = DECL_CHAIN (decl)) { DECL_CONTEXT (decl) = current_function_decl; if (DECL_NAME (decl)) @@ -7685,7 +7686,7 @@ store_parm_decls_newstyle (tree fndecl, const struct c_arg_info *arg_info) DECL_ARGUMENTS (fndecl) = arg_info->parms; /* Now make all the ancillary declarations visible, likewise. */ - for (decl = arg_info->others; decl; decl = TREE_CHAIN (decl)) + for (decl = arg_info->others; decl; decl = DECL_CHAIN (decl)) { DECL_CONTEXT (decl) = current_function_decl; if (DECL_NAME (decl)) @@ -7837,10 +7838,10 @@ store_parm_decls_oldstyle (tree fndecl, const struct c_arg_info *arg_info) for (parm = TREE_CHAIN (parm); parm; parm = TREE_CHAIN (parm)) if (TREE_PURPOSE (parm)) { - TREE_CHAIN (last) = TREE_PURPOSE (parm); + DECL_CHAIN (last) = TREE_PURPOSE (parm); last = TREE_PURPOSE (parm); } - TREE_CHAIN (last) = 0; + DECL_CHAIN (last) = 0; } pointer_set_destroy (seen_args); @@ -7856,7 +7857,7 @@ store_parm_decls_oldstyle (tree fndecl, const struct c_arg_info *arg_info) type = current_function_prototype_arg_types; parm || (type && TREE_VALUE (type) != error_mark_node && (TYPE_MAIN_VARIANT (TREE_VALUE (type)) != void_type_node)); - parm = TREE_CHAIN (parm), type = TREE_CHAIN (type)) + parm = DECL_CHAIN (parm), type = TREE_CHAIN (type)) { if (parm == 0 || type == 0 || TYPE_MAIN_VARIANT (TREE_VALUE (type)) == void_type_node) @@ -7947,7 +7948,7 @@ store_parm_decls_oldstyle (tree fndecl, const struct c_arg_info *arg_info) { tree actual = 0, last = 0, type; - for (parm = DECL_ARGUMENTS (fndecl); parm; parm = TREE_CHAIN (parm)) + for (parm = DECL_ARGUMENTS (fndecl); parm; parm = DECL_CHAIN (parm)) { type = tree_cons (NULL_TREE, DECL_ARG_TYPE (parm), NULL_TREE); if (last) @@ -8068,7 +8069,7 @@ finish_function (void) && targetm.calls.promote_prototypes (TREE_TYPE (fndecl))) { tree args = DECL_ARGUMENTS (fndecl); - for (; args; args = TREE_CHAIN (args)) + for (; args; args = DECL_CHAIN (args)) { tree type = TREE_TYPE (args); if (INTEGRAL_TYPE_P (type) @@ -8131,7 +8132,7 @@ finish_function (void) for (decl = DECL_ARGUMENTS (fndecl); decl; - decl = TREE_CHAIN (decl)) + decl = DECL_CHAIN (decl)) if (TREE_USED (decl) && TREE_CODE (decl) == PARM_DECL && !DECL_READ_P (decl) @@ -9567,7 +9568,7 @@ c_write_global_declarations_1 (tree globals) bool reconsider; /* Process the decls in the order they were written. */ - for (decl = globals; decl; decl = TREE_CHAIN (decl)) + for (decl = globals; decl; decl = DECL_CHAIN (decl)) { /* Check for used but undefined static functions using the C standard's definition of "used", and set TREE_NO_WARNING so @@ -9588,12 +9589,12 @@ c_write_global_declarations_1 (tree globals) do { reconsider = false; - for (decl = globals; decl; decl = TREE_CHAIN (decl)) + for (decl = globals; decl; decl = DECL_CHAIN (decl)) reconsider |= wrapup_global_declaration_2 (decl); } while (reconsider); - for (decl = globals; decl; decl = TREE_CHAIN (decl)) + for (decl = globals; decl; decl = DECL_CHAIN (decl)) check_global_declaration_1 (decl); } @@ -9605,7 +9606,7 @@ c_write_global_declarations_2 (tree globals) { tree decl; - for (decl = globals; decl ; decl = TREE_CHAIN (decl)) + for (decl = globals; decl ; decl = DECL_CHAIN (decl)) debug_hooks->global_decl (decl); } @@ -9689,7 +9690,7 @@ c_write_global_declarations (void) /* Process all file scopes in this compilation, and the external_scope, through wrapup_global_declarations and check_global_declarations. */ - for (t = all_translation_units; t; t = TREE_CHAIN (t)) + for (t = all_translation_units; t; t = DECL_CHAIN (t)) c_write_global_declarations_1 (BLOCK_VARS (DECL_INITIAL (t))); c_write_global_declarations_1 (BLOCK_VARS (ext_block)); @@ -9702,7 +9703,7 @@ c_write_global_declarations (void) if (!seen_error ()) { timevar_push (TV_SYMOUT); - for (t = all_translation_units; t; t = TREE_CHAIN (t)) + for (t = all_translation_units; t; t = DECL_CHAIN (t)) c_write_global_declarations_2 (BLOCK_VARS (DECL_INITIAL (t))); c_write_global_declarations_2 (BLOCK_VARS (ext_block)); timevar_pop (TV_SYMOUT); -- cgit v1.2.1 From d059ef79e20f3934e2154bb2f7e0ea899a8ccd0b Mon Sep 17 00:00:00 2001 From: froydnj Date: Fri, 16 Jul 2010 01:30:32 +0000 Subject: * c-decl.c (detect_field_duplicates): Use DECL_CHAIN insted of TREE_CHAIN. * c-typeck.c (push_init_level): Likewise. (process_init_element): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@162239 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/c-decl.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'gcc/c-decl.c') diff --git a/gcc/c-decl.c b/gcc/c-decl.c index cd56513a66b..010421c0b89 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -6705,8 +6705,7 @@ detect_field_duplicates (tree fieldlist) the nested traversal thing. */ if (timeout > 0) { - for (x = TREE_CHAIN (fieldlist); x ; - x = TREE_CHAIN (x)) + for (x = DECL_CHAIN (fieldlist); x; x = DECL_CHAIN (x)) if (DECL_NAME (x)) { for (y = fieldlist; y != x; y = TREE_CHAIN (y)) -- cgit v1.2.1