aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNobel Singh <nobel2073@gmail.com>2024-01-19 20:51:34 +0545
committerPhilip Herron <philip.herron@embecosm.com>2024-02-03 15:51:51 +0000
commit7c0daba10e43586df2ede9cd4037c50b85648e6a (patch)
tree1791357c5b6c272a90a80a1a1e7c9acb0cad4620
parent22aee650ee89eaa2cdf636fe01b46364872e14fd (diff)
downloadgcc-7c0daba10e43586df2ede9cd4037c50b85648e6a.zip
gcc-7c0daba10e43586df2ede9cd4037c50b85648e6a.tar.gz
gcc-7c0daba10e43586df2ede9cd4037c50b85648e6a.tar.bz2
Set the default ABI to C for extern blocks and extern functions
Previously, the default ABI was set to Rust, which is not correct for extern blocks and extern functions. This patch changes the default ABI to C for these cases. gcc/rust/ChangeLog: * hir/rust-ast-lower-base.cc (ASTLoweringBase::lower_qualifiers): Change default ABI to C for extern functions (ASTLoweringBase::lower_extern_block): Likewise Signed-off-by: Nobel Singh <nobel2073@gmail.com>
-rw-r--r--gcc/rust/hir/rust-ast-lower-base.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/gcc/rust/hir/rust-ast-lower-base.cc b/gcc/rust/hir/rust-ast-lower-base.cc
index ddfda09..36188d5 100644
--- a/gcc/rust/hir/rust-ast-lower-base.cc
+++ b/gcc/rust/hir/rust-ast-lower-base.cc
@@ -718,8 +718,8 @@ ASTLoweringBase::lower_qualifiers (const AST::FunctionQualifiers &qualifiers)
Unsafety unsafety
= qualifiers.is_unsafe () ? Unsafety::Unsafe : Unsafety::Normal;
bool has_extern = qualifiers.is_extern ();
+ ABI abi = has_extern ? ABI::C : ABI::RUST;
- ABI abi = ABI::RUST;
if (qualifiers.has_abi ())
{
const std::string &extern_abi = qualifiers.get_extern_abi ();
@@ -965,7 +965,7 @@ ASTLoweringBase::lower_extern_block (AST::ExternBlock &extern_block)
extern_items.push_back (std::unique_ptr<HIR::ExternalItem> (lowered));
}
- ABI abi = ABI::RUST;
+ ABI abi = ABI::C;
if (extern_block.has_abi ())
{
const std::string &extern_abi = extern_block.get_abi ();