OSDN Git Service

* c-typeck.c (c_convert_parm_for_inlining): Add argnum, which
authormrs <mrs@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 12 Nov 2003 19:53:17 +0000 (19:53 +0000)
committermrs <mrs@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 12 Nov 2003 19:53:17 +0000 (19:53 +0000)
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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@73507 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/c-tree.h
gcc/c-typeck.c
gcc/langhooks-def.h
gcc/langhooks.c
gcc/langhooks.h
gcc/testsuite/gcc.dg/warn-1.c
gcc/tree-inline.c

index e04a1f7..d3820e4 100644 (file)
@@ -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>
 
index 96faf84..3ba4953 100644 (file)
@@ -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.  */
index fc6dc59..42e4955 100644 (file)
@@ -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)))
index cf24160..6a9f68c 100644 (file)
@@ -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);
 
index a1d60f9..0e4aa22 100644 (file)
@@ -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;
 }
index cb5941f..ce6b7a6 100644 (file)
@@ -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);
 };
 
index 5039abc..9d00801 100644 (file)
@@ -5,14 +5,12 @@
 
 static void foo (p)
      int p;
-{      /* { dg-warning "passing arg of" } */
+{      /* { dg-warning "passing arg of" } */
 }
 
-static void bar (void)
+void bar (void)
 {
   void *vp;
 
   foo (vp);    /* { dg-warning "" } */
 }
-
-void (*tourist_guide[]) (void) = { &bar };
index 23467b9..66f5a82 100644 (file)
@@ -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