aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--build.rs2
-rw-r--r--src/long_mode/display.rs6
-rw-r--r--src/long_mode/mod.rs9
-rw-r--r--src/protected_mode/display.rs6
-rw-r--r--src/protected_mode/mod.rs9
-rw-r--r--src/real_mode/display.rs6
-rw-r--r--src/real_mode/mod.rs9
7 files changed, 28 insertions, 19 deletions
diff --git a/build.rs b/build.rs
index a941375..116442e 100644
--- a/build.rs
+++ b/build.rs
@@ -1,5 +1,5 @@
fn main() {
- #[cfg(capstone_bench)]
+ #[cfg(feature="capstone_bench")]
{
println!("cargo:rustc-link-search=/usr/lib/");
println!("cargo:rustc-link-lib=capstone");
diff --git a/src/long_mode/display.rs b/src/long_mode/display.rs
index 147517a..6cf2def 100644
--- a/src/long_mode/display.rs
+++ b/src/long_mode/display.rs
@@ -5,7 +5,7 @@ use core::fmt;
use yaxpeax_arch::{Colorize, ShowContextual, NoColors, YaxColors};
use crate::MEM_SIZE_STRINGS;
-use crate::long_mode::{RegSpec, Opcode, Operand, MergeMode, InstDecoder, Instruction, Segment, PrefixRex, OperandSpec};
+use crate::long_mode::{RegSpec, Opcode, Operand, MergeMode, InstDecoder, Instruction, Segment, PrefixRex};
use yaxpeax_arch::display::DisplaySink;
use yaxpeax_arch::safer_unchecked::GetSaferUnchecked as _;
@@ -4204,7 +4204,7 @@ impl <T: fmt::Write, Y: YaxColors> ShowContextual<u64, [Option<alloc::string::St
Some(s) => { write!(out, " {}", s)?; },
None => {
match self.operands[0] {
- OperandSpec::Nothing => {
+ super::OperandSpec::Nothing => {
return Ok(());
},
_ => {
@@ -4227,7 +4227,7 @@ impl <T: fmt::Write, Y: YaxColors> ShowContextual<u64, [Option<alloc::string::St
Some(s) => { write!(out, ", {}", s)? }
None => {
match &self.operands[i] {
- &OperandSpec::Nothing => {
+ &super::OperandSpec::Nothing => {
return Ok(());
},
_ => {
diff --git a/src/long_mode/mod.rs b/src/long_mode/mod.rs
index 5a3dc51..5ed35e3 100644
--- a/src/long_mode/mod.rs
+++ b/src/long_mode/mod.rs
@@ -807,7 +807,8 @@ impl Operand {
/// provided for parity with [`Instruction::visit_operand`]. this has little utility other than
/// to reuse an `OperandVisitor` on an `Operand` directly.
- pub fn visit<T: OperandVisitor>(&self, visitor: &mut T) -> Result<T::Ok, T::Error> {
+ #[allow(dead_code)] // in some configurations this is unused, but it is internal-only for now, so it would warn.
+ fn visit<T: OperandVisitor>(&self, visitor: &mut T) -> Result<T::Ok, T::Error> {
match self {
Operand::Nothing => {
visitor.visit_other()
@@ -4395,6 +4396,7 @@ impl Opcode {
}
#[inline(always)]
+ #[allow(dead_code)] // in some configurations this is unused, but it is internal-only for now, so it would warn.
fn can_rep(&self) -> bool {
(*self as u32) & 0x2000 != 0
}
@@ -4420,7 +4422,8 @@ impl Instruction {
Operand::from_spec(self, self.operands[i as usize])
}
- /// TODO: make public, document, etc...
+ // TODO: make public when this seems stable and worthwhile. currently only used for display
+ // and Displaysink etc..
///
/// `visit_operand` allows code using operands to better specialize and inline with the logic
/// that would construct an [`Operand`] variant, without having to necessarily construct an
@@ -4430,8 +4433,8 @@ impl Instruction {
/// dispatching on tags may be a substantial factor of overall runtime. `visit_operand` can
/// reduce total overhead in such cases.
#[cfg_attr(feature="profiling", inline(never))]
+ #[allow(dead_code)] // in some configurations this is unused, but it is internal-only for now, so it would warn.
fn visit_operand<T: OperandVisitor>(&self, i: u8, visitor: &mut T) -> Result<T::Ok, T::Error> {
- assert!(i < 4);
let spec = self.operands[i as usize];
match spec {
OperandSpec::Nothing => {
diff --git a/src/protected_mode/display.rs b/src/protected_mode/display.rs
index 6c63f46..dc31dbf 100644
--- a/src/protected_mode/display.rs
+++ b/src/protected_mode/display.rs
@@ -5,7 +5,7 @@ use core::fmt;
use yaxpeax_arch::{Colorize, ShowContextual, NoColors, YaxColors};
use crate::MEM_SIZE_STRINGS;
-use crate::protected_mode::{RegSpec, Opcode, Operand, MergeMode, InstDecoder, Instruction, Segment, PrefixVex, OperandSpec};
+use crate::protected_mode::{RegSpec, Opcode, Operand, MergeMode, InstDecoder, Instruction, Segment, PrefixVex};
use yaxpeax_arch::display::DisplaySink;
use yaxpeax_arch::safer_unchecked::GetSaferUnchecked as _;
@@ -2758,7 +2758,7 @@ impl <T: fmt::Write, Y: YaxColors> ShowContextual<u64, [Option<alloc::string::St
Some(s) => { write!(out, " {}", s)?; },
None => {
match self.operands[0] {
- OperandSpec::Nothing => {
+ super::OperandSpec::Nothing => {
return Ok(());
},
_ => {
@@ -2778,7 +2778,7 @@ impl <T: fmt::Write, Y: YaxColors> ShowContextual<u64, [Option<alloc::string::St
Some(s) => { write!(out, ", {}", s)? }
None => {
match &self.operands[i] {
- &OperandSpec::Nothing => {
+ &super::OperandSpec::Nothing => {
return Ok(());
},
_ => {
diff --git a/src/protected_mode/mod.rs b/src/protected_mode/mod.rs
index b02079e..956b5e3 100644
--- a/src/protected_mode/mod.rs
+++ b/src/protected_mode/mod.rs
@@ -741,7 +741,8 @@ impl Operand {
/// provided for parity with [`Instruction::visit_operand`]. this has little utility other than
/// to reuse an `OperandVisitor` on an `Operand` directly.
- pub fn visit<T: OperandVisitor>(&self, visitor: &mut T) -> Result<T::Ok, T::Error> {
+ #[allow(dead_code)] // in some configurations this is unused, but it is internal-only for now, so it would warn.
+ fn visit<T: OperandVisitor>(&self, visitor: &mut T) -> Result<T::Ok, T::Error> {
match self {
Operand::Nothing => {
visitor.visit_other()
@@ -4309,6 +4310,7 @@ impl Opcode {
}
#[inline(always)]
+ #[allow(dead_code)] // in some configurations this is unused, but it is internal-only for now, so it would warn.
fn can_rep(&self) -> bool {
(*self as u32) & 0x2000 != 0
}
@@ -4334,7 +4336,8 @@ impl Instruction {
Operand::from_spec(self, self.operands[i as usize])
}
- /// TODO: make public, document, etc...
+ // TODO: make public when this seems stable and worthwhile. currently only used for display
+ // and Displaysink etc..
///
/// `visit_operand` allows code using operands to better specialize and inline with the logic
/// that would construct an [`Operand`] variant, without having to necessarily construct an
@@ -4344,8 +4347,8 @@ impl Instruction {
/// dispatching on tags may be a substantial factor of overall runtime. `visit_operand` can
/// reduce total overhead in such cases.
#[cfg_attr(feature="profiling", inline(never))]
+ #[allow(dead_code)] // in some configurations this is unused, but it is internal-only for now, so it would warn.
fn visit_operand<T: OperandVisitor>(&self, i: u8, visitor: &mut T) -> Result<T::Ok, T::Error> {
- assert!(i < 4);
let spec = self.operands[i as usize];
match spec {
OperandSpec::Nothing => {
diff --git a/src/real_mode/display.rs b/src/real_mode/display.rs
index 27353b3..38f95bb 100644
--- a/src/real_mode/display.rs
+++ b/src/real_mode/display.rs
@@ -5,7 +5,7 @@ use core::fmt;
use yaxpeax_arch::{Colorize, ShowContextual, NoColors, YaxColors};
use crate::MEM_SIZE_STRINGS;
-use crate::real_mode::{RegSpec, Opcode, Operand, MergeMode, InstDecoder, Instruction, Segment, PrefixVex, OperandSpec};
+use crate::real_mode::{RegSpec, Opcode, Operand, MergeMode, InstDecoder, Instruction, Segment, PrefixVex};
use yaxpeax_arch::display::DisplaySink;
use yaxpeax_arch::safer_unchecked::GetSaferUnchecked as _;
@@ -2758,7 +2758,7 @@ impl <T: fmt::Write, Y: YaxColors> ShowContextual<u64, [Option<alloc::string::St
Some(s) => { write!(out, " {}", s)?; },
None => {
match self.operands[0] {
- OperandSpec::Nothing => {
+ super::OperandSpec::Nothing => {
return Ok(());
},
_ => {
@@ -2778,7 +2778,7 @@ impl <T: fmt::Write, Y: YaxColors> ShowContextual<u64, [Option<alloc::string::St
Some(s) => { write!(out, ", {}", s)? }
None => {
match &self.operands[i] {
- &OperandSpec::Nothing => {
+ &super::OperandSpec::Nothing => {
return Ok(());
},
_ => {
diff --git a/src/real_mode/mod.rs b/src/real_mode/mod.rs
index e34444e..1ea89cd 100644
--- a/src/real_mode/mod.rs
+++ b/src/real_mode/mod.rs
@@ -741,7 +741,8 @@ impl Operand {
/// provided for parity with [`Instruction::visit_operand`]. this has little utility other than
/// to reuse an `OperandVisitor` on an `Operand` directly.
- pub fn visit<T: OperandVisitor>(&self, visitor: &mut T) -> Result<T::Ok, T::Error> {
+ #[allow(dead_code)] // in some configurations this is unused, but it is internal-only for now, so it would warn.
+ fn visit<T: OperandVisitor>(&self, visitor: &mut T) -> Result<T::Ok, T::Error> {
match self {
Operand::Nothing => {
visitor.visit_other()
@@ -4309,6 +4310,7 @@ impl Opcode {
}
#[inline(always)]
+ #[allow(dead_code)] // in some configurations this is unused, but it is internal-only for now, so it would warn.
fn can_rep(&self) -> bool {
(*self as u32) & 0x2000 != 0
}
@@ -4334,7 +4336,8 @@ impl Instruction {
Operand::from_spec(self, self.operands[i as usize])
}
- /// TODO: make public, document, etc...
+ // TODO: make public when this seems stable and worthwhile. currently only used for display
+ // and Displaysink etc..
///
/// `visit_operand` allows code using operands to better specialize and inline with the logic
/// that would construct an [`Operand`] variant, without having to necessarily construct an
@@ -4344,8 +4347,8 @@ impl Instruction {
/// dispatching on tags may be a substantial factor of overall runtime. `visit_operand` can
/// reduce total overhead in such cases.
#[cfg_attr(feature="profiling", inline(never))]
+ #[allow(dead_code)] // in some configurations this is unused, but it is internal-only for now, so it would warn.
fn visit_operand<T: OperandVisitor>(&self, i: u8, visitor: &mut T) -> Result<T::Ok, T::Error> {
- assert!(i < 4);
let spec = self.operands[i as usize];
match spec {
OperandSpec::Nothing => {