Re: [google/gcc-4_8] Port -Wreal-conversion warning

2013-06-26 Thread Xinliang David Li
The warn_type should also be guarded with float type check: warn_type = (warn_real_conversion (FLOAT_TYPE_P (type) || FLOAT_TYPE_P (expr_type))) ? OPT_Wreal_conversion : OPT_Wconversion; Also why did you put the warn_type code inside the default? David On Mon, Jun 24, 2013 at 10:03 PM,

Re: [google/gcc-4_8] Port -Wreal-conversion warning

2013-06-26 Thread Sharad Singhai
Sorry, my port was bad. I am going to revert this patch and redo it. Thanks, Sharad On Wed, Jun 26, 2013 at 4:03 PM, Xinliang David Li davi...@google.com wrote: The warn_type should also be guarded with float type check: warn_type = (warn_real_conversion (FLOAT_TYPE_P (type) ||

Re: [google/gcc-4_8] Port -Wreal-conversion warning

2013-06-26 Thread Sharad Singhai
I reverted the earlier broken patch. I am including an updated patch which warns only for real conversion, not for integral conversions. I also updated the test case to include an integral conversion (int to char) which doesn't emit the warning with the -Wreal-conversion flag. Bootstrapped and

Re: [google/gcc-4_8] Port -Wreal-conversion warning

2013-06-26 Thread Xinliang David Li
Ok. David On Wed, Jun 26, 2013 at 10:16 PM, Sharad Singhai sing...@google.com wrote: I reverted the earlier broken patch. I am including an updated patch which warns only for real conversion, not for integral conversions. I also updated the test case to include an integral conversion (int to

[google/gcc-4_8] Port -Wreal-conversion warning

2013-06-24 Thread Sharad Singhai
Hi, This patch forward ports the -Wreal-conversion warning to google/gcc-4_8 branch (google ref 39133-p2). I tweaked the patch a little bit to avoid printing duplicate warnings when both -Wconversion and -Wreal-conversion are specified. Also, I trimmed the test case to avoid testing for

Re: [google/gcc-4_8] Port -Wreal-conversion warning

2013-06-24 Thread Xinliang David Li
To avoid printing twice, can you just do opt_type = (warn_conversion ? OPT_Wconversion : OPT_Wreal_conversion); warning_at (loc, opt_type, ...); David On Mon, Jun 24, 2013 at 6:08 PM, Sharad Singhai sing...@google.com wrote: Hi, This patch forward ports the -Wreal-conversion warning to

Re: [google/gcc-4_8] Port -Wreal-conversion warning

2013-06-24 Thread Sharad Singhai
On Mon, Jun 24, 2013 at 9:14 PM, Xinliang David Li davi...@google.com wrote: To avoid printing twice, can you just do opt_type = (warn_conversion ? OPT_Wconversion : OPT_Wreal_conversion); warning_at (loc, opt_type, ...); Thanks for the suggestion. I have updated the enclosed patch and

Re: [google/gcc-4_8] Port -Wreal-conversion warning

2013-06-24 Thread Xinliang David Li
ok. David On Mon, Jun 24, 2013 at 10:03 PM, Sharad Singhai sing...@google.com wrote: On Mon, Jun 24, 2013 at 9:14 PM, Xinliang David Li davi...@google.com wrote: To avoid printing twice, can you just do opt_type = (warn_conversion ? OPT_Wconversion : OPT_Wreal_conversion); warning_at (loc,