[Mesa-dev] [PATCH 2/2] vulkan: fix 'statement with no effect' warning
Jason Ekstrand
jason at jlekstrand.net
Mon Dec 12 04:58:59 UTC 2016
I have a patch in my tree that fixes that warning by making us actually
return the error code in that function rather than simply using it as a
fancy print function. I think that's the better fix.
On Dec 11, 2016 9:06 AM, "Grazvydas Ignotas" <notasas at gmail.com> wrote:
> Emitted on release build in case vk_error() return is not used.
>
> Signed-off-by: Grazvydas Ignotas <notasas at gmail.com>
> ---
> no commit access
>
> src/vulkan/vk_util.c | 4 ++++
> src/vulkan/vk_util.h | 13 ++++++++-----
> 2 files changed, 12 insertions(+), 5 deletions(-)
>
> diff --git a/src/vulkan/vk_util.c b/src/vulkan/vk_util.c
> index 5d38117..716b8e5 100644
> --- a/src/vulkan/vk_util.c
> +++ b/src/vulkan/vk_util.c
> @@ -60,6 +60,8 @@ __vk_finishme(const char *file, int line, const char
> *format, ...)
> fprintf(stderr, "%s:%d: FINISHME: %s\n", file, line, buffer);
> }
>
> +#ifdef DEBUG
> +
> VkResult
> __vk_errorf(VkResult error, const char *file, int line, const char
> *format, ...)
> {
> @@ -103,3 +105,5 @@ __vk_errorf(VkResult error, const char *file, int
> line, const char *format, ...)
>
> return error;
> }
> +
> +#endif /* DEBUG */
> diff --git a/src/vulkan/vk_util.h b/src/vulkan/vk_util.h
> index c384838..5ce206c 100644
> --- a/src/vulkan/vk_util.h
> +++ b/src/vulkan/vk_util.h
> @@ -72,15 +72,18 @@ align_i32(int32_t v, int32_t a)
> * propagating errors. Might be useful to plug in a stack trace here.
> */
>
> +#ifdef DEBUG
> VkResult __vk_errorf(VkResult error, const char *file, int line, const
> char *format, ...);
> +#else
> +static inline VkResult
> +__vk_errorf(VkResult error, const char *file, int line, const char
> *format, ...)
> +{
> + return error;
> +}
> +#endif
>
> -#ifdef DEBUG
> #define vk_error(error) __vk_errorf(error, __FILE__, __LINE__, NULL);
> #define vk_errorf(error, format, ...) __vk_errorf(error, __FILE__,
> __LINE__, format, ## __VA_ARGS__);
> -#else
> -#define vk_error(error) error
> -#define vk_errorf(error, format, ...) error
> -#endif
>
> void __vk_finishme(const char *file, int line, const char *format, ...)
> vk_printflike(3, 4);
> --
> 2.7.4
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20161211/898ede8f/attachment.html>
More information about the mesa-dev
mailing list