From 551d7032dfcf3a8e8bfe7889092b2befc1071db5 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Thu, 3 Jun 2021 09:10:36 -0700 Subject: [PATCH] venus: silence compiler warnings Silence warnings in release builds. Signed-off-by: Chia-I Wu Reviewed-by: Yiwei Zhang Part-of: --- src/virtio/vulkan/vn_command_buffer.c | 2 +- src/virtio/vulkan/vn_device.c | 1 - src/virtio/vulkan/vn_device_memory.c | 6 ++++-- src/virtio/vulkan/vn_queue.c | 6 +++--- src/virtio/vulkan/vn_renderer.h | 4 ++-- src/virtio/vulkan/vn_renderer_virtgpu.c | 5 +++-- 6 files changed, 13 insertions(+), 11 deletions(-) diff --git a/src/virtio/vulkan/vn_command_buffer.c b/src/virtio/vulkan/vn_command_buffer.c index 655a071..65e0e45 100644 --- a/src/virtio/vulkan/vn_command_buffer.c +++ b/src/virtio/vulkan/vn_command_buffer.c @@ -368,7 +368,7 @@ vn_cmd_begin_render_pass(struct vn_command_buffer *cmd, /* find fb attachments */ const VkImageView *views; - uint32_t view_count; + ASSERTED uint32_t view_count; if (fb->image_view_count) { views = fb->image_views; view_count = fb->image_view_count; diff --git a/src/virtio/vulkan/vn_device.c b/src/virtio/vulkan/vn_device.c index e1a9c05..a9380ae 100644 --- a/src/virtio/vulkan/vn_device.c +++ b/src/virtio/vulkan/vn_device.c @@ -1468,7 +1468,6 @@ vn_physical_device_get_native_extensions( exts->KHR_swapchain = true; exts->KHR_swapchain_mutable_format = true; #endif - } static void diff --git a/src/virtio/vulkan/vn_device_memory.c b/src/virtio/vulkan/vn_device_memory.c index 330d0b5..bf19970 100644 --- a/src/virtio/vulkan/vn_device_memory.c +++ b/src/virtio/vulkan/vn_device_memory.c @@ -371,7 +371,8 @@ vn_GetDeviceMemoryOpaqueCaptureAddress( VkDevice device, const VkDeviceMemoryOpaqueCaptureAddressInfo *pInfo) { struct vn_device *dev = vn_device_from_handle(device); - struct vn_device_memory *mem = vn_device_memory_from_handle(pInfo->memory); + ASSERTED struct vn_device_memory *mem = + vn_device_memory_from_handle(pInfo->memory); assert(!mem->base_memory); return vn_call_vkGetDeviceMemoryOpaqueCaptureAddress(dev->instance, device, @@ -455,7 +456,8 @@ vn_GetDeviceMemoryCommitment(VkDevice device, VkDeviceSize *pCommittedMemoryInBytes) { struct vn_device *dev = vn_device_from_handle(device); - struct vn_device_memory *mem = vn_device_memory_from_handle(memory); + ASSERTED struct vn_device_memory *mem = + vn_device_memory_from_handle(memory); assert(!mem->base_memory); vn_call_vkGetDeviceMemoryCommitment(dev->instance, device, memory, diff --git a/src/virtio/vulkan/vn_queue.c b/src/virtio/vulkan/vn_queue.c index 610c95d..b1cfa79 100644 --- a/src/virtio/vulkan/vn_queue.c +++ b/src/virtio/vulkan/vn_queue.c @@ -787,7 +787,7 @@ vn_GetSemaphoreCounterValue(VkDevice device, { struct vn_device *dev = vn_device_from_handle(device); struct vn_semaphore *sem = vn_semaphore_from_handle(semaphore); - struct vn_sync_payload *payload = sem->payload; + ASSERTED struct vn_sync_payload *payload = sem->payload; assert(payload->type == VN_SYNC_TYPE_DEVICE_ONLY); return vn_call_vkGetSemaphoreCounterValue(dev->instance, device, semaphore, @@ -815,7 +815,7 @@ vn_find_first_signaled_semaphore(VkDevice device, uint32_t count) { for (uint32_t i = 0; i < count; i++) { - uint64_t val; + uint64_t val = 0; VkResult result = vn_GetSemaphoreCounterValue(device, semaphores[i], &val); if (result != VK_SUCCESS || val >= values[i]) @@ -832,7 +832,7 @@ vn_remove_signaled_semaphores(VkDevice device, { uint32_t cur = 0; for (uint32_t i = 0; i < *count; i++) { - uint64_t val; + uint64_t val = 0; VkResult result = vn_GetSemaphoreCounterValue(device, semaphores[i], &val); if (result != VK_SUCCESS) diff --git a/src/virtio/vulkan/vn_renderer.h b/src/virtio/vulkan/vn_renderer.h index 6f818a5..6f5ef65 100644 --- a/src/virtio/vulkan/vn_renderer.h +++ b/src/virtio/vulkan/vn_renderer.h @@ -297,7 +297,7 @@ static inline struct vn_renderer_shmem * vn_renderer_shmem_ref(struct vn_renderer *renderer, struct vn_renderer_shmem *shmem) { - const int old = + ASSERTED const int old = atomic_fetch_add_explicit(&shmem->refcount, 1, memory_order_relaxed); assert(old >= 1); @@ -365,7 +365,7 @@ vn_renderer_bo_create_from_dma_buf(struct vn_renderer *renderer, static inline struct vn_renderer_bo * vn_renderer_bo_ref(struct vn_renderer *renderer, struct vn_renderer_bo *bo) { - const int old = + ASSERTED const int old = atomic_fetch_add_explicit(&bo->refcount, 1, memory_order_relaxed); assert(old >= 1); diff --git a/src/virtio/vulkan/vn_renderer_virtgpu.c b/src/virtio/vulkan/vn_renderer_virtgpu.c index 3889b37..b17f247 100644 --- a/src/virtio/vulkan/vn_renderer_virtgpu.c +++ b/src/virtio/vulkan/vn_renderer_virtgpu.c @@ -667,7 +667,7 @@ virtgpu_ioctl_gem_close(struct virtgpu *gpu, uint32_t gem_handle) .handle = gem_handle, }; - const int ret = virtgpu_ioctl(gpu, DRM_IOCTL_GEM_CLOSE, &args); + ASSERTED const int ret = virtgpu_ioctl(gpu, DRM_IOCTL_GEM_CLOSE, &args); assert(!ret); } @@ -741,7 +741,8 @@ virtgpu_ioctl_syncobj_destroy(struct virtgpu *gpu, uint32_t syncobj_handle) .handle = syncobj_handle, }; - const int ret = virtgpu_ioctl(gpu, DRM_IOCTL_SYNCOBJ_DESTROY, &args); + ASSERTED const int ret = + virtgpu_ioctl(gpu, DRM_IOCTL_SYNCOBJ_DESTROY, &args); assert(!ret); } -- 2.7.4