From: Luiz Capitulino Date: Fri, 30 Sep 2011 15:43:27 +0000 (-0300) Subject: qapi: Automatically generate a _MAX value for enums X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=303b54b1a2611eda47abb28546869c49b5664f59;p=qemu.git qapi: Automatically generate a _MAX value for enums It's the last value in the enum and is very useful for the C implementation. Signed-off-by: Luiz Capitulino --- diff --git a/scripts/qapi-types.py b/scripts/qapi-types.py index 3bacc0c0da..f64d84c39e 100644 --- a/scripts/qapi-types.py +++ b/scripts/qapi-types.py @@ -91,8 +91,11 @@ typedef enum %(name)s ''', name=name) + # append automatically generated _MAX value + enum_values = values + [ 'MAX' ] + i = 0 - for value in values: + for value in enum_values: enum_decl += mcgen(''' %(abbrev)s_%(value)s = %(i)d, ''',