Re: [Mesa-dev] [PATCH] intel/compiler: fix return statement warning in brw_regs_negative_equal()

2018-03-29 Thread Ian Romanick
I have a theory about this warning... I'll either have a patch or an R-b
today.

On 03/28/2018 06:48 PM, Brian Paul wrote:
> Silence a gcc warning about missing return value in non-void function.
> For some reason, gcc 5.4.0 (at least) can't deduce that all else/if
> cases return a value.
> ---
>  src/intel/compiler/brw_reg.h | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/src/intel/compiler/brw_reg.h b/src/intel/compiler/brw_reg.h
> index 68158cc..0d2900a 100644
> --- a/src/intel/compiler/brw_reg.h
> +++ b/src/intel/compiler/brw_reg.h
> @@ -302,6 +302,8 @@ brw_regs_negative_equal(const struct brw_reg *a, const 
> struct brw_reg *b)
>  
>return brw_regs_equal(, b);
> }
> +
> +   return false;  /* silence compiler warning */
>  }
>  
>  struct brw_indirect {
> 

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] intel/compiler: fix return statement warning in brw_regs_negative_equal()

2018-03-29 Thread Brian Paul

On 03/29/2018 03:49 AM, Emil Velikov wrote:

Hi Brian,

On 29 March 2018 at 02:48, Brian Paul  wrote:

Silence a gcc warning about missing return value in non-void function.
For some reason, gcc 5.4.0 (at least) can't deduce that all else/if
cases return a value.


A small brain dump:

Guessing that's because of the unreachable() cases at the end of the
if (a->file == IMM) branch.


Yeah, that's what I thought too.  But if I comment out the unreachable() 
statement and put 'return false' in its place, I still get the warning.




Ideally we'll update the macro to make things more obvious for the
compiler. Otherwise we'll have to update dozens of similar instances
through the code base.


I don't think this particular issue is caused by unreachable().

-Brian
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] intel/compiler: fix return statement warning in brw_regs_negative_equal()

2018-03-29 Thread Emil Velikov
Hi Brian,

On 29 March 2018 at 02:48, Brian Paul  wrote:
> Silence a gcc warning about missing return value in non-void function.
> For some reason, gcc 5.4.0 (at least) can't deduce that all else/if
> cases return a value.

A small brain dump:

Guessing that's because of the unreachable() cases at the end of the
if (a->file == IMM) branch.
Ideally we'll update the macro to make things more obvious for the
compiler. Otherwise we'll have to update dozens of similar instances
through the code base.

-Emil
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] intel/compiler: fix return statement warning in brw_regs_negative_equal()

2018-03-28 Thread Brian Paul
Silence a gcc warning about missing return value in non-void function.
For some reason, gcc 5.4.0 (at least) can't deduce that all else/if
cases return a value.
---
 src/intel/compiler/brw_reg.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/intel/compiler/brw_reg.h b/src/intel/compiler/brw_reg.h
index 68158cc..0d2900a 100644
--- a/src/intel/compiler/brw_reg.h
+++ b/src/intel/compiler/brw_reg.h
@@ -302,6 +302,8 @@ brw_regs_negative_equal(const struct brw_reg *a, const 
struct brw_reg *b)
 
   return brw_regs_equal(, b);
}
+
+   return false;  /* silence compiler warning */
 }
 
 struct brw_indirect {
-- 
2.7.4

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev