Commit 2474f48f by Martin Sebor Committed by Martin Sebor

PR c/80892 - -Wfloat-conversion now warns about non-floats

gcc/c-family/ChangeLog:

	PR c/80892
	* c-warn.c (conversion_warning): Use -Wconversion for integer
	conversion and -Wfloat-conversion for floating one.

gcc/testsuite/ChangeLog:

	PR c/80892
	* c-c++-common/Wfloat-conversion-2.c: New test.

From-SVN: r248852
parent eb64690c
2017-06-02 Martin Sebor <msebor@redhat.com>
PR c/80892
* c-warn.c (conversion_warning): Use -Wconversion for integer
conversion and -Wfloat-conversion for floating one.
2017-06-02 Bernd Edlinger <bernd.edlinger@hotmail.de> 2017-06-02 Bernd Edlinger <bernd.edlinger@hotmail.de>
* c.opt (Wsizeof-pointer-div): New warning option. * c.opt (Wsizeof-pointer-div): New warning option.
......
...@@ -1043,10 +1043,19 @@ conversion_warning (location_t loc, tree type, tree expr, tree result) ...@@ -1043,10 +1043,19 @@ conversion_warning (location_t loc, tree type, tree expr, tree result)
"conversion from %qT to to %qT discards imaginary " "conversion from %qT to to %qT discards imaginary "
"component", "component",
expr_type, type); expr_type, type);
else if (conversion_kind == UNSAFE_REAL || conversion_kind) else
warning_at (loc, OPT_Wfloat_conversion, {
"conversion from %qT to %qT may change value", int warnopt;
expr_type, type); if (conversion_kind == UNSAFE_REAL)
warnopt = OPT_Wfloat_conversion;
else if (conversion_kind)
warnopt = OPT_Wconversion;
else
break;
warning_at (loc, warnopt,
"conversion from %qT to %qT may change value",
expr_type, type);
}
} }
} }
......
2017-06-02 Martin Sebor <msebor@redhat.com>
PR c/80892
* c-c++-common/Wfloat-conversion-2.c: New test.
2017-06-02 Paolo Carlini <paolo.carlini@oracle.com> 2017-06-02 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/68754 PR c++/68754
......
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