public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r14-7907] gccrs: [E0703] Use of Invalid ABI
@ 2024-01-16 18:06 Arthur Cohen
0 siblings, 0 replies; only message in thread
From: Arthur Cohen @ 2024-01-16 18:06 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:9f09284d8fc0a218e6fe936591d4ba35f716408f
commit r14-7907-g9f09284d8fc0a218e6fe936591d4ba35f716408f
Author: Muhammad Mahad <mahadtxt@gmail.com>
Date: Thu Aug 3 20:46:50 2023 +0500
gccrs: [E0703] Use of Invalid ABI
Added error code support for invalid ABI.
gcc/rust/ChangeLog:
* hir/rust-ast-lower-base.cc (ASTLoweringBase::lower_qualifiers):
called error function.
(ASTLoweringBase::lower_extern_block): likewise.
gcc/testsuite/ChangeLog:
* rust/compile/abi-options1.rs: updated comment for testcase.
Signed-off-by: Muhammad Mahad <mahadtxt@gmail.com>
Diff:
---
gcc/rust/hir/rust-ast-lower-base.cc | 6 ++++--
gcc/testsuite/rust/compile/abi-options1.rs | 6 ++++--
2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/gcc/rust/hir/rust-ast-lower-base.cc b/gcc/rust/hir/rust-ast-lower-base.cc
index 4ff49f997f3..da36d75bc67 100644
--- a/gcc/rust/hir/rust-ast-lower-base.cc
+++ b/gcc/rust/hir/rust-ast-lower-base.cc
@@ -702,7 +702,8 @@ ASTLoweringBase::lower_qualifiers (const AST::FunctionQualifiers &qualifiers)
const std::string &extern_abi = qualifiers.get_extern_abi ();
abi = get_abi_from_string (extern_abi);
if (has_extern && abi == ABI::UNKNOWN)
- rust_error_at (qualifiers.get_locus (), "unknown ABI option");
+ rust_error_at (qualifiers.get_locus (), ErrorCode::E0703,
+ "invalid ABI: found %qs", extern_abi.c_str ());
}
return HIR::FunctionQualifiers (qualifiers.get_const_status (), unsafety,
@@ -946,7 +947,8 @@ ASTLoweringBase::lower_extern_block (AST::ExternBlock &extern_block)
const std::string &extern_abi = extern_block.get_abi ();
abi = get_abi_from_string (extern_abi);
if (abi == ABI::UNKNOWN)
- rust_error_at (extern_block.get_locus (), "unknown ABI option");
+ rust_error_at (extern_block.get_locus (), ErrorCode::E0703,
+ "invalid ABI: found %qs", extern_abi.c_str ());
}
HIR::ExternBlock *hir_extern_block
diff --git a/gcc/testsuite/rust/compile/abi-options1.rs b/gcc/testsuite/rust/compile/abi-options1.rs
index a4b6241dc15..797dff09823 100644
--- a/gcc/testsuite/rust/compile/abi-options1.rs
+++ b/gcc/testsuite/rust/compile/abi-options1.rs
@@ -1,7 +1,9 @@
extern "foobar" {
- // { dg-error "unknown ABI option" "" { target *-*-* } .-1 }
+ // { dg-error "invalid ABI: found .foobar." "" { target *-*-* } .-1 }
fn printf(s: *const i8, ...);
}
pub extern "baz" fn test() {}
-// { dg-error "unknown ABI option" "" { target *-*-* } .-1 }
+// { dg-error "invalid ABI: found .baz." "" { target *-*-* } .-1 }
+
+// extern "Rust" fn foo() {} // OK!
\ No newline at end of file
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2024-01-16 18:06 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-16 18:06 [gcc r14-7907] gccrs: [E0703] Use of Invalid ABI Arthur Cohen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).