2003-11-06 Mike Stump * c-typeck.c (c_convert_parm_for_inlining): Compute which argumnt we are processing so that warning and errors will have that information. * tree.c (list_member): Add. Doing diffs in .: *** ./c-typeck.c.~1~ Tue Oct 28 16:53:22 2003 --- ./c-typeck.c Wed Nov 5 12:14:17 2003 *************** tree *** 3618,3633 **** c_convert_parm_for_inlining (tree parm, tree value, tree fn) { tree ret, type; /* If FN was prototyped, the value has been converted already in convert_arguments. */ if (! value || TYPE_ARG_TYPES (TREE_TYPE (fn))) return value; type = TREE_TYPE (parm); ret = convert_for_assignment (type, value, (char *) 0 /* arg passing */, fn, ! DECL_NAME (fn), 0); if (targetm.calls.promote_prototypes (TREE_TYPE (fn)) && INTEGRAL_TYPE_P (type) && (TYPE_PRECISION (type) < TYPE_PRECISION (integer_type_node))) --- 3618,3636 ---- c_convert_parm_for_inlining (tree parm, tree value, tree fn) { tree ret, type; + int argnum; /* If FN was prototyped, the value has been converted already in convert_arguments. */ if (! value || TYPE_ARG_TYPES (TREE_TYPE (fn))) return value; + argnum = 1 + list_member (parm, DECL_ARGUMENTS (fn)); + type = TREE_TYPE (parm); ret = convert_for_assignment (type, value, (char *) 0 /* arg passing */, fn, ! DECL_NAME (fn), argnum); if (targetm.calls.promote_prototypes (TREE_TYPE (fn)) && INTEGRAL_TYPE_P (type) && (TYPE_PRECISION (type) < TYPE_PRECISION (integer_type_node))) *** ./testsuite/gcc.dg/warn-1.c.~1~ Mon Apr 28 16:34:40 2003 --- ./testsuite/gcc.dg/warn-1.c Wed Nov 5 15:51:46 2003 *************** *** 5,18 **** static void foo (p) int p; ! { /* { dg-warning "passing arg of" } */ } ! static void bar (void) { void *vp; foo (vp); /* { dg-warning "" } */ } - - void (*tourist_guide[]) (void) = { &bar }; --- 5,16 ---- static void foo (p) int p; ! { /* { dg-warning "passing arg 1 of" } */ } ! void bar (void) { void *vp; foo (vp); /* { dg-warning "" } */ } *** ./tree.c.~1~ Thu Oct 30 11:42:41 2003 --- ./tree.c Wed Nov 5 12:15:19 2003 *************** binfo_member (tree elem, tree list) *** 917,922 **** --- 917,940 ---- return NULL_TREE; } + /* Return the index, starting at 0, of the given element E in list + L, otherwise return -1. */ + + int + list_member (tree e, tree l) + { + int i = 0; + while (1) + { + if (l == e) + return i; + if (l == 0) + return -1; + l = TREE_CHAIN (l); + ++i; + } + } + /* Return nonzero if ELEM is part of the chain CHAIN. */ int *** ./tree.h.~1~ Tue Oct 28 16:53:33 2003 --- ./tree.h Wed Nov 5 12:15:39 2003 *************** extern int simple_cst_equal (tree, tree) *** 2833,2838 **** --- 2833,2839 ---- extern unsigned int iterative_hash_expr (tree, unsigned int); extern int compare_tree_int (tree, unsigned HOST_WIDE_INT); extern int type_list_equal (tree, tree); + extern int list_member (tree, tree); extern int chain_member (tree, tree); extern tree type_hash_lookup (unsigned int, tree); extern void type_hash_add (unsigned int, tree); --------------