Skip to content

Commit

Permalink
Fix to accept an empty list for inline-assembler clobbers
Browse files Browse the repository at this point in the history
  • Loading branch information
ytomino committed Dec 24, 2016
1 parent 7d7c747 commit e699244
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion source/c_analyzer.ml
Expand Up @@ -2908,7 +2908,7 @@ struct
| `some (_, (_, `some destructive)) ->
let destructive = Traversing.fold_right_iarl (fun (_, `chars_literal reg) rs -> reg :: rs) destructive [] in
derived_types, source, in_args, out_args, destructive
| `some (_, (_, `error)) | `none ->
| `some (_, (_, `none)) | `none ->
derived_types, source, in_args, out_args, []
end
| `none ->
Expand Down
9 changes: 4 additions & 5 deletions source/c_parser.ml
Expand Up @@ -991,17 +991,17 @@ struct
begin match xs with
| lazy (`cons (colon_p, (`colon as colon_e), xs)) ->
let colon = colon_p, colon_e in
let regs, xs = parse_ia_register_list_or_error error typedefs xs in
let regs, xs = parse_ia_register_list_option error typedefs xs in
let `some (ps, ()) = (`some colon) &^ regs in
`some (ps, (colon, regs)), xs
| _ ->
`none, xs
end
) and parse_ia_register_list_or_error
) and parse_ia_register_list_option
(error: ranged_position -> string -> unit)
(typedefs: typedef_set)
(xs: 'a in_t)
: ia_register_list e * 'a in_t =
: ia_register_list opt * 'a in_t =
(
let rec loop rs xs = (
begin match xs with
Expand All @@ -1020,8 +1020,7 @@ struct
let (first_p, first_e), xs = parse_chars_literal error typedefs xs in
loop (first_p, `nil first_e) xs
| _ ->
error (LazyList.hd_a xs) "inline-assembler destructive-registers syntax error.";
`error, xs
`none, xs
end
)
(* A.2.1 Expressions *)
Expand Down
2 changes: 1 addition & 1 deletion source/c_syntax.ml
Expand Up @@ -104,7 +104,7 @@ module Syntax (Literals: LiteralsType) = struct
| `cons of ia_argument_list p * [`comma] p * ia_argument e]
and ia_symbolic = [`l_bracket] p * identifier e * [`r_bracket] e
and ia_argument = ia_symbolic opt * [`chars_literal of string] e * [`l_paren] e * assignment_expression e * [`r_paren] e
and ia_destructive = [`colon] p * ia_register_list e
and ia_destructive = [`colon] p * ia_register_list opt
and ia_register_list = [
| `nil of [`chars_literal of string]
| `cons of ia_register_list p * [`comma] p * [`chars_literal of string] e]
Expand Down

0 comments on commit e699244

Please sign in to comment.