diff options
-rw-r--r-- | gcc/ChangeLog | 13 | ||||
-rw-r--r-- | gcc/c-tree.h | 2 | ||||
-rw-r--r-- | gcc/c-typeck.c | 8 | ||||
-rw-r--r-- | gcc/langhooks-def.h | 2 | ||||
-rw-r--r-- | gcc/langhooks.c | 3 | ||||
-rw-r--r-- | gcc/langhooks.h | 2 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/warn-1.c | 6 | ||||
-rw-r--r-- | gcc/tree-inline.c | 8 |
8 files changed, 31 insertions, 13 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e04a1f75969..d3820e46c9f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,16 @@ +2003-11-12 Mike Stump <mrs@apple.com> + + * c-typeck.c (c_convert_parm_for_inlining): Add argnum, which + is the argumnt we are processing so that warnings and errors + will have that information. + * c-tree.h (c_convert_parm_for_inlining): Add argnum. + * lang-hooks-def.h + (lhd_tree_inlining_convert_parm_for_inlining): Likewse. + * langhooks.c (lhd_tree_inlining_convert_parm_for_inlining): Likewise. + * langhooks.h (convert_parm_for_inlining): Likewise. + * tree-inline.c (initialize_inlined_parameters): Compute and + pass argnum down. + 2003-11-12 Alexey Starovoytov <alexey.starovoytov@sun.com> Roger Sayle <roger@eyesopen.com> diff --git a/gcc/c-tree.h b/gcc/c-tree.h index 96faf84ac9b..3ba495395b2 100644 --- a/gcc/c-tree.h +++ b/gcc/c-tree.h @@ -273,7 +273,7 @@ extern tree c_start_case (tree); extern void c_finish_case (void); extern tree simple_asm_stmt (tree); extern tree build_asm_stmt (tree, tree, tree, tree, tree); -extern tree c_convert_parm_for_inlining (tree, tree, tree); +extern tree c_convert_parm_for_inlining (tree, tree, tree, int); /* Set to 0 at beginning of a function definition, set to 1 if a return statement that specifies a return value is seen. */ diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c index fc6dc5952ba..42e495520c5 100644 --- a/gcc/c-typeck.c +++ b/gcc/c-typeck.c @@ -3605,10 +3605,12 @@ convert_for_assignment (tree type, tree rhs, const char *errtype, return error_mark_node; } -/* Convert VALUE for assignment into inlined parameter PARM. */ +/* Convert VALUE for assignment into inlined parameter PARM. ARGNUM + is used for error and waring reporting and indicates which argument + is being processed. */ tree -c_convert_parm_for_inlining (tree parm, tree value, tree fn) +c_convert_parm_for_inlining (tree parm, tree value, tree fn, int argnum) { tree ret, type; @@ -3620,7 +3622,7 @@ c_convert_parm_for_inlining (tree parm, tree value, tree fn) type = TREE_TYPE (parm); ret = convert_for_assignment (type, value, (char *) 0 /* arg passing */, fn, - DECL_NAME (fn), 0); + DECL_NAME (fn), argnum); if (targetm.calls.promote_prototypes (TREE_TYPE (fn)) && INTEGRAL_TYPE_P (type) && (TYPE_PRECISION (type) < TYPE_PRECISION (integer_type_node))) diff --git a/gcc/langhooks-def.h b/gcc/langhooks-def.h index cf241602f44..6a9f68c86f0 100644 --- a/gcc/langhooks-def.h +++ b/gcc/langhooks-def.h @@ -83,7 +83,7 @@ extern tree lhd_tree_inlining_copy_res_decl_for_inlining (tree, tree, tree, extern int lhd_tree_inlining_anon_aggr_type_p (tree); extern int lhd_tree_inlining_start_inlining (tree); extern void lhd_tree_inlining_end_inlining (tree); -extern tree lhd_tree_inlining_convert_parm_for_inlining (tree, tree, tree); +extern tree lhd_tree_inlining_convert_parm_for_inlining (tree, tree, tree, int); extern void lhd_initialize_diagnostics (struct diagnostic_context *); extern tree lhd_callgraph_analyze_expr (tree *, int *, tree); diff --git a/gcc/langhooks.c b/gcc/langhooks.c index a1d60f9ff5e..0e4aa2219a0 100644 --- a/gcc/langhooks.c +++ b/gcc/langhooks.c @@ -420,7 +420,8 @@ lhd_tree_inlining_end_inlining (tree fn ATTRIBUTE_UNUSED) tree lhd_tree_inlining_convert_parm_for_inlining (tree parm ATTRIBUTE_UNUSED, tree value, - tree fndecl ATTRIBUTE_UNUSED) + tree fndecl ATTRIBUTE_UNUSED, + int argnum ATTRIBUTE_UNUSED) { return value; } diff --git a/gcc/langhooks.h b/gcc/langhooks.h index cb5941ff3eb..ce6b7a6b1c7 100644 --- a/gcc/langhooks.h +++ b/gcc/langhooks.h @@ -47,7 +47,7 @@ struct lang_hooks_for_tree_inlining bool (*var_mod_type_p) (tree); int (*start_inlining) (tree); void (*end_inlining) (tree); - tree (*convert_parm_for_inlining) (tree, tree, tree); + tree (*convert_parm_for_inlining) (tree, tree, tree, int); int (*estimate_num_insns) (tree); }; diff --git a/gcc/testsuite/gcc.dg/warn-1.c b/gcc/testsuite/gcc.dg/warn-1.c index 5039abcb8a5..9d0080171d2 100644 --- a/gcc/testsuite/gcc.dg/warn-1.c +++ b/gcc/testsuite/gcc.dg/warn-1.c @@ -5,14 +5,12 @@ static void foo (p) int p; -{ /* { dg-warning "passing arg of" } */ +{ /* { dg-warning "passing arg 1 of" } */ } -static void bar (void) +void bar (void) { void *vp; foo (vp); /* { dg-warning "" } */ } - -void (*tourist_guide[]) (void) = { &bar }; diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c index 23467b9bb9b..66f5a82e484 100644 --- a/gcc/tree-inline.c +++ b/gcc/tree-inline.c @@ -729,9 +729,11 @@ initialize_inlined_parameters (inline_data *id, tree args, tree fn, tree block) #ifdef INLINER_FOR_JAVA tree vars = NULL_TREE; #endif /* INLINER_FOR_JAVA */ + int argnum = 0; /* Figure out what the parameters are. */ - parms = DECL_ARGUMENTS (fn); + parms = +DECL_ARGUMENTS (fn); /* Start with no initializations whatsoever. */ init_stmts = NULL_TREE; @@ -749,9 +751,11 @@ initialize_inlined_parameters (inline_data *id, tree args, tree fn, tree block) tree value; tree var_sub; + ++argnum; + /* Find the initializer. */ value = (*lang_hooks.tree_inlining.convert_parm_for_inlining) - (p, a ? TREE_VALUE (a) : NULL_TREE, fn); + (p, a ? TREE_VALUE (a) : NULL_TREE, fn, argnum); /* If the parameter is never assigned to, we may not need to create a new variable here at all. Instead, we may be able |