diff --git a/ctoxml/test.t/run.t b/ctoxml/test.t/run.t index 633415f..31e33bd 100644 --- a/ctoxml/test.t/run.t +++ b/ctoxml/test.t/run.t @@ -3866,7 +3866,7 @@ - $ echo 'struct foo {int x;};' | dune exec ctoxml + $ echo 'struct foo {int x;};' | ctoxml @@ -3889,7 +3889,7 @@ - $ echo 'const volatile int n;' | dune exec ctoxml + $ echo 'const volatile int n;' | ctoxml @@ -5448,7 +5448,7 @@ - $ echo 'void fn(char xs[const static volatile]) {}' | dune exec ctoxml -- + $ echo 'void fn(char xs[const static volatile]) {}' | ctoxml -- @@ -5472,7 +5472,7 @@ - $ echo 'void fn(char xs[const static volatile 10]) {}' | dune exec ctoxml -- + $ echo 'void fn(char xs[const static volatile 10]) {}' | ctoxml @@ -5496,3 +5496,15 @@ + + $ echo 'struct s {int : 32;};' | ctoxml + + + + + + 32 + + + + diff --git a/frontc/cparser.mly b/frontc/cparser.mly index f6c7ae5..31586cf 100644 --- a/frontc/cparser.mly +++ b/frontc/cparser.mly @@ -589,8 +589,8 @@ field_dec: {(fst $2, set_type (PROTO (NO_TYPE, fst $5, snd $5)) (snd $2))} | LPAREN field_dec RPAREN {$2} - | IDENT COLON expression - {($1, BITFIELD (NO_SIGN, $3))} + | IDENT? COLON expression + {((match $1 with None -> "" | Some x -> x), BITFIELD (NO_SIGN, $3))} ;