diff options
author | Eric Anholt <eric@anholt.net> | 2014-01-27 17:30:11 -0800 |
---|---|---|
committer | Eric Anholt <eric@anholt.net> | 2014-01-28 15:20:11 -0800 |
commit | 12ef9dcf2d3600bcbe926c83597f9a782c5a068c (patch) | |
tree | c2d5ce1d56c703ed91d134554f081a882e3aa466 /src | |
parent | aa778ef39db0d051d0faa3a67553d7bd6cad08dd (diff) |
Do a trivial sort on the enums generated.
Python was apparently randomizing the output of the hash iterator,
preventing ccache after a make clean.
Diffstat (limited to 'src')
-rwxr-xr-x | src/gen_dispatch.py | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/gen_dispatch.py b/src/gen_dispatch.py index 637fd8f..6172756 100755 --- a/src/gen_dispatch.py +++ b/src/gen_dispatch.py @@ -446,8 +446,16 @@ class Generator(object): self.outln('#define {0} 1'.format(name)) self.outln('') - for name, value in self.enums.items(): - self.outln('#define ' + name.ljust(self.max_enum_name_len + 3) + value + '') + # We want to sort by enum number (which puts a bunch of things + # in a logical order), then by name after that, so we do those + # sorts in reverse. This is still way uglier than doing some + # sort based on what version/extensions things are introduced + # in, but we haven't paid any attention to those attributes + # for enums yet. + sorted_by_name = sorted(self.enums.keys()) + sorted_by_number = sorted(sorted_by_name, key=lambda name: self.enums[name]) + for name in sorted_by_number: + self.outln('#define ' + name.ljust(self.max_enum_name_len + 3) + self.enums[name] + '') def write_function_ptr_typedefs(self): for func in self.sorted_functions: |