From 36f3c9c4224e71cc04442e6e6f8dbcd1d78bbf0e Mon Sep 17 00:00:00 2001 From: Antonio Ospite Date: Mon, 11 Aug 2025 11:39:16 +0200 Subject: [PATCH] nak/nouveau: silence errors about never used methods When building nvk for Android the rust compiler emits the following errors: ----------------------------------------------------------------------- error: methods `get_pred_src`, `get_u32_bnot_src`, `get_carry_src`, `set_pred_dst`, and `set_carry_dst` are never used --> ../src/nouveau/compiler/nak/ir.rs:1371:12 | 1370 | impl OpFoldData<'_> { | ------------------- methods in this implementation 1371 | pub fn get_pred_src(&self, op: &impl SrcsAsSlice, src: &Src) -> bool { | ^^^^^^^^^^^^ ... 1404 | pub fn get_u32_bnot_src(&self, op: &impl SrcsAsSlice, src: &Src) -> u32 { | ^^^^^^^^^^^^^^^^ ... 1413 | pub fn get_carry_src(&self, op: &impl SrcsAsSlice, src: &Src) -> bool { | ^^^^^^^^^^^^^ ... 1446 | pub fn set_pred_dst(&mut self, op: &impl DstsAsSlice, dst: &Dst, b: bool) { | ^^^^^^^^^^^^ ... 1450 | pub fn set_carry_dst(&mut self, op: &impl DstsAsSlice, dst: &Dst, b: bool) { | ^^^^^^^^^^^^^ | = note: `-D dead-code` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(dead_code)]` error: method `eval` is never used --> ../src/nouveau/compiler/nak/ir.rs:1523:12 | 1522 | impl PredSetOp { | -------------- method in this implementation 1523 | pub fn eval(&self, a: bool, b: bool) -> bool { | ^^^^ error: method `to_mask` is never used --> ../src/nouveau/compiler/nak/ir.rs:5625:12 | 5614 | impl SuClampRound { | ----------------- method in this implementation ... 5625 | pub fn to_mask(&self) -> u32 { | ^^^^^^^ error: method `cast` is never used --> ../src/nouveau/compiler/nak/ir.rs:6041:8 | 6006 | impl IMadSpSrcType { | ------------------ method in this implementation ... 6041 | fn cast(&self, v: u32) -> i64 { | ^^^^ ----------------------------------------------------------------------- Add `#[allow(dead_code)]` to silence the errors, as suggested by the compiler. Reviewed-by: Faith Ekstrand Reviewed-by: Mel Henning Cc: mesa-stable Part-of: (cherry picked from commit 5c019bdee5483f5c5b72af17c1c7b0d3cad328f1) --- .pick_status.json | 2 +- src/nouveau/compiler/nak/ir.rs | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.pick_status.json b/.pick_status.json index df4d6b4345e..e263f3297cd 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -4634,7 +4634,7 @@ "description": "nak/nouveau: silence errors about never used methods", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": null, "notes": null diff --git a/src/nouveau/compiler/nak/ir.rs b/src/nouveau/compiler/nak/ir.rs index 2c8f00881b0..db56cba0cc0 100644 --- a/src/nouveau/compiler/nak/ir.rs +++ b/src/nouveau/compiler/nak/ir.rs @@ -1560,6 +1560,7 @@ pub struct OpFoldData<'a> { } impl OpFoldData<'_> { + #[allow(dead_code)] pub fn get_pred_src(&self, op: &impl SrcsAsSlice, src: &Src) -> bool { let i = op.src_idx(src); let b = match src.src_ref { @@ -1593,6 +1594,7 @@ impl OpFoldData<'_> { } } + #[allow(dead_code)] pub fn get_u32_bnot_src(&self, op: &impl SrcsAsSlice, src: &Src) -> u32 { let x = self.get_u32_src(op, src); if src.src_mod.is_bnot() { @@ -1602,6 +1604,7 @@ impl OpFoldData<'_> { } } + #[allow(dead_code)] pub fn get_carry_src(&self, op: &impl SrcsAsSlice, src: &Src) -> bool { assert!(src.src_ref.as_ssa().is_some()); let i = op.src_idx(src); @@ -1635,10 +1638,12 @@ impl OpFoldData<'_> { } } + #[allow(dead_code)] pub fn set_pred_dst(&mut self, op: &impl DstsAsSlice, dst: &Dst, b: bool) { self.dsts[op.dst_idx(dst)] = FoldData::Pred(b); } + #[allow(dead_code)] pub fn set_carry_dst(&mut self, op: &impl DstsAsSlice, dst: &Dst, b: bool) { self.dsts[op.dst_idx(dst)] = FoldData::Carry(b); } @@ -1712,6 +1717,7 @@ pub enum PredSetOp { } impl PredSetOp { + #[allow(dead_code)] pub fn eval(&self, a: bool, b: bool) -> bool { match self { PredSetOp::And => a & b,