sim/m68hc11: remove unused current_insn_size variable
Removes unused `current_insn_size` variable from the m68hc11 simulator, fixing compiler warnings.
This patch removes the current_insn_size variable from the m68hc11 simulator’s code generation source file (gencode.c). The variable, along with the code that computed it, was only used for an instruction size consistency check that has been disabled (#if 0) since 2001. Compiling with recent Clang flags this variable as unused, leading to warnings. The patch removes the variable, its computation, and the disabled check, cleaning up the codebase.
- proposer
Submits a patch to remove the unused `current_insn_size` variable and associated code from the m68hc11 simulator.
“Building the m68hc11 simulator with a recent clang fails with: /home/smarchi/src/binutils-gdb/sim/m68hc11/gencode.c:1143:12: error: variable 'current_insn_size' set but not used [-Werror,-Wunused-but-set-global] The only read of current_insn_size is an instruction size consistency check, which has been disabled with "#if 0" since commit 81e09ed8322b ("Improve HC11 simulator to support HC12"…”
In Details
This patch addresses unused code in the sim/m68hc11/gencode.c file, which is part of the Motorola 68HC11 microcontroller simulator within binutils/gdb. The variable current_insn_size was used to track the size of the instruction being generated. However, the code that utilized this variable for an internal consistency check has been commented out (#if 0) for many years. Consequently, the variable is now flagged as unused by modern compilers like Clang, and this patch removes it entirely, along with the dead code, to clean up the source and resolve warnings.
- simulator
- A program that mimics the behavior of a hardware device or system. In this context, it simulates the execution of instructions for a specific microcontroller or processor.
- m68hc11
- A popular 8-bit microcontroller family manufactured by Motorola (now Freescale/NXP). Binutils includes a simulator for it.
- gencode.c
- A source file likely containing code generation logic for the simulator, possibly responsible for translating instruction definitions into executable simulation code.
- instruction size consistency check
- A verification mechanism to ensure that the generated code correctly reflects the size of the instructions being simulated. This check appears to have been disabled.