| OK?
yes.
| Did you want me to add this as a testcase?
yes -- so that we don't regress.
Ok. apparently I tested in the wrong directory and we already have a
few testcases that test whether we're emitting warnings. I've cleaned
up the testsuite (and added a quick patch to cvt.c to add another
check on OPT_Wconversion), but I'll ask for approval again, because
it's quite a few changes.
So, this ok or would you like me to leave some of the warnings there?
None of them are pedwarns so I'm assuming (based on a quick look
through the standard) that they aren't necessary and can be
conditionalized, but I wanted to double check.
-eric
2006-01-13 Eric Christopher <[EMAIL PROTECTED]>
* call.c (convert_like_real): When issuing conversion
warnings, depend on OPT_Wconversion.
* cvt.c (build_expr_type_conversion): Ditto.
2006-01-13 Eric Christopher <[EMAIL PROTECTED]>
* g++.old-deja/g++.warn/impint.C: Add -Wconversion.
* g++.old-deja/g++.warn/impint2.C: Ditto.
* g++.old-deja/g++.other/null1.C: Ditto.
* g++.dg/warn/conv2.C: Ditto.
Index: gcc/cp/call.c
===================================================================
--- gcc/cp/call.c (revision 109692)
+++ gcc/cp/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));
}
}
Index: gcc/cp/cvt.c
===================================================================
--- gcc/cp/cvt.c (revision 109692)
+++ gcc/cp/cvt.c (working copy)
@@ -1058,7 +1058,7 @@ build_expr_type_conversion (int desires,
if (expr == null_node
&& (desires & WANT_INT)
&& !(desires & WANT_NULL))
- warning (0, "converting NULL to non-pointer type");
+ warning (OPT_Wconversion, "converting NULL to non-pointer type");
basetype = TREE_TYPE (expr);
Index: gcc/testsuite/g++.old-deja/g++.warn/impint.C
===================================================================
--- gcc/testsuite/g++.old-deja/g++.warn/impint.C (revision 109692)
+++ gcc/testsuite/g++.old-deja/g++.warn/impint.C (working copy)
@@ -1,5 +1,5 @@
// { dg-do assemble }
-
+// { dg-options "-Wconversion" }
// Copyright (C) 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 24 Feb 2000 <[EMAIL PROTECTED]>
@@ -54,4 +54,3 @@ void fn ()
punk (); // { dg-warning "" } double to int
rock (1); // { dg-warning "" } double to int
}
-
Index: gcc/testsuite/g++.old-deja/g++.warn/impint2.C
===================================================================
--- gcc/testsuite/g++.old-deja/g++.warn/impint2.C (revision 109692)
+++ gcc/testsuite/g++.old-deja/g++.warn/impint2.C (working copy)
@@ -1,4 +1,5 @@
// { dg-do assemble }
+// { dg-options "-Wconversion" }
// Copyright (C) 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 6 Mar 2000 <[EMAIL PROTECTED]>
Index: gcc/testsuite/g++.old-deja/g++.other/null1.C
===================================================================
--- gcc/testsuite/g++.old-deja/g++.other/null1.C (revision 109692)
+++ gcc/testsuite/g++.old-deja/g++.other/null1.C (working copy)
@@ -1,4 +1,5 @@
// { dg-do link }
+// { dg-options "-Wconversion" }
#include <cstddef>
Index: gcc/testsuite/g++.dg/warn/conv2.C
===================================================================
--- gcc/testsuite/g++.dg/warn/conv2.C (revision 109692)
+++ gcc/testsuite/g++.dg/warn/conv2.C (working copy)
@@ -1,3 +1,4 @@
// PR c++/13932
+// { dg-options "-Wconversion" }
int i = 1.; // { dg-warning "converting" }