From: Chad Versace Date: Tue, 9 Jun 2015 21:54:53 +0000 (-0700) Subject: vk/util: Add anv_abortf(), anv_abortfv() X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=2d2e1489527401afb915496f525fcdd636e28a56;p=mesa.git vk/util: Add anv_abortf(), anv_abortfv() Convenience functions to print an error message then abort. --- diff --git a/src/vulkan/private.h b/src/vulkan/private.h index 26296c931fd..36279fac2cb 100644 --- a/src/vulkan/private.h +++ b/src/vulkan/private.h @@ -98,6 +98,9 @@ void __anv_finishme(const char *file, int line, const char *format, ...) #define anv_finishme(format, ...) \ __anv_finishme(__FILE__, __LINE__, format, ##__VA_ARGS__); +void anv_abortf(const char *format, ...) anv_noreturn anv_printflike(1, 2); +void anv_abortfv(const char *format, va_list va) anv_noreturn; + #define stub_return(v) \ do { \ anv_finishme("stub %s", __func__); \ diff --git a/src/vulkan/util.c b/src/vulkan/util.c index 928f191847f..13af882cffd 100644 --- a/src/vulkan/util.c +++ b/src/vulkan/util.c @@ -43,6 +43,25 @@ __anv_finishme(const char *file, int line, const char *format, ...) fprintf(stderr, "%s:%d: FINISHME: %s\n", file, line, buffer); } +void anv_noreturn anv_printflike(1, 2) +anv_abortf(const char *format, ...) +{ + va_list va; + + va_start(va, format); + anv_abortfv(format, va); + va_end(va); +} + +void anv_noreturn +anv_abortfv(const char *format, va_list va) +{ + fprintf(stderr, "vk: error: "); + vfprintf(stderr, format, va); + fprintf(stderr, "\n"); + abort(); +} + int anv_vector_init(struct anv_vector *vector, uint32_t element_size, uint32_t size) {