File tree Expand file tree Collapse file tree 6 files changed +6
-1
lines changed Expand file tree Collapse file tree 6 files changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -36,6 +36,7 @@ and storage =
36
36
and base_type =
37
37
| NO_TYPE (* * Old K&R declaration without type *)
38
38
| VOID (* * "void" type *)
39
+ | BOOL (* * C99 boolean (_Bool) type *)
39
40
| CHAR of sign (* * "char" type with sign modifier *)
40
41
| INT of size * sign (* * "int" type with size and sign modifiers *)
41
42
| BITFIELD of sign * expression
Original file line number Diff line number Diff line change @@ -153,6 +153,7 @@ let keywords =
153
153
(" __restrict" , id RESTRICT );
154
154
(" restrict" , id RESTRICT );
155
155
(" char" , id CHAR );
156
+ (" _Bool" , id BOOL );
156
157
(" int" , id INT );
157
158
(" float" , id FLOAT );
158
159
(" double" , id DOUBLE );
Original file line number Diff line number Diff line change @@ -731,6 +731,7 @@ only_dec:
731
731
/*** Base type ***/
732
732
qual_type:
733
733
| VOID {(VOID , [] )}
734
+ | BOOL {(BOOL , [] )}
734
735
| CHAR {(CHAR NO_SIGN , [] )}
735
736
| INT {(INT (NO_SIZE , NO_SIGN ), [] )}
736
737
| FLOAT {(FLOAT false , [] )}
Original file line number Diff line number Diff line change @@ -158,6 +158,7 @@ let rec print_base_type typ =
158
158
match typ with
159
159
NO_TYPE -> ()
160
160
| VOID -> print " void"
161
+ | BOOL -> print " _Bool"
161
162
| CHAR sign -> print ((get_sign sign) ^ " char" )
162
163
| INT (size , sign ) -> print ((get_sign sign) ^ (get_size size) ^ " int" )
163
164
| BITFIELD (sign , _ ) -> print ((get_sign sign) ^ " int" )
Original file line number Diff line number Diff line change 7
7
% token < Cabs. gnu_attrs> GNU_ATTRS
8
8
9
9
% token EOF
10
- % token CHAR INT DOUBLE FLOAT VOID
10
+ % token CHAR BOOL INT DOUBLE FLOAT VOID
11
11
% token ENUM STRUCT TYPEDEF UNION
12
12
% token SIGNED UNSIGNED LONG SHORT COMPLEX
13
13
% token VOLATILE EXTERN STATIC CONST AUTO REGISTER RESTRICT
Original file line number Diff line number Diff line change @@ -235,6 +235,7 @@ and convert_type _type =
235
235
let base_type name = Cxml. new_elt name [] [] in
236
236
match _type with
237
237
NO_TYPE -> convert_type (INT (NO_SIZE , NO_SIGN ))
238
+ | BOOL -> base_type " bool"
238
239
| VOID -> base_type " void"
239
240
| CHAR NO_SIGN
240
241
| CHAR SIGNED -> base_type " char"
You can’t perform that action at this time.
0 commit comments