diff options
author | Chad Versace <[email protected]> | 2017-08-15 16:48:38 -0700 |
---|---|---|
committer | Chad Versace <[email protected]> | 2017-09-18 14:26:54 -0700 |
commit | 2d1fac119fa0d1fccae086605b43b426312b257a (patch) | |
tree | 3d01b8d22c49544a433fad86b31cf5ed2e425dde /src/vulkan/util | |
parent | 7f57e58e2777c0e2c82cdf8de49d9cfa1ac9e6b1 (diff) |
vulkan/registry: Feed vk_android_native_buffer.xml to gen_enum_to_str.py
Tested on Android and Fedora.
Reviewed-by: Tapani Pälli <[email protected]>
Diffstat (limited to 'src/vulkan/util')
-rw-r--r-- | src/vulkan/util/gen_enum_to_str.py | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/src/vulkan/util/gen_enum_to_str.py b/src/vulkan/util/gen_enum_to_str.py index bc72c189943..df326d0a998 100644 --- a/src/vulkan/util/gen_enum_to_str.py +++ b/src/vulkan/util/gen_enum_to_str.py @@ -58,6 +58,7 @@ C_TEMPLATE = Template(textwrap.dedent(u"""\ */ #include <vulkan/vulkan.h> + #include <vulkan/vk_android_native_buffer.h> #include "util/macros.h" #include "vk_enum_to_str.h" @@ -68,8 +69,17 @@ C_TEMPLATE = Template(textwrap.dedent(u"""\ { switch(input) { % for v in enum.values: + % if v in FOREIGN_ENUM_VALUES: + + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wswitch" + % endif case ${v}: return "${v}"; + % if v in FOREIGN_ENUM_VALUES: + #pragma GCC diagnostic pop + + % endif % endfor default: unreachable("Undefined enum value."); @@ -89,6 +99,7 @@ H_TEMPLATE = Template(textwrap.dedent(u"""\ #define MESA_VK_ENUM_TO_STR_H #include <vulkan/vulkan.h> + #include <vulkan/vk_android_native_buffer.h> % for enum in enums: const char * vk_${enum.name[2:]}_to_str(${enum.name} input); @@ -97,6 +108,12 @@ 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 EnumFactory(object): """Factory for creating enums.""" @@ -175,7 +192,8 @@ def main(): f.write(template.render( file=os.path.basename(__file__), enums=efactory.registry.values(), - copyright=COPYRIGHT)) + copyright=COPYRIGHT, + FOREIGN_ENUM_VALUES=FOREIGN_ENUM_VALUES)) if __name__ == '__main__': |