[igt-dev] [PATCH i-g-t] RFC: gem: fix compiler warnings

Chris Wilson chris at chris-wilson.co.uk
Mon Oct 14 12:38:02 UTC 2019


Quoting Juha-Pekka Heikkila (2019-10-14 13:09:05)
> Fix "warning: declaration of ‘e__’ shadows a previous local"
> complaints from gcc. There are changes in both lib/ and tests/
> in this patch as changing only one will create build breakage point.
> 
> Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila at gmail.com>
> ---
>  lib/igt_gt.h                   | 16 ++++++++--------
>  tests/i915/gem_eio.c           |  6 +++---
>  tests/i915/gem_exec_latency.c  |  4 ++--
>  tests/i915/gem_exec_nop.c      |  8 ++++----
>  tests/i915/gem_exec_schedule.c |  4 ++--
>  tests/i915/gem_sync.c          | 16 ++++++++--------
>  6 files changed, 27 insertions(+), 27 deletions(-)
> 
> diff --git a/lib/igt_gt.h b/lib/igt_gt.h
> index 73b5002..dcaf969 100644
> --- a/lib/igt_gt.h
> +++ b/lib/igt_gt.h
> @@ -75,16 +75,16 @@ extern const struct intel_execution_engine {
>  #define for_if(expr__) if (!(expr__)) {} else
>  
>  #define for_each_engine(fd__, flags__) \
> -       for (const struct intel_execution_engine *e__ = intel_execution_engines;\
> -            e__->name; \
> -            e__++) \
> -               for_if (gem_has_ring(fd__, flags__ = e__->exec_id | e__->flags))
> +       for (const struct intel_execution_engine *e__ ## flags__ = intel_execution_engines;\
> +            e__ ## flags__->name; \
> +            e__ ## flags__++) \
> +               for_if (gem_has_ring(fd__, flags__ = e__ ## flags__->exec_id | e__ ## flags__->flags))
>  
>  #define for_each_physical_engine(fd__, flags__) \
> -       for (const struct intel_execution_engine *e__ = intel_execution_engines;\
> -            e__->name; \
> -            e__++) \
> -               for_if (gem_ring_has_physical_engine(fd__, flags__ = e__->exec_id | e__->flags))
> +       for (const struct intel_execution_engine *e__ ## flags__ = intel_execution_engines;\
> +            e__ ## flags__->name; \
> +            e__ ## flags__++) \
> +               for_if (gem_ring_has_physical_engine(fd__, flags__ = e__ ## flags__->exec_id | e__ ## flags__->flags))

The plan had been to pass the iterator name to the macros. That plan got
lost somewhere along the way.
-Chris


More information about the igt-dev mailing list