[Mesa-dev] [PATCH] isl: Fix some tautological-compare warnings

Anuj Phogat anuj.phogat at gmail.com
Thu May 26 21:42:53 UTC 2016


On Thu, May 26, 2016 at 11:59 AM, Ben Widawsky
<benjamin.widawsky at intel.com> wrote:
> Fixes:
> isl.c:62:22: warning: self-comparison always evaluates to true [-Wtautological-compare]
>     assert(ISL_DEV_GEN(dev) == dev->info->gen);
>                       ^~
> isl.c:63:33: warning: self-comparison always evaluates to true [-Wtautological-compare]
>     assert(ISL_DEV_USE_SEPARATE_STENCIL(dev) == dev->use_separate_stencil);
>
> Signed-off-by: Ben Widawsky <ben at bwidawsk.net>
> ---
>  src/intel/isl/isl.c | 4 ++--
>  src/intel/isl/isl.h | 8 ++++++++
>  2 files changed, 10 insertions(+), 2 deletions(-)
>
> diff --git a/src/intel/isl/isl.c b/src/intel/isl/isl.c
> index e4bca16..77b570d 100644
> --- a/src/intel/isl/isl.c
> +++ b/src/intel/isl/isl.c
> @@ -59,8 +59,8 @@ isl_device_init(struct isl_device *dev,
>      * device properties at buildtime. Verify that the macros with the device
>      * properties chosen during runtime.
>      */
> -   assert(ISL_DEV_GEN(dev) == dev->info->gen);
> -   assert(ISL_DEV_USE_SEPARATE_STENCIL(dev) == dev->use_separate_stencil);
> +   ISL_DEV_GEN_SANITIZE(dev);
> +   ISL_DEV_USE_SEPARATE_STENCIL_SANITIZE(dev);
>
>     /* Did we break hiz or stencil? */
>     if (ISL_DEV_USE_SEPARATE_STENCIL(dev))
> diff --git a/src/intel/isl/isl.h b/src/intel/isl/isl.h
> index daa5428..a780bba 100644
> --- a/src/intel/isl/isl.h
> +++ b/src/intel/isl/isl.h
> @@ -59,6 +59,10 @@ struct brw_image_param;
>   * `gcc -DISL_DEV_GEN(dev)=9 ...`.
>   */
>  #define ISL_DEV_GEN(__dev) ((__dev)->info->gen)
> +#define ISL_DEV_GEN_SANITIZE(__dev)
> +#else
> +#define ISL_DEV_GEN_SANITIZE(__dev) \
> +   (assert(ISL_DEV_GEN(__dev) == (__dev)->info->gen))
>  #endif
>
>  #ifndef ISL_DEV_IS_HASWELL
> @@ -77,6 +81,10 @@ struct brw_image_param;
>   * `gcc -DISL_DEV_USE_SEPARATE_STENCIL(dev)=1 ...`.
>   */
>  #define ISL_DEV_USE_SEPARATE_STENCIL(__dev) ((__dev)->use_separate_stencil)
> +#define ISL_DEV_USE_SEPARATE_STENCIL_SANITIZE(__dev)
> +#else
> +#define ISL_DEV_USE_SEPARATE_STENCIL_SANITIZE(__dev) \
> +   (assert(ISL_DEV_USE_SEPARATE_STENCIL(__dev) == (__devi)->use_separate_stencil))
Typo in (__devi)->use_separate_stencil)).

>  #endif
>
>  /**
> --
> 2.8.3
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev

With typo fixed, patch is:
Reviewed-by: Anuj Phogat <anuj.phogat at gmail.com>


More information about the mesa-dev mailing list