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 <faith.ekstrand@collabora.com>
Reviewed-by: Mel Henning <mhenning@darkrefraction.com>
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36849>
(cherry picked from commit 5c019bdee5)
This commit is contained in:
Antonio Ospite 2025-08-11 11:39:16 +02:00 committed by Eric Engestrom
parent f27ba53aca
commit 36f3c9c422
2 changed files with 7 additions and 1 deletions

View file

@ -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

View file

@ -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,