summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChad Versace <[email protected]>2015-06-09 14:54:53 -0700
committerChad Versace <[email protected]>2015-06-09 16:38:50 -0700
commit2d2e1489527401afb915496f525fcdd636e28a56 (patch)
tree6716d687056caf3846983ff5df94306928995269
parentffb1ee5d2072ef853d44f5a706a8b78ffd815d23 (diff)
vk/util: Add anv_abortf(), anv_abortfv()
Convenience functions to print an error message then abort.
-rw-r--r--src/vulkan/private.h3
-rw-r--r--src/vulkan/util.c19
2 files changed, 22 insertions, 0 deletions
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)
{