Skip to content

Commit

Permalink
Allow for empty list of enums for an operand
Browse files Browse the repository at this point in the history
Insert a placeholder enum that is never valid.
This allows compilation to pass on MSVC, which doesn't like
creating an array with explicit type elem[] but which has an empty
initializer.

Bug: crbug.com/351140758
  • Loading branch information
dneto0 committed Jul 4, 2024
1 parent 3bc9744 commit d4d3e70
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions utils/generate_grammar_tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,10 @@ def functor(k): return (int(k['value'], 16))
name = '{}_{}Entries'.format(PYGEN_VARIABLE_PREFIX, kind)
entries = [' {}'.format(generate_enum_operand_kind_entry(e, extension_map))
for e in entries]
if len(entries) == 0:
# Insert a dummy entry. Otherwise the array is empty and compilation
# will fail in MSVC.
entries = [' {"place holder", 0, 0, nullptr, 0, nullptr, {}, SPV_SPIRV_VERSION_WORD(999,0), 0}']

template = ['static const spv_operand_desc_t {name}[] = {{',
'{entries}', '}};']
Expand Down

0 comments on commit d4d3e70

Please sign in to comment.