diff options
author | badumbatish <tanghocle456@gmail.com> | 2024-07-23 22:17:12 -0700 |
---|---|---|
committer | CohenArthur <arthur.cohen@embecosm.com> | 2024-09-02 09:44:55 +0000 |
commit | 716dadc80001a1d2c896f98f2713573a1616ea34 (patch) | |
tree | 420d6f33412f24f9be6638560ce28a23f1e6719f /gcc/rust/expand/rust-macro-builtins-asm.cc | |
parent | 5b5aadb643cff7d19d51a60506a45676cee533a9 (diff) | |
download | gcc-716dadc80001a1d2c896f98f2713573a1616ea34.zip gcc-716dadc80001a1d2c896f98f2713573a1616ea34.tar.gz gcc-716dadc80001a1d2c896f98f2713573a1616ea34.tar.bz2 |
Fix the parser's operand and flags storage
gcc/rust/ChangeLog:
* expand/rust-macro-builtins-asm.cc (parse_reg_operand):
Fix parsing logic & reassignment logic
(parse_reg_operand_in): Fix parsing
(parse_reg_operand_out): Fix parsing
(parse_reg_operand_inout): Fix parsing
(parse_reg_operand_unexpected): Remove rust_unreachable()
(parse_asm_arg): Fix parsing logic
Diffstat (limited to 'gcc/rust/expand/rust-macro-builtins-asm.cc')
-rw-r--r-- | gcc/rust/expand/rust-macro-builtins-asm.cc | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/gcc/rust/expand/rust-macro-builtins-asm.cc b/gcc/rust/expand/rust-macro-builtins-asm.cc index d809eaa..79b7c8e 100644 --- a/gcc/rust/expand/rust-macro-builtins-asm.cc +++ b/gcc/rust/expand/rust-macro-builtins-asm.cc @@ -226,10 +226,12 @@ parse_reg_operand (InlineAsmContext inline_asm_ctx) // Loop over and execute the parsing functions, if the parser successfullly // parses or if the parser fails to parse while it has committed to a token, // we propogate the result. + int count = 0; tl::expected<InlineAsmContext, InlineAsmParseError> parsing_operand ( inline_asm_ctx); for (auto &parse_func : parse_funcs) { + count++; auto result = parsing_operand.and_then (parse_func); // Per rust's asm.rs's structure @@ -238,8 +240,7 @@ parse_reg_operand (InlineAsmContext inline_asm_ctx) if (result.has_value ()) { - // - inline_asm_ctx = *result; + inline_asm_ctx = result.value (); break; } else if (result.error () == COMMITTED) @@ -687,7 +688,9 @@ parse_asm_arg (InlineAsmContext inline_asm_ctx) { auto expected = parse_clobber_abi (inline_asm_ctx); if (expected.has_value ()) - continue; + { + continue; + } else if (expected.error () == COMMITTED) return expected; @@ -699,7 +702,9 @@ parse_asm_arg (InlineAsmContext inline_asm_ctx) { auto expected = parse_options (inline_asm_ctx); if (expected.has_value ()) - continue; + { + continue; + } else if (expected.error () == COMMITTED) return expected; @@ -712,9 +717,13 @@ parse_asm_arg (InlineAsmContext inline_asm_ctx) auto expected = parse_reg_operand (inline_asm_ctx); if (expected.has_value ()) - continue; + { + continue; + } else if (expected.error () == COMMITTED) - return expected; + { + return expected; + } // Since parse_reg_operand is the last thing we've considered, // The non-committed parse error type means that we have exhausted our |