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
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 Kazu Hirata <kazu@codesourcery.com> 2006-01-17 Kazu Hirata <kazu@codesourcery.com>
* name-lookup.c (lookup_namespace_name): Remove. * name-lookup.c (lookup_namespace_name): Remove.
...@@ -3694,4 +3700,3 @@ ...@@ -3694,4 +3700,3 @@
PR middle-end/17544 PR middle-end/17544
* decl.c (finish_function): Fix comment. Annotate the compiler * decl.c (finish_function): Fix comment. Annotate the compiler
generated return with the current file name and line 0. generated return with the current file name and line 0.
...@@ -4201,10 +4201,10 @@ convert_like_real (conversion *convs, tree expr, tree fn, int argnum, ...@@ -4201,10 +4201,10 @@ convert_like_real (conversion *convs, tree expr, tree fn, int argnum,
if (ARITHMETIC_TYPE_P (t) && expr == null_node) if (ARITHMETIC_TYPE_P (t) && expr == null_node)
{ {
if (fn) 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); argnum, fn);
else 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. */ /* 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, ...@@ -4212,10 +4212,10 @@ convert_like_real (conversion *convs, tree expr, tree fn, int argnum,
&& TREE_CODE (t) == INTEGER_TYPE) && TREE_CODE (t) == INTEGER_TYPE)
{ {
if (fn) 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); TREE_TYPE (expr), argnum, fn);
else else
warning (0, "converting to %qT from %qT", t, TREE_TYPE (expr)); warning (OPT_Wconversion, "converting to %qT from %qT", t, TREE_TYPE (expr));
} }
} }
......
...@@ -1058,7 +1058,7 @@ build_expr_type_conversion (int desires, tree expr, bool complain) ...@@ -1058,7 +1058,7 @@ build_expr_type_conversion (int desires, tree expr, bool complain)
if (expr == null_node if (expr == null_node
&& (desires & WANT_INT) && (desires & WANT_INT)
&& !(desires & WANT_NULL)) && !(desires & WANT_NULL))
warning (0, "converting NULL to non-pointer type"); warning (OPT_Wconversion, "converting NULL to non-pointer type");
basetype = TREE_TYPE (expr); 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> 2006-01-17 Andrew Pinski <pinskia@physics.uc.edu>
* g++.dg/abi/mangle25.C: Fix dg-do line, add a closing brace. * g++.dg/abi/mangle25.C: Fix dg-do line, add a closing brace.
// PR c++/13932 // PR c++/13932
// { dg-options "-Wconversion" }
int i = 1.; // { dg-warning "converting" } 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-do link }
// { dg-options "-Wconversion" }
#include <cstddef> #include <cstddef>
......
// { dg-do assemble } // { dg-do assemble }
// { dg-options "-Wconversion" }
// Copyright (C) 2000 Free Software Foundation, Inc. // Copyright (C) 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 24 Feb 2000 <nathan@codesourcery.com> // Contributed by Nathan Sidwell 24 Feb 2000 <nathan@codesourcery.com>
...@@ -54,4 +54,3 @@ void fn () ...@@ -54,4 +54,3 @@ void fn ()
punk (); // { dg-warning "" } double to int punk (); // { dg-warning "" } double to int
rock (1); // { dg-warning "" } double to int rock (1); // { dg-warning "" } double to int
} }
// { dg-do assemble } // { dg-do assemble }
// { dg-options "-Wconversion" }
// Copyright (C) 2000 Free Software Foundation, Inc. // Copyright (C) 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 6 Mar 2000 <nathan@codesourcery.com> // Contributed by Nathan Sidwell 6 Mar 2000 <nathan@codesourcery.com>
......
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