This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

warning refers to arg 0 for inlining case


The inliner does:

/* Find the initializer. */
value = (*lang_hooks.tree_inlining.convert_parm_for_inlining)
(p, a ? TREE_VALUE (a) : NULL_TREE, fn);

which does:

type = TREE_TYPE (parm);
ret = convert_for_assignment (type, value,
(char *) 0 /* arg passing */, fn,
DECL_NAME (fn), 0);

which does:

else if (codel == INTEGER_TYPE && coder == POINTER_TYPE)
{
warn_for_assignment ("%s makes integer from pointer without a cast",
errtype, funname, parmnum);
return convert (type, rhs);
}

which then prints out a 0 for the argument number. This is bad. The following patch extends the semantics just a little bit so that 0 avoids printing out the argument number.

Ok?

Which tree would you like it in? Before it printed 0, it didn't give any warnings or errors.

*** c-typeck.c.~1~ Fri Sep 27 15:08:53 2002
--- c-typeck.c Thu Oct 24 14:30:34 2002
*************** warn_for_assignment (msgid, opname, func
*** 4313,4319 ****
function = selector;
argnum -= 2;
}
! if (function)
{
/* Function name is known; supply it. */
const char *const argstring = _("passing arg %d of `%s'");
--- 4312,4338 ----
function = selector;
argnum -= 2;
}
! if (argnum == 0)
! {
! if (function)
! {
! /* Function name is known; supply it. */
! const char *const argstring = _("passing arg of `%s'");
! new_opname = (char *) alloca (IDENTIFIER_LENGTH (function)
! + strlen (argstring) + 1
! + 1);
! sprintf (new_opname, argstring,
! IDENTIFIER_POINTER (function));
! }
! else
! {
! /* Function name unknown (call through ptr); just give arg number. */
! const char *const argnofun = _("passing arg of pointer to function");
! new_opname = (char *) alloca (strlen (argnofun) + 1 + 1);
! sprintf (new_opname, argnofun);
! }
! }
! else if (function)
{
/* Function name is known; supply it. */
const char *const argstring = _("passing arg %d of `%s'");
--------------

Radar 3069179.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]