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

Author: Eric Engestrom <[email protected]>
Date:   Fri May  3 12:31:01 2019 +0100

vk/util: drop no-op compiler warning workaround

`-Wswitch` applies to `switch()`, not `case:`, and is bypassed by the
presence of a `default:` anyway, so let's drop the `default:` and move
the warning suppression to where it can make a difference, and then it
turns out that we don't need to keep a list of special cases anymore :)

Signed-off-by: Eric Engestrom <[email protected]>
Reviewed-by: Lionel Landwerlin <[email protected]>

---

 src/vulkan/util/gen_enum_to_str.py | 24 +++++-------------------
 1 file changed, 5 insertions(+), 19 deletions(-)

diff --git a/src/vulkan/util/gen_enum_to_str.py 
b/src/vulkan/util/gen_enum_to_str.py
index 5357278ded1..0983c4e50a5 100644
--- a/src/vulkan/util/gen_enum_to_str.py
+++ b/src/vulkan/util/gen_enum_to_str.py
@@ -71,23 +71,16 @@ C_TEMPLATE = Template(textwrap.dedent(u"""\
     const char *
     vk_${enum.name[2:]}_to_str(${enum.name} input)
     {
+        #pragma GCC diagnostic push
+        #pragma GCC diagnostic ignored "-Wswitch"
         switch(input) {
         % for v in sorted(enum.values.keys()):
-            % if enum.values[v] in FOREIGN_ENUM_VALUES:
-
-            #pragma GCC diagnostic push
-            #pragma GCC diagnostic ignored "-Wswitch"
-            % endif
             case ${v}:
                 return "${enum.values[v]}";
-            % if enum.values[v] in FOREIGN_ENUM_VALUES:
-            #pragma GCC diagnostic pop
-
-            % endif
         % endfor
-        default:
-            unreachable("Undefined enum value.");
         }
+        #pragma GCC diagnostic pop
+        unreachable("Undefined enum value.");
     }
 
       % if enum.guard:
@@ -225,12 +218,6 @@ H_TEMPLATE = Template(textwrap.dedent(u"""\
     #endif"""),
     output_encoding='utf-8')
 
-# These enums are defined outside their respective enum blocks, and thus cause
-# -Wswitch warnings.
-FOREIGN_ENUM_VALUES = [
-    "VK_STRUCTURE_TYPE_NATIVE_BUFFER_ANDROID",
-]
-
 
 class NamedFactory(object):
     """Factory for creating enums."""
@@ -433,8 +420,7 @@ def main():
                 enums=enums,
                 extensions=extensions,
                 structs=structs,
-                copyright=COPYRIGHT,
-                FOREIGN_ENUM_VALUES=FOREIGN_ENUM_VALUES))
+                copyright=COPYRIGHT))
 
 
 if __name__ == '__main__':

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

Reply via email to