genxml: Fix python crash when no dwords are found.
authorRafael Antognolli <rafael.antognolli@intel.com>
Fri, 31 Mar 2017 16:57:22 +0000 (09:57 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Mon, 24 Apr 2017 22:14:08 +0000 (15:14 -0700)
commit4ace73b1f6e8c8d96663a0d8f0f1d61f934e9cb2
tree7d8d962d5e8fa40d136a86233acbc083ecac0aba
parent19720405d5c455e2920e549606f8a45437a3a816
genxml: Fix python crash when no dwords are found.

If the 'dwords' dict is empty, max(dwords.keys()) throws an exception.
This case could happen when we have an instruction that is only an array
of other structs, with variable length.

v2:
   - Add another clause for empty dwords and make it work with python 3
   (Dylan)
   - Set the length to 0 if dwords is empty, and do not declare dw

Signed-off-by: Rafael Antognolli <rafael.antognolli@intel.com>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/intel/genxml/gen_pack_header.py