From 14a1ced0e45878a03e1461e905b1c04988528b8c Mon Sep 17 00:00:00 2001 From: Antonio Ospite Date: Wed, 9 Mar 2022 12:46:43 +0100 Subject: [PATCH] xrt: fix -Wreturn-type warnings Add some missing returns pointed out by -Wreturn-type: ----------------------------------------------------------------------- [32/315] Building C object src/xrt/auxiliary/CMakeFiles/aux_gstreamer.dir/gstreamer/gst_sink.c.o .../src/xrt/auxiliary/gstreamer/gst_sink.c:53:1: warning: non-void function does not return a value in all control paths [-Wreturn-type] } ^ 1 warning generated. [84/315] Building C object src/xrt/auxiliary/CMakeFiles/aux_vk.dir/vk/vk_compositor_flags.c.o .../src/xrt/auxiliary/vk/vk_compositor_flags.c:117:1: warning: non-void function does not return a value in all control paths [-Wreturn-type] } ^ .../src/xrt/auxiliary/vk/vk_compositor_flags.c:146:1: warning: non-void function does not return a value in all control paths [-Wreturn-type] } ^ 2 warnings generated. ----------------------------------------------------------------------- For the function returning VkImageAspectFlags return a literal 0 because the enum values VK_IMAGE_ASPECT_NONE or VK_IMAGE_ASPECT_NONE_KHR may not always be defined. --- src/xrt/auxiliary/gstreamer/gst_sink.c | 2 +- src/xrt/auxiliary/vk/vk_compositor_flags.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/xrt/auxiliary/gstreamer/gst_sink.c b/src/xrt/auxiliary/gstreamer/gst_sink.c index fda3da8ff..2cf0e297d 100644 --- a/src/xrt/auxiliary/gstreamer/gst_sink.c +++ b/src/xrt/auxiliary/gstreamer/gst_sink.c @@ -48,7 +48,7 @@ gst_fmt_from_xf_format(enum xrt_format format_in) case XRT_FORMAT_R8G8B8X8: return GST_VIDEO_FORMAT_RGBx; case XRT_FORMAT_YUYV422: return GST_VIDEO_FORMAT_YUY2; case XRT_FORMAT_L8: return GST_VIDEO_FORMAT_GRAY8; - default: assert(false); + default: assert(false); return GST_VIDEO_FORMAT_UNKNOWN; } } diff --git a/src/xrt/auxiliary/vk/vk_compositor_flags.c b/src/xrt/auxiliary/vk/vk_compositor_flags.c index 647104411..b7d6dcde0 100644 --- a/src/xrt/auxiliary/vk/vk_compositor_flags.c +++ b/src/xrt/auxiliary/vk/vk_compositor_flags.c @@ -113,6 +113,7 @@ vk_csci_get_barrier_optimal_layout(VkFormat format) return VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL; default: // assert(false && !"Format not supported!"); + return VK_IMAGE_LAYOUT_UNDEFINED; } } @@ -142,6 +143,7 @@ vk_csci_get_barrier_aspect_mask(VkFormat format) return VK_IMAGE_ASPECT_COLOR_BIT; default: // assert(false && !"Format not supported!"); + return 0; } }