Re: [PATCH] Fix -Wenum-compare-switch warning in i386.c.

2019-04-29 Thread Jeff Law
On 3/8/19 5:34 AM, Martin Liška wrote:
> A small patch that deals with:
> gcc/config/i386/i386.c:39427:11:Semantic Issue: comparison of two values with 
> different enumeration types in switch statement ('enum built_in_function' and 
> 'ix86_builtins'): -Wenum-compare-switch
> 
> Is it fine to install it?
> Thanks,
> Martin
> 
> gcc/ChangeLog:
> 
> 2019-03-08  Martin Liska  
> 
>   * config/i386/i386.c (ix86_builtin_reciprocal): Cast
>   DECL_FUNCTION_CODE into ix86_builtins enum before
>   the switch statement.
OK
jeff


Re: [PATCH] Fix -Wenum-compare-switch warning in i386.c.

2019-03-19 Thread Martin Liška
On 3/19/19 3:37 PM, Jeff Law wrote:
> On 3/8/19 5:34 AM, Martin Liška wrote:
>> A small patch that deals with:
>> gcc/config/i386/i386.c:39427:11:Semantic Issue: comparison of two values 
>> with different enumeration types in switch statement ('enum 
>> built_in_function' and 'ix86_builtins'): -Wenum-compare-switch
>>
>> Is it fine to install it?
>> Thanks,
>> Martin
>>
>> gcc/ChangeLog:
>>
>> 2019-03-08  Martin Liska  
>>
>>  * config/i386/i386.c (ix86_builtin_reciprocal): Cast
>>  DECL_FUNCTION_CODE into ix86_builtins enum before
>>  the switch statement.
>> ---
>>  gcc/config/i386/i386.c | 4 +++-
>>  1 file changed, 3 insertions(+), 1 deletion(-)
>>
>>
> Seems trivial, but I'd still defer to gcc-10 unless there's a compelling
> need to address it right now.

I'm fine with application of the patch in next stage1.

Thanks,
Martin

> 
> jeff
> 



Re: [PATCH] Fix -Wenum-compare-switch warning in i386.c.

2019-03-19 Thread Jeff Law
On 3/8/19 5:34 AM, Martin Liška wrote:
> A small patch that deals with:
> gcc/config/i386/i386.c:39427:11:Semantic Issue: comparison of two values with 
> different enumeration types in switch statement ('enum built_in_function' and 
> 'ix86_builtins'): -Wenum-compare-switch
> 
> Is it fine to install it?
> Thanks,
> Martin
> 
> gcc/ChangeLog:
> 
> 2019-03-08  Martin Liska  
> 
>   * config/i386/i386.c (ix86_builtin_reciprocal): Cast
>   DECL_FUNCTION_CODE into ix86_builtins enum before
>   the switch statement.
> ---
>  gcc/config/i386/i386.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> 
Seems trivial, but I'd still defer to gcc-10 unless there's a compelling
need to address it right now.

jeff


[PATCH] Fix -Wenum-compare-switch warning in i386.c.

2019-03-08 Thread Martin Liška
A small patch that deals with:
gcc/config/i386/i386.c:39427:11:Semantic Issue: comparison of two values with 
different enumeration types in switch statement ('enum built_in_function' and 
'ix86_builtins'): -Wenum-compare-switch

Is it fine to install it?
Thanks,
Martin

gcc/ChangeLog:

2019-03-08  Martin Liska  

* config/i386/i386.c (ix86_builtin_reciprocal): Cast
DECL_FUNCTION_CODE into ix86_builtins enum before
the switch statement.
---
 gcc/config/i386/i386.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)


diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 2d6a993238b..f170180304b 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -39424,7 +39424,9 @@ use_rsqrt_p ()
 static tree
 ix86_builtin_reciprocal (tree fndecl)
 {
-  switch (DECL_FUNCTION_CODE (fndecl))
+  enum ix86_builtins fn_code
+= (enum ix86_builtins) DECL_FUNCTION_CODE (fndecl);
+  switch (fn_code)
 {
   /* Vectorized version of sqrt to rsqrt conversion.  */
 case IX86_BUILTIN_SQRTPS_NR: