public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r14-8850] gccrs: Set the default ABI to C for extern blocks and extern functions
@ 2024-02-07 12:43 Arthur Cohen
  0 siblings, 0 replies; only message in thread
From: Arthur Cohen @ 2024-02-07 12:43 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:60f8171f5c8c7eec6c3441f735735f31cea2e1d1

commit r14-8850-g60f8171f5c8c7eec6c3441f735735f31cea2e1d1
Author: Nobel Singh <nobel2073@gmail.com>
Date:   Fri Jan 19 20:51:34 2024 +0545

    gccrs: 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>

Diff:
---
 gcc/rust/hir/rust-ast-lower-base.cc | 4 ++--
 1 file 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 748cec74829c..19f208852090 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 ();

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-02-07 12:43 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-07 12:43 [gcc r14-8850] gccrs: Set the default ABI to C for extern blocks and extern functions 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).