diff options
author | Muhammad Mahad <mahadtxt@gmail.com> | 2023-08-15 18:52:10 +0500 |
---|---|---|
committer | Arthur Cohen <arthur.cohen@embecosm.com> | 2024-01-16 19:00:31 +0100 |
commit | 75853fdd29499cbe5e532f9472caefaa61ce4a69 (patch) | |
tree | 81cb540c60200aee1b2328aab7b10e80b0cd5cdc | |
parent | e4515c226d5e97bcc68383426cdafbc054df9ac5 (diff) | |
download | gcc-75853fdd29499cbe5e532f9472caefaa61ce4a69.zip gcc-75853fdd29499cbe5e532f9472caefaa61ce4a69.tar.gz gcc-75853fdd29499cbe5e532f9472caefaa61ce4a69.tar.bz2 |
gccrs: [E0534] inline attribute was malformed
Inline attribute takes one argument, but
more than one argument was found.
gcc/rust/ChangeLog:
* backend/rust-compile-base.cc (HIRCompileBase::handle_inline_attribute_on_fndecl):
Added rich_location & error code.
gcc/testsuite/ChangeLog:
* rust/compile/inline_2.rs: Added new case.
Signed-off-by: Muhammad Mahad <mahadtxt@gmail.com>
-rw-r--r-- | gcc/rust/backend/rust-compile-base.cc | 5 | ||||
-rw-r--r-- | gcc/testsuite/rust/compile/inline_2.rs | 3 |
2 files changed, 7 insertions, 1 deletions
diff --git a/gcc/rust/backend/rust-compile-base.cc b/gcc/rust/backend/rust-compile-base.cc index 5a0d9a1..1867368 100644 --- a/gcc/rust/backend/rust-compile-base.cc +++ b/gcc/rust/backend/rust-compile-base.cc @@ -247,7 +247,10 @@ HIRCompileBase::handle_inline_attribute_on_fndecl (tree fndecl, AST::AttrInputMetaItemContainer *meta_item = option.parse_to_meta_item (); if (meta_item->get_items ().size () != 1) { - rust_error_at (attr.get_locus (), "invalid number of arguments"); + rich_location rich_locus (line_table, attr.get_locus ()); + rich_locus.add_fixit_replace ("expected one argument"); + rust_error_at (rich_locus, ErrorCode::E0534, + "invalid number of arguments"); return; } diff --git a/gcc/testsuite/rust/compile/inline_2.rs b/gcc/testsuite/rust/compile/inline_2.rs index 3665fda..1fa5862 100644 --- a/gcc/testsuite/rust/compile/inline_2.rs +++ b/gcc/testsuite/rust/compile/inline_2.rs @@ -4,3 +4,6 @@ fn test_a() {} #[inline(A, B)] // { dg-error "invalid number of arguments" } fn test_b() {} + +#[inline()] // { dg-error "invalid number of arguments" } +fn test_c() {}
\ No newline at end of file |