Module: Mesa
Branch: master
Commit: 01d02e8906a9bc327d257c7bccba39f6af74045f
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=01d02e8906a9bc327d257c7bccba39f6af74045f

Author: Caio Marcelo de Oliveira Filho <[email protected]>
Date:   Mon Jul 16 13:50:07 2018 -0700

anv: avoid warning when switching in VkStructureType

When one of the cases is not part of the enum, the compilar complains:

../../src/intel/vulkan/anv_formats.c: In function 
‘anv_GetPhysicalDeviceFormatProperties2’:
../../src/intel/vulkan/anv_formats.c:728:7: warning: case value ‘1000001004’ 
not in enumerated type ‘VkStructureType’ {aka ‘enum VkStructureType’} [-Wswitch]
       case VK_STRUCTURE_TYPE_WSI_FORMAT_MODIFIER_PROPERTIES_LIST_MESA:
       ^~~~

Given the switch has an "default:" case, we don't lose anything by
switching on the unsigned value to avoid the warning.

Reviewed-by: Anuj Phogat <[email protected]>

---

 src/intel/vulkan/anv_formats.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/intel/vulkan/anv_formats.c b/src/intel/vulkan/anv_formats.c
index 0c5b8d3a2c..815b320a82 100644
--- a/src/intel/vulkan/anv_formats.c
+++ b/src/intel/vulkan/anv_formats.c
@@ -724,7 +724,8 @@ void anv_GetPhysicalDeviceFormatProperties2(
                                          &pFormatProperties->formatProperties);
 
    vk_foreach_struct(ext, pFormatProperties->pNext) {
-      switch (ext->sType) {
+      /* Use unsigned since some cases are not in the VkStructureType enum. */
+      switch ((unsigned)ext->sType) {
       case VK_STRUCTURE_TYPE_WSI_FORMAT_MODIFIER_PROPERTIES_LIST_MESA:
          get_wsi_format_modifier_properties_list(physical_device, format,
                                                  (void *)ext);

_______________________________________________
mesa-commit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to