]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gccrs: asm: Fix clang warnings
authorArthur Cohen <arthur.cohen@embecosm.com>
Wed, 6 Nov 2024 14:19:55 +0000 (15:19 +0100)
committerArthur Cohen <arthur.cohen@embecosm.com>
Fri, 21 Mar 2025 11:32:56 +0000 (12:32 +0100)
Fixes a couple of warnings thrown by clang, with mismatched class/struct
usages and unused members.

gcc/rust/ChangeLog:

* ast/rust-expr.h: Remove invalid usage of `struct`.
* backend/rust-compile-asm.h: Remove unused `translated` member.
* backend/rust-compile-asm.cc (CompileAsm::CompileAsm): Remove usage
of `translated` member.
* checks/errors/rust-unsafe-checker.h: Mark visitor as `override`.
* hir/tree/rust-hir-expr.h (struct AnonConst): Remove unused `locus`
member.

gcc/rust/ast/rust-expr.h
gcc/rust/backend/rust-compile-asm.cc
gcc/rust/backend/rust-compile-asm.h
gcc/rust/checks/errors/rust-unsafe-checker.h
gcc/rust/hir/tree/rust-hir-expr.h

index 438d3d3b86ebae9faedae16f55ccf37ac57e4f51..483e599652bb5598361f6991f575722949e0c7c5 100644 (file)
@@ -4810,14 +4810,14 @@ public:
       rust_assert (this->expr != nullptr);
     }
 
-    In (const struct In &other)
+    In (const In &other)
     {
       reg = other.reg;
 
       expr = other.expr->clone_expr ();
     }
 
-    In operator= (const struct In &other)
+    In operator= (const In &other)
     {
       reg = other.reg;
       expr = other.expr->clone_expr ();
@@ -4843,14 +4843,14 @@ public:
       rust_assert (this->expr != nullptr);
     }
 
-    Out (const struct Out &other)
+    Out (const Out &other)
     {
       reg = other.reg;
       late = other.late;
       expr = other.expr->clone_expr ();
     }
 
-    Out operator= (const struct Out &other)
+    Out operator= (const Out &other)
     {
       reg = other.reg;
       late = other.late;
@@ -4876,14 +4876,14 @@ public:
       rust_assert (this->expr != nullptr);
     }
 
-    InOut (const struct InOut &other)
+    InOut (const InOut &other)
     {
       reg = other.reg;
       late = other.late;
       expr = other.expr->clone_expr ();
     }
 
-    InOut operator= (const struct InOut &other)
+    InOut operator= (const InOut &other)
     {
       reg = other.reg;
       late = other.late;
@@ -4913,7 +4913,7 @@ public:
       rust_assert (this->out_expr != nullptr);
     }
 
-    SplitInOut (const struct SplitInOut &other)
+    SplitInOut (const SplitInOut &other)
     {
       reg = other.reg;
       late = other.late;
@@ -4921,7 +4921,7 @@ public:
       out_expr = other.out_expr->clone_expr ();
     }
 
-    SplitInOut operator= (const struct SplitInOut &other)
+    SplitInOut operator= (const SplitInOut &other)
     {
       reg = other.reg;
       late = other.late;
@@ -4953,12 +4953,12 @@ public:
     {
       rust_assert (this->expr != nullptr);
     }
-    Sym (const struct Sym &other)
+    Sym (const Sym &other)
     {
       expr = std::unique_ptr<Expr> (other.expr->clone_expr ());
     }
 
-    Sym operator= (const struct Sym &other)
+    Sym operator= (const Sym &other)
     {
       expr = std::unique_ptr<Expr> (other.expr->clone_expr ());
       return *this;
@@ -4981,12 +4981,12 @@ public:
       if (label_name.has_value ())
        this->label_name = label_name.value ();
     }
-    Label (const struct Label &other)
+    Label (const Label &other)
     {
       expr = std::unique_ptr<Expr> (other.expr->clone_expr ());
     }
 
-    Label operator= (const struct Label &other)
+    Label operator= (const Label &other)
     {
       expr = std::unique_ptr<Expr> (other.expr->clone_expr ());
       return *this;
index e85d08d05792a2e45e694b6e6180c39f7adb7ed0..be553a3e70f95375c524685a843161d079131d9e 100644 (file)
@@ -3,9 +3,8 @@
 namespace Rust {
 namespace Compile {
 
-CompileAsm::CompileAsm (Context *ctx)
-  : HIRCompileBase (ctx), translated (error_mark_node)
-{}
+CompileAsm::CompileAsm (Context *ctx) : HIRCompileBase (ctx) {}
+
 tree
 CompileAsm::tree_codegen_asm (HIR::InlineAsm &expr)
 {
index 402d950844c284ff6af761f313ce5f3336f59425..4abd24eded4acf8b5f593258eab3621f3c5eae8b 100644 (file)
@@ -28,8 +28,6 @@ namespace Compile {
 class CompileAsm : private HIRCompileBase
 {
 private:
-  tree translated;
-
   // RELEVANT MEMBER FUNCTIONS
 
   // The limit is 5 because it stands for the 5 things that the C version of
index 96ccdc03c53c6dc6ea641fda5c7fc7c2a9b60a91..8dc6ab790716f435298a1850982b07ef287ba268 100644 (file)
@@ -113,7 +113,7 @@ private:
   virtual void visit (MatchExpr &expr) override;
   virtual void visit (AwaitExpr &expr) override;
   virtual void visit (AsyncBlockExpr &expr) override;
-  virtual void visit (InlineAsm &expr);
+  virtual void visit (InlineAsm &expr) override;
   virtual void visit (TypeParam &param) override;
   virtual void visit (ConstGenericParam &param) override;
   virtual void visit (LifetimeWhereClauseItem &item) override;
index a79aea5838617b79006da7017060f02a41ccd5a9..0155e2546881308f47784e8349a2d8027b7ffc0f 100644 (file)
@@ -3700,7 +3700,6 @@ struct AnonConst
     return *this;
   }
 };
-;
 
 class InlineAsmOperand
 {
@@ -3888,7 +3887,6 @@ private:
   tl::optional<struct Const> cnst;
   tl::optional<struct Sym> sym;
   tl::optional<struct Label> label;
-  location_t locus;
 
 public:
   InlineAsmOperand (const InlineAsmOperand &other)
@@ -3931,6 +3929,7 @@ public:
   struct Sym get_sym () const { return sym.value (); }
   struct Label get_label () const { return label.value (); }
 };
+
 // Inline Assembly Node
 class InlineAsm : public ExprWithoutBlock
 {
@@ -4009,6 +4008,7 @@ public:
 
   {}
 };
+
 } // namespace HIR
 } // namespace Rust