Skip to content

Commit

Permalink
Set the default ABI to C for extern blocks and extern functions
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
nobel-sh authored and philberty committed Feb 3, 2024
1 parent 22aee65 commit 7c0daba
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions gcc/rust/hir/rust-ast-lower-base.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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 ();
Expand Down Expand Up @@ -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 ();
Expand Down

0 comments on commit 7c0daba

Please sign in to comment.