[PATCH i-g-t 2/2] tests/intel: Apply igt.cocci transforms

Dixit, Ashutosh ashutosh.dixit at intel.com
Thu Aug 1 21:46:01 UTC 2024


On Mon, 29 Jul 2024 15:02:51 -0700, Matt Roper wrote:
>
> A number of Intel tests are using checks like "igt_assert(x < y)" rather
> than using the dedicated comparison assertions that print the actual
> values on assertion failure.  Run the Intel test directory through
> Coccinelle to apply these conversions and also apply some other general
> coding style cleanup:
>
>        spatch --in-place --sp-file lib/igt.cocci tests/intel


Seems to have caused a bunch of unused variable warnings:

$ gcc --version
gcc (GCC) 12.2.1 20221121 (Red Hat 12.2.1-4)

ninja: Entering directory `build'
[34/912] Compiling C object tests/drm_fdinfo.p/intel_drm_fdinfo.c.o
In file included from ../lib/igt.h:29,
                 from ../tests/intel/drm_fdinfo.c:28:
../tests/intel/drm_fdinfo.c: In function ‘read_fdinfo’:
../lib/igt_aux.h:229:35: warning: comparison of distinct pointer types lacks a cast
  229 |         (!!(sizeof((typeof(x) *)1 == (typeof(y) *)1)))
      |                                   ^~
../lib/igt_aux.h:246:10: note: in expansion of macro ‘__typecheck’
  246 |         (__typecheck(x, y) && __no_side_effects(x, y))
      |          ^~~~~~~~~~~
../lib/igt_aux.h:249:31: note: in expansion of macro ‘__safe_cmp’
  249 |         __builtin_choose_expr(__safe_cmp(x, y), \
      |                               ^~~~~~~~~~
../lib/igt_aux.h:254:25: note: in expansion of macro ‘__careful_cmp’
  254 | #define max(x, y)       __careful_cmp(x, y, >, max)
      |                         ^~~~~~~~~~~~~
../tests/intel/drm_fdinfo.c:808:16: note: in expansion of macro ‘max’
  808 |         return max(count, 0);
      |                ^~~
[35/912] Compiling C object tests/gem_ctx_create.p/intel_gem_ctx_create.c.o
../tests/intel/gem_ctx_create.c: In function ‘xchg_u32’:
../tests/intel/gem_ctx_create.c:298:30: warning: unused variable ‘tmp’ [-Wunused-variable]
  298 |         uint32_t *a = array, tmp;
      |                              ^~~
../tests/intel/gem_ctx_create.c: In function ‘xchg_ptr’:
../tests/intel/gem_ctx_create.c:305:28: warning: unused variable ‘tmp’ [-Wunused-variable]
  305 |         void **a = array, *tmp;
      |                            ^~~
[36/912] Compiling C object tests/gem_exec_big.p/intel_gem_exec_big.c.o
../tests/intel/gem_exec_big.c: In function ‘xchg_reloc’:
../tests/intel/gem_exec_big.c:144:46: warning: unused variable ‘tmp’ [-Wunused-variable]
  144 |         struct drm_i915_gem_relocation_entry tmp;
      |                                              ^~~
[37/912] Compiling C object tests/gem_exec_gttfill.p/intel_gem_exec_gttfill.c.o
../tests/intel/gem_exec_gttfill.c: In function ‘xchg_batch’:
../tests/intel/gem_exec_gttfill.c:67:22: warning: unused variable ‘tmp’ [-Wunused-variable]
   67 |         struct batch tmp;
      |                      ^~~
[38/912] Compiling C object tests/gem_softpin.p/intel_gem_softpin.c.o
../tests/intel/gem_softpin.c: In function ‘xchg_batch’:
../tests/intel/gem_softpin.c:970:22: warning: unused variable ‘tmp’ [-Wunused-variable]
  970 |         struct batch tmp;
      |                      ^~~
[39/912] Compiling C object tests/gem_tiled_fence_blits.p/intel_gem_tiled_fence_blits.c.o
../tests/intel/gem_tiled_fence_blits.c: In function ‘xchg_u32’:
../tests/intel/gem_tiled_fence_blits.c:159:18: warning: unused variable ‘tmp’ [-Wunused-variable]
  159 |         uint32_t tmp, *base = array;
      |                  ^~~


More information about the igt-dev mailing list