summary refs log tree commit diff
path: root/ripple
diff options
context:
space:
mode:
authoredef <edef@unfathomable.blue>2022-07-29 12:33:18 +0000
committeredef <edef@unfathomable.blue>2022-07-29 12:33:18 +0000
commit20c0466664a5ca6ac32c40e0cdeaef9afbed2c18 (patch)
treec6ead3898f5f981208c1173b01a9a0ea44ccd47d /ripple
parent261431020b687e4fab500a51c868c22f7054c2a3 (diff)
downloadunf-legacy-20c0466664a5ca6ac32c40e0cdeaef9afbed2c18.tar.zst
ripple/minitrace: match identifier style in macros
Having macro identifiers match the "real" identifier style makes macro
code markedly more readable.

Change-Id: Ib675390cc04941ce782c75b2ee686709441081fc
Diffstat (limited to 'ripple')
-rw-r--r--ripple/minitrace/src/main.rs24
1 files changed, 12 insertions, 12 deletions
diff --git a/ripple/minitrace/src/main.rs b/ripple/minitrace/src/main.rs
index 7fa5ec7..523cc09 100644
--- a/ripple/minitrace/src/main.rs
+++ b/ripple/minitrace/src/main.rs
@@ -94,27 +94,27 @@ impl Process {
 }
 
 macro_rules! define_syscalls {
-	(enum $enum:ident {
-		$(fn $id:ident ( $($arg_id:ident : $arg_ty:ty),* ) -> $ret:ty = $nr:literal ;)*
+	(enum $SyscallEntry:ident {
+		$(fn $syscall:ident ( $($arg:ident : $Arg:ty),* ) -> $Ret:ty = $nr:literal ;)*
 	}) => {
 		#[derive(Debug, Copy, Clone)]
 		#[allow(non_camel_case_types)]
 		// TODO(edef): re-enable dead_code lint when we start fully interpreting syscall args
 		#[allow(dead_code)]
-		enum $enum {
-			$($id {
-				$($arg_id : $arg_ty),*
+		enum $SyscallEntry {
+			$($syscall {
+				$($arg : $Arg),*
 			}),*
 		}
 
-		impl $enum {
-			fn from_regs(regs: libc::user_regs_struct) -> Result<$enum> {
+		impl $SyscallEntry {
+			fn from_regs(regs: libc::user_regs_struct) -> Result<$SyscallEntry> {
 				Ok(match (regs.orig_rax, [regs.rdi, regs.rsi, regs.rdx, regs.r10, regs.r8, regs.r9]) {
 					$(
-						($nr, [$($arg_id),*, ..]) => $enum::$id {
-							$($arg_id: match SyscallArg::try_from_reg($arg_id) {
+						($nr, [$($arg),*, ..]) => $SyscallEntry::$syscall {
+							$($arg: match SyscallArg::try_from_reg($arg) {
 								Some(x) => x,
-								None => bail!("couldn't parse {}(2) {}: 0x{:08x}", stringify!($id), stringify!($arg_id), $arg_id)
+								None => bail!("couldn't parse {}(2) {}: 0x{:08x}", stringify!($syscall), stringify!($arg), $arg)
 							}),*
 						},
 					)*
@@ -129,7 +129,7 @@ macro_rules! syscall_bitflags {
 	(
 		struct $BitFlags:ident: $T:ty {
 			$(
-				const $Flag:ident = $value:expr;
+				const $FLAG:ident = $value:expr;
 			)*
 		}
 
@@ -138,7 +138,7 @@ macro_rules! syscall_bitflags {
 		bitflags! {
 			struct $BitFlags: $T {
 				$(
-					const $Flag = $value;
+					const $FLAG = $value;
 				)*
 			}
 		}