aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/expand/rust-macro-builtins-asm.cc
diff options
context:
space:
mode:
authorjjasmine <tanghocle456@gmail.com>2024-06-25 21:29:13 -0700
committerCohenArthur <arthur.cohen@embecosm.com>2024-06-28 09:59:34 +0000
commit69e06b2b6e44d6b66e29549014e37c812542bcab (patch)
treeaa2c143f57851f3c5bcdac00fd80dfe621ed1564 /gcc/rust/expand/rust-macro-builtins-asm.cc
parent6749034ca960f6f4d7886cef229a325f0eab08ea (diff)
downloadgcc-69e06b2b6e44d6b66e29549014e37c812542bcab.zip
gcc-69e06b2b6e44d6b66e29549014e37c812542bcab.tar.gz
gcc-69e06b2b6e44d6b66e29549014e37c812542bcab.tar.bz2
Addresses warning, put warn unused in right place
gcc/rust/ChangeLog: * expand/rust-macro-builtins-asm.cc (parse_reg_operand): Addresses warning, put warn unused in right place (parse_reg_operand_inout): Likewise. (parse_asm_arg): Likewise. * expand/rust-macro-builtins-asm.h (enum WARN_UNUSED_RESULT): Likewise. (enum InlineAsmParseError): Likewise. (validate): Likewise. (parse_asm_arg): Likewise. (parse_format_strings): Likewise. (parse_clobber_abi): Likewise. (parse_reg_operand): Likewise. (parse_reg_operand_in): Likewise. (parse_reg_operand_out): Likewise. (parse_reg_operand_lateout): Likewise. (parse_reg_operand_inout): Likewise. (parse_reg_operand_inlateout): Likewise. (parse_reg_operand_const): Likewise. (parse_reg_operand_sym): Likewise. (parse_reg_operand_unexpected): Likewise. (parse_asm): Likewise. (check_and_set): Likewise. (parse_options): Likewise. (parse_reg): Likewise. (parse_format_string): Likewise. Signed-off-by: badumbatish <tanghocle456@gmail.com>
Diffstat (limited to 'gcc/rust/expand/rust-macro-builtins-asm.cc')
-rw-r--r--gcc/rust/expand/rust-macro-builtins-asm.cc24
1 files changed, 14 insertions, 10 deletions
diff --git a/gcc/rust/expand/rust-macro-builtins-asm.cc b/gcc/rust/expand/rust-macro-builtins-asm.cc
index c61fb10..9c2e8bb 100644
--- a/gcc/rust/expand/rust-macro-builtins-asm.cc
+++ b/gcc/rust/expand/rust-macro-builtins-asm.cc
@@ -16,6 +16,7 @@
// along with GCC; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
+#include "expected.h"
#include "rust-make-unique.h"
#include "rust-macro-builtins-asm.h"
#include "rust-ast-fragment.h"
@@ -208,15 +209,13 @@ parse_reg_operand (InlineAsmContext inline_asm_ctx)
else
{
rust_error_at (token->get_locus (),
- "expected operand, clobber_abi, options, or "
- "additional template string");
+ "expected operand, %s, options, or "
+ "additional template string",
+ "clobber_abi");
return tl::unexpected<InlineAsmParseError> (COMMITTED);
}
}
- tl::expected<InlineAsmContext, InlineAsmParseError> parsing_operand
- = tl::expected<InlineAsmContext, InlineAsmParseError> (inline_asm_ctx);
-
int slot = inline_asm_ctx.inline_asm.operands.size ();
// Here is all parse_reg_operand functions we're using in a for loop
@@ -230,7 +229,8 @@ parse_reg_operand (InlineAsmContext inline_asm_ctx)
// we propogate the result.
for (auto &parse_func : parse_funcs)
{
- parsing_operand.emplace (inline_asm_ctx);
+ auto parsing_operand
+ = tl::expected<InlineAsmContext, InlineAsmParseError> (inline_asm_ctx);
parsing_operand.map (parse_func);
// Per rust's asm.rs's structure
@@ -281,7 +281,7 @@ parse_reg_operand (InlineAsmContext inline_asm_ctx)
}
}
- return parsing_operand;
+ return inline_asm_ctx;
}
tl::expected<InlineAsmContext, InlineAsmParseError>
@@ -386,7 +386,10 @@ parse_reg_operand_inout (InlineAsmContext inline_asm_ctx)
{
if (!parser.skip_token (UNDERSCORE))
{
- parse_format_string (inline_asm_ctx);
+ auto result = parse_format_string (inline_asm_ctx);
+
+ if (!result.has_value ())
+ rust_unreachable ();
// out_expr = parser.parse_expr();
}
@@ -708,8 +711,9 @@ parse_asm_arg (InlineAsmContext inline_asm_ctx)
// committed to anything So that the error bubbles up and we recover from
// this error gracefully
rust_error_at (token->get_locus (),
- "expected operand, clobber_abi, options, or additional "
- "template string");
+ "expected operand, %s, options, or additional "
+ "template string",
+ "clobber_abi");
return tl::unexpected<InlineAsmParseError> (COMMITTED);
}
return tl::expected<InlineAsmContext, InlineAsmParseError> (inline_asm_ctx);