anv: Avoid a couple of warnings related to vk_error macros
authorCaio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Tue, 1 Dec 2020 17:45:35 +0000 (08:45 -0900)
committerCaio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Wed, 2 Dec 2020 17:30:46 +0000 (08:30 -0900)
commit0a7abee60b699a6065edbe778cf990dd8d4910bb
tree7d378a5a372aa53ac791ead38519a6cf1a75b54c
parente60fcf0a8721efc4973910cde4733f4b3b54cb6f
anv: Avoid a couple of warnings related to vk_error macros

When DEBUG is not defined, no error reporting is done, the error is
just returned back.  The current definition a couple of warnings in
anv_formats.c.  First when the return value is intentionally ignored

  ../src/intel/vulkan/anv_formats.c:989:48: warning: statement with no effect [-Wunused-value]
    989 |          vk_errorfi(instance, physical_device, VK_ERROR_FORMAT_NOT_SUPPORTED,
        |                                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  ../src/intel/vulkan/anv_private.h:486:55: note: in definition of macro ‘vk_errorfi’
    486 | #define vk_errorfi(instance, obj, error, format, ...) error
        |                                                       ^~~~~

and also when an argument is used only

  ../src/intel/vulkan/anv_formats.c:908:25: warning: unused variable ‘instance’ [-Wunused-variable]
    908 |    struct anv_instance *instance = physical_device->instance;
        |                         ^~~~~~~~
  ../src/intel/vulkan/anv_formats.c: In function ‘anv_GetPhysicalDeviceImageFormatProperties2’:
  ../src/intel/vulkan/anv_formats.c:1231:25: warning: unused variable ‘instance’ [-Wunused-variable]
   1231 |    struct anv_instance *instance = physical_device->instance;
        |                         ^~~~~~~~

to avoid both issues, use a static inline function that just returns
it's argument but can consume other input. Ignoring the return value
of a function is OK, and the extra input can be tagged as UNUSED
getting rid of both warnings.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7860>
src/intel/vulkan/anv_private.h