Commit aa7349eb by Eric Christopher

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

2006-01-17  Eric Christopher  <echristo@apple.com>

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

2006-01-17  Eric Christopher  <echristo@apple.com>

        * 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.
        * g++.dg/warn/conv4.C: New file.

From-SVN: r109847
parent ef7befe0
......@@ -1204,7 +1204,7 @@ reference_binding (tree rto, tree rfrom, tree expr, int flags)
if (related_p && !at_least_as_qualified_p (to, from))
return NULL;
conv = implicit_conversion (to, from, expr, /*c_cast_p=*/false,
conv = implicit_conversion (to, from, expr, /*c_cast_p=*/false,
flags);
if (!conv)
return NULL;
......@@ -1393,7 +1393,7 @@ add_function_candidate (struct z_candidate **candidates,
parmtype = build_pointer_type (parmtype);
}
t = implicit_conversion (parmtype, argtype, arg,
t = implicit_conversion (parmtype, argtype, arg,
/*c_cast_p=*/false, flags);
}
else
......@@ -1472,7 +1472,7 @@ add_conv_candidate (struct z_candidate **candidates, tree fn, tree obj,
else if (parmnode == void_list_node)
break;
else if (parmnode)
t = implicit_conversion (TREE_VALUE (parmnode), argtype, arg,
t = implicit_conversion (TREE_VALUE (parmnode), argtype, arg,
/*c_cast_p=*/false, flags);
else
{
......@@ -1527,7 +1527,7 @@ build_builtin_candidate (struct z_candidate **candidates, tree fnname,
if (! args[i])
break;
t = implicit_conversion (types[i], argtypes[i], args[i],
t = implicit_conversion (types[i], argtypes[i], args[i],
/*c_cast_p=*/false, flags);
if (! t)
{
......@@ -1545,7 +1545,7 @@ build_builtin_candidate (struct z_candidate **candidates, tree fnname,
{
convs[2] = convs[1];
convs[1] = convs[0];
t = implicit_conversion (boolean_type_node, argtypes[2], args[2],
t = implicit_conversion (boolean_type_node, argtypes[2], args[2],
/*c_cast_p=*/false, flags);
if (t)
convs[0] = t;
......@@ -2605,7 +2605,7 @@ build_user_type_conversion_1 (tree totype, tree expr, int flags)
conversion *ics
= implicit_conversion (totype,
TREE_TYPE (TREE_TYPE (cand->fn)),
0,
0,
/*c_cast_p=*/false, convflags);
cand->second_conv = ics;
......@@ -4201,10 +4201,10 @@ convert_like_real (conversion *convs, tree expr, tree fn, int argnum,
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, tree expr, tree fn, int argnum,
&& 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));
}
}
......@@ -5273,7 +5273,7 @@ build_new_method_call (tree instance, tree fns, tree args,
orig_fns = fns;
orig_args = args;
/* Dismantle the baselink to collect all the information we need. */
/* Dismantle the baselink to collect all the information we need. */
if (!conversion_path)
conversion_path = BASELINK_BINFO (fns);
access_binfo = BASELINK_ACCESS_BINFO (fns);
......@@ -6302,7 +6302,7 @@ can_convert_arg (tree to, tree from, tree arg, int flags)
/* Get the high-water mark for the CONVERSION_OBSTACK. */
p = conversion_obstack_alloc (0);
t = implicit_conversion (to, from, arg, /*c_cast_p=*/false,
t = implicit_conversion (to, from, arg, /*c_cast_p=*/false,
flags);
ok_p = (t && !t->bad_p);
......
......@@ -1058,7 +1058,7 @@ build_expr_type_conversion (int desires, tree expr, bool complain)
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);
......
2006-01-17 Eric Christopher <echristo@apple.com>
* 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.
* g++.dg/warn/conv4.C: New file.
2006-01-17 Andrew Pinski <pinskia@physics.uc.edu>
* g++.dg/abi/mangle25.C: Fix dg-do line, add a closing brace.
......@@ -90,7 +98,7 @@
2006-01-16 Ben Elliston <bje@au.ibm.com>
* gcc.dg/dfp/dfp.exp: Correct FSF address.
* gcc.dg/dfp/dfp.exp: Correct FSF address.
* gcc.misc-tests/dectest.exp: Ditto.
2006-01-15 Ian Lance Taylor <ian@airs.com>
......@@ -250,7 +258,7 @@
gcc.dg/dfp/operator-unary.c, gcc.dg/dfp/altivec-types.c,
gcc.dg/dfp/cast.c, gcc.dg/dfp/typespec.c,
gcc.dg/dfp/wtr-conversion-1.c: New tests.
2006-01-11 Richard Guenther <rguenther@suse.de>
PR tree-optimization/25734
......@@ -275,7 +283,7 @@
* gcc.dg/torture/pr25706-1.c: New test.
2006-01-11 Paolo Bonzini <bonzini@gnu.org>
PR tree-optimization/23109
PR tree-optimization/23948
PR tree-optimization/24123
......@@ -630,7 +638,7 @@
2005-12-27 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* g++.dg/rtti/tinfo1.C: Scan for ".global" also.
PR testsuite/25442
* gcc.dg/ipa/ipa-1.c, gcc.dg/ipa/ipa-2.c, gcc.dg/ipa/ipa-3.c,
gcc.dg/ipa/ipa-4.c, gcc.dg/ipa/ipa-5.c: Skip if -fpic/-fPIC.
// PR c++/13932
// { dg-options "-Wconversion" }
int i = 1.; // { dg-warning "converting" }
// { dg-do compile }
// This file should compile cleanly by default and not warn on the conversions.
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;
}
// { dg-do link }
// { dg-options "-Wconversion" }
#include <cstddef>
......
// { dg-do assemble }
// { dg-options "-Wconversion" }
// Copyright (C) 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 24 Feb 2000 <nathan@codesourcery.com>
......@@ -37,21 +37,20 @@ void fn ()
int k1 = 3.5; // { dg-warning "" } double to int
int k2 = 3.5f; // { dg-warning "" } float to int
j1 = 3.5; // { dg-warning "" } double to int
j2 = 3.5f; // { dg-warning "" } float to int
foo (3.5); // { dg-warning "" } double to int
foo (3.5f); // { dg-warning "" } float to int
wibble (3.5); // { dg-warning "" } double to int
wibble (3.5f); // { dg-warning "" } float to int
wibble (1, 3.5); // { dg-warning "" } double to int
wibble (1, 3.5f); // { dg-warning "" } float to int
wibble (3.5, 1); // { dg-warning "" } double to int
wibble (3.5f, 1); // { dg-warning "" } float to int
punk (); // { dg-warning "" } double to int
rock (1); // { dg-warning "" } double to int
}
// { dg-do assemble }
// { dg-options "-Wconversion" }
// Copyright (C) 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 6 Mar 2000 <nathan@codesourcery.com>
......@@ -31,15 +32,15 @@ void fn ()
int j2 (3.5f); // { dg-warning "" } float to int
int k2 = 3.5f; // { dg-warning "" } float to int
j2 = 3.5f; // { dg-warning "" } float to int
foo (3.5f); // { dg-warning "" } float to int
wibble (3.5f); // { dg-warning "" } float to int
wibble (1, 3.5f); // { dg-warning "" } float to int
wibble (3.5f, 1); // { dg-warning "" } float to int
punk (); // { dg-warning "" } float to int
rock (1); // { dg-warning "" } float to int
}
......@@ -56,13 +57,13 @@ void foo ()
int j2 (-1);
int k2 = -1;
j2 = -1;
foo (-1);
wibble (-1);
wibble (-1);
wibble (1, -1);
wibble (-1, 1);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment