[Mesa-dev] [PATCH 2/2] vulkan: fix 'statement with no effect' warning
Grazvydas Ignotas
notasas at gmail.com
Sun Dec 11 17:05:36 UTC 2016
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
More information about the mesa-dev
mailing list