From 0b77a69691d6c7ef7117f9c141bd1301d083011c Mon Sep 17 00:00:00 2001 From: Aaron Giles Date: Thu, 24 Jul 2008 06:26:47 +0000 Subject: From: Atari Ace [mailto:atari_ace@verizon.net] Subject: [patch] Conditional code cleanup resubmit Hi mamedev, This is a resubmit of a previous patch. The earlier version would not compile with 32-bit MSVC, due to the fact that its linker required external dependencies in dead code to be met before dead code elimination was done, causing linker errors. The proper fix for this would be to add the necessary dependencies, so I instead simply left the conditional code in place in winalloc.c and chd.c. ~aa Original submission email below: ---- Conditionally compiled code tends to bitrot, so MAME should try to avoid it as much as possible. I sent a patch six months ago to eliminate conditional code associated with logging, here's another patch that does more of this. Some notes: 1. drc_ops.c: I couldn't find a LOG_CODE anywhere, so I used if (0). 2. romload.c: I converted all the users of debugload to use LOG((...)) instead, following the traditional conditional logging pattern. 3. windows/sound.c: I eliminated the separate sound log and directed the few outputs to the error log. ~aa --- src/emu/cpu/drcuml.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'src/emu/cpu/drcuml.c') diff --git a/src/emu/cpu/drcuml.c b/src/emu/cpu/drcuml.c index a3e46bfbcf9..1a85d93f0e9 100644 --- a/src/emu/cpu/drcuml.c +++ b/src/emu/cpu/drcuml.c @@ -1369,9 +1369,7 @@ static void simplify_instruction_with_no_flags(drcuml_block *block, drcuml_instr static const UINT64 instsizemask[] = { 0, 0, 0, 0, 0xffffffff, 0, 0, 0, U64(0xffffffffffffffff) }; static const UINT64 paramsizemask[] = { 0xff, 0xffff, 0xffffffff, U64(0xffffffffffffffff) }; drcuml_opcode origop = inst->opcode; -#if LOG_SIMPLIFICATIONS drcuml_instruction orig = *inst; -#endif switch (inst->opcode) { @@ -1688,15 +1686,13 @@ static void simplify_instruction_with_no_flags(drcuml_block *block, drcuml_instr break; } -#if LOG_SIMPLIFICATIONS - if (memcmp(&orig, inst, sizeof(orig)) != 0) + if (LOG_SIMPLIFICATIONS && memcmp(&orig, inst, sizeof(orig)) != 0) { char disasm1[256], disasm2[256]; drcuml_disasm(&orig, disasm1, block->drcuml); drcuml_disasm(inst, disasm2, block->drcuml); mame_printf_debug("Simplified: %-50.50s -> %s\n", disasm1, disasm2); } -#endif /* if the opcode changed, validate and reoptimize */ if (inst->opcode != origop) -- cgit v1.2.3-70-g09d2