Skip to content

Commit c95d785

Browse files
authored
relaxes the bitfield declaration (#52)
Modern compilers accept bitfields with typedefed types despite that the standard is not quite clear if this acceptable. FrontC strictly requires a builtin integer type, e.g., `int`, `unsigned`, or `signed` as the type of bitfiled. The reason for this is that we need to lookup for the signedness of the field to construct a proper bitfield and since we're not storing the original type of a typedefed type anywhere we can't get this information for a typedefed type. The quick fix is to keep signedness unspecified for the typedefed types. Fixes #51
1 parent e85e417 commit c95d785

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

frontc/cparser.mly

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
7979
| BITFIELD (NO_SIGN, exp) ->
8080
(match tst with
8181
INT (_, sign) -> BITFIELD (sign, exp)
82-
| _ -> raise BadType)
82+
| _ -> typ)
8383
| _ -> raise BadType in
8484
set tin
8585

0 commit comments

Comments
 (0)