Re: [Mesa-dev] [PATCH 1/4] util: mark s as MAYBE_UNUSED in _mesa_half_to_unorm8

2018-08-20 Thread Marek Olšák
Reviewed-by: Marek Olšák 

Marek
On Fri, Aug 17, 2018 at 10:41 AM Kai Wasserbäch
 wrote:
>
> Only used, when asserts are enabled.
>
> Fixes an unused-variable warning with gcc-8:
>  ../../../src/util/half_float.c: In function '_mesa_half_to_unorm8':
>  ../../../src/util/half_float.c:189:14: warning: unused variable 's' 
> [-Wunused-variable]
>  const int s = (val >> 15) & 0x1;
>^
>
> Signed-off-by: Kai Wasserbäch 
> ---
>  src/util/half_float.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/src/util/half_float.c b/src/util/half_float.c
> index 2eff2c84f5..63aec5c5c1 100644
> --- a/src/util/half_float.c
> +++ b/src/util/half_float.c
> @@ -28,6 +28,7 @@
>  #include 
>  #include "half_float.h"
>  #include "rounding.h"
> +#include "macros.h"
>
>  typedef union { float f; int32_t i; uint32_t u; } fi_type;
>
> @@ -186,7 +187,7 @@ uint8_t _mesa_half_to_unorm8(uint16_t val)
>  {
> const int m = val & 0x3ff;
> const int e = (val >> 10) & 0x1f;
> -   const int s = (val >> 15) & 0x1;
> +   MAYBE_UNUSED const int s = (val >> 15) & 0x1;
>
> /* v = round_to_nearest(1.mm * 2^(e-15) * 255)
>  *   = round_to_nearest((1.mm * 255) * 2^(e-15))
> --
> 2.18.0
>
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 1/4] util: mark s as MAYBE_UNUSED in _mesa_half_to_unorm8

2018-08-17 Thread Kai Wasserbäch
Only used, when asserts are enabled.

Fixes an unused-variable warning with gcc-8:
 ../../../src/util/half_float.c: In function '_mesa_half_to_unorm8':
 ../../../src/util/half_float.c:189:14: warning: unused variable 's' 
[-Wunused-variable]
 const int s = (val >> 15) & 0x1;
   ^

Signed-off-by: Kai Wasserbäch 
---
 src/util/half_float.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/util/half_float.c b/src/util/half_float.c
index 2eff2c84f5..63aec5c5c1 100644
--- a/src/util/half_float.c
+++ b/src/util/half_float.c
@@ -28,6 +28,7 @@
 #include 
 #include "half_float.h"
 #include "rounding.h"
+#include "macros.h"
 
 typedef union { float f; int32_t i; uint32_t u; } fi_type;
 
@@ -186,7 +187,7 @@ uint8_t _mesa_half_to_unorm8(uint16_t val)
 {
const int m = val & 0x3ff;
const int e = (val >> 10) & 0x1f;
-   const int s = (val >> 15) & 0x1;
+   MAYBE_UNUSED const int s = (val >> 15) & 0x1;
 
/* v = round_to_nearest(1.mm * 2^(e-15) * 255)
 *   = round_to_nearest((1.mm * 255) * 2^(e-15))
-- 
2.18.0

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