-Wconversion is a good idea.  I don't think -Wtraditional is relevant.

Here's the patch to implement it. Avoids the warning in this testcase when -Wconversion is not passed on the command line:

int func1(int i)
{
  return i;
}

int main()
{
  float f;
  long l;
  unsigned long ul;

  f = 1.5f;

  l = f;
  ul = -1;
  func1(f);

  return 0;
}


OK? Did you want me to add this as a testcase? If so, would you like me to check that it compiles silently by default or that -Wconversion turns the warnings on? :)

-eric

2006-01-12  Eric Christopher  <[EMAIL PROTECTED]>

        * call.c (convert_like_real): When issuing conversion
        warnings, depend on OPT_Wconversion.

Index: call.c
===================================================================
--- call.c      (revision 109649)
+++ call.c      (working copy)
@@ -4201,10 +4201,10 @@ convert_like_real (conversion *convs, tr
       if (ARITHMETIC_TYPE_P (t) && expr == null_node)
        {
          if (fn)
-           warning (0, "passing NULL to non-pointer argument %P of %qD",
+           warning (OPT_Wconversion, "passing NULL to non-pointer argument %P 
of %qD",
                     argnum, fn);
          else
-           warning (0, "converting to non-pointer type %qT from NULL", t);
+           warning (OPT_Wconversion, "converting to non-pointer type %qT from 
NULL", t);
        }
 
       /* Warn about assigning a floating-point type to an integer type.  */
@@ -4212,10 +4212,10 @@ convert_like_real (conversion *convs, tr
          && TREE_CODE (t) == INTEGER_TYPE)
        {
          if (fn)
-           warning (0, "passing %qT for argument %P to %qD",
+           warning (OPT_Wconversion, "passing %qT for argument %P to %qD",
                     TREE_TYPE (expr), argnum, fn);
          else
-           warning (0, "converting to %qT from %qT", t, TREE_TYPE (expr));
+           warning (OPT_Wconversion, "converting to %qT from %qT", t, 
TREE_TYPE (expr));
        }
     }
 

Reply via email to