turnip: Fix 'unused' warnings
authorChad Versace <chadversary@chromium.org>
Mon, 12 Nov 2018 22:42:36 +0000 (14:42 -0800)
committerChia-I Wu <olvaffe@gmail.com>
Mon, 11 Mar 2019 17:01:41 +0000 (10:01 -0700)
Now turnip builds without warnings on my machine.

src/freedreno/vulkan/tu_cmd_buffer.c
src/freedreno/vulkan/tu_descriptor_set.c
src/freedreno/vulkan/tu_device.c
src/freedreno/vulkan/tu_private.h

index d3b68e5fd0a28edd2810db71446f56384e2b8428..5c83bca55380bbd1f1c49f6d73aa9fa0969735aa 100644 (file)
@@ -67,7 +67,7 @@ const struct tu_dynamic_state default_dynamic_state = {
      },
 };
 
-static void
+static void UNUSED /* FINISHME */
 tu_bind_dynamic_state(struct tu_cmd_buffer *cmd_buffer,
                       const struct tu_dynamic_state *src)
 {
@@ -75,6 +75,8 @@ tu_bind_dynamic_state(struct tu_cmd_buffer *cmd_buffer,
    uint32_t copy_mask = src->mask;
    uint32_t dest_mask = 0;
 
+   tu_use_args(cmd_buffer); /* FINISHME */
+
    /* Make sure to copy the number of viewports/scissors because they can
     * only be specified at pipeline creation time.
     */
index 1ea7f6870c4f4628d201c30dfe637e2cdf013a88..7d3b8a6b7b157a73428990bbefaebb792c8d6788 100644 (file)
@@ -101,6 +101,7 @@ tu_CreateDescriptorSetLayout(
 
    /* We just allocate all the samplers at the end of the struct */
    uint32_t *samplers = (uint32_t *)&set_layout->binding[max_binding + 1];
+   (void) samplers; /* TODO: Use me */
 
    VkDescriptorSetLayoutBinding *bindings =
      create_sorted_bindings(pCreateInfo->pBindings, pCreateInfo->bindingCount);
@@ -402,8 +403,8 @@ tu_CreateDescriptorPool(VkDevice _device,
                         VkDescriptorPool *pDescriptorPool)
 {
    TU_FROM_HANDLE(tu_device, device, _device);
-   struct tu_descriptor_pool *pool;
-
+   tu_use_args(device);
+   tu_stub();
    return VK_SUCCESS;
 }
 
@@ -422,6 +423,8 @@ tu_ResetDescriptorPool(VkDevice _device,
    TU_FROM_HANDLE(tu_device, device, _device);
    TU_FROM_HANDLE(tu_descriptor_pool, pool, descriptorPool);
 
+   tu_use_args(device, pool);
+   tu_stub();
    return VK_SUCCESS;
 }
 
@@ -433,6 +436,8 @@ tu_AllocateDescriptorSets(VkDevice _device,
    TU_FROM_HANDLE(tu_device, device, _device);
    TU_FROM_HANDLE(tu_descriptor_pool, pool, pAllocateInfo->descriptorPool);
 
+   tu_use_args(device, pool);
+   tu_stub();
    return VK_SUCCESS;
 }
 
@@ -445,6 +450,8 @@ tu_FreeDescriptorSets(VkDevice _device,
    TU_FROM_HANDLE(tu_device, device, _device);
    TU_FROM_HANDLE(tu_descriptor_pool, pool, descriptorPool);
 
+   tu_use_args(device, pool);
+   tu_stub();
    return VK_SUCCESS;
 }
 
@@ -492,7 +499,6 @@ tu_CreateDescriptorUpdateTemplate(
      sizeof(struct tu_descriptor_update_template) +
      sizeof(struct tu_descriptor_update_template_entry) * entry_count;
    struct tu_descriptor_update_template *templ;
-   uint32_t i;
 
    templ = vk_alloc2(
      &device->alloc, pAllocator, size, 8, VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
@@ -500,6 +506,9 @@ tu_CreateDescriptorUpdateTemplate(
       return vk_error(device->instance, VK_ERROR_OUT_OF_HOST_MEMORY);
 
    *pDescriptorUpdateTemplate = tu_descriptor_update_template_to_handle(templ);
+
+   tu_use_args(set_layout);
+   tu_stub();
    return VK_SUCCESS;
 }
 
@@ -529,6 +538,7 @@ tu_update_descriptor_set_with_template(
 {
    TU_FROM_HANDLE(
      tu_descriptor_update_template, templ, descriptorUpdateTemplate);
+   tu_use_args(templ);
 }
 
 void
index 4cf85b269a620e4f81c206149d38254e5879df75..01fbe9374780d15267e9043037c192d4f1c1f229 100644 (file)
@@ -65,7 +65,8 @@ tu_get_driver_uuid(void *uuid)
 static void
 tu_get_device_uuid(void *uuid)
 {
-   stub();
+   tu_use_args(uuid);
+   tu_stub();
 }
 
 VkResult
@@ -1459,7 +1460,7 @@ tu_GetImageSparseMemoryRequirements(
    uint32_t *pSparseMemoryRequirementCount,
    VkSparseImageMemoryRequirements *pSparseMemoryRequirements)
 {
-   stub();
+   tu_stub();
 }
 
 void
@@ -1469,7 +1470,7 @@ tu_GetImageSparseMemoryRequirements2(
    uint32_t *pSparseMemoryRequirementCount,
    VkSparseImageMemoryRequirements2KHR *pSparseMemoryRequirements)
 {
-   stub();
+   tu_stub();
 }
 
 void
index ccd768e02309ccba057bf0428050084bcfbed6b4..26a342f66520e4aa02ab989de919c45012ea3bbc 100644 (file)
@@ -258,13 +258,17 @@ tu_logi_v(const char *format, va_list va);
 #define tu_assert(x)
 #endif
 
-#define stub_return(v)                                                         \
+/* Suppress -Wunused in stub functions */
+#define tu_use_args(...) __tu_use_args(0, ##__VA_ARGS__)
+static inline void __tu_use_args(int ignore, ...) {}
+
+#define tu_stub_return(v)                                                         \
    do {                                                                        \
       tu_finishme("stub %s", __func__);                                       \
       return (v);                                                              \
    } while (0)
 
-#define stub()                                                                 \
+#define tu_stub()                                                                 \
    do {                                                                        \
       tu_finishme("stub %s", __func__);                                       \
       return;                                                                  \