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>
This commit is contained in:
@@ -482,9 +482,15 @@ VkResult __vk_errorf(struct anv_instance *instance, const void *object,
|
||||
vk_errorfi(anv_device_instance_or_null(device),\
|
||||
obj, error, format, ## __VA_ARGS__)
|
||||
#else
|
||||
#define vk_error(error) error
|
||||
#define vk_errorfi(instance, obj, error, format, ...) error
|
||||
#define vk_errorf(device, obj, error, format, ...) error
|
||||
|
||||
static inline VkResult __dummy_vk_error(VkResult error, UNUSED const void *ignored)
|
||||
{
|
||||
return error;
|
||||
}
|
||||
|
||||
#define vk_error(error) __dummy_vk_error(error, NULL)
|
||||
#define vk_errorfi(instance, obj, error, format, ...) __dummy_vk_error(error, instance)
|
||||
#define vk_errorf(device, obj, error, format, ...) __dummy_vk_error(error, device)
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user