Jacek Caban (@jacek) commented about tools/widl/parser.y:
enum_list: enum {
if (!$enum->eval) $enum->eval = expr_int( EXPR_NUM, 0 /* default for first enum entry */ );
if (!$enum->eval) $enum->eval = expr_int( 0, "0" ); $$ = append_var( NULL, $enum ); } | enum_list[list] ',' enum { if (!$enum->eval) {
var_t *last = LIST_ENTRY( list_tail( $list ), var_t, entry );
enum expr_type type = EXPR_NUM;
if (last->eval->type == EXPR_HEXNUM) type = EXPR_HEXNUM;
if (last->eval->cval + 1 < 0) type = EXPR_HEXNUM;
$enum->eval = expr_int( type, last->eval->cval + 1 );
expr_t *last = LIST_ENTRY( list_tail( $list ), var_t, entry )->eval;
const char *fmt = last->cval + 1 < 0 ? "0x%x" : "%u";
if (last->text && last->text[1] == 'x') fmt = "0x%x";
You're missing the case where text[1] == 'X' here. More generally, I'm not convinced that storing the string inside int expressions is an improvement, it seems fragile.