From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id 0cXGNGOx5GovAhYAWB0awg (envelope-from ) for ; Fri, 30 Oct 2026 11:01:55 -0400 Received: by simark.ca (Postfix, from userid 112) id D23F7378002; Fri, 30 Oct 2026 11:01:55 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-5.3 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [IPv6:2620:52:6:3111::32]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 488531E023 for ; Fri, 30 Oct 2026 11:01:54 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 17CB84BAE7DB for ; Fri, 30 Oct 2026 15:01:53 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 17CB84BAE7DB Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id DF0E24BAE7DB for ; Fri, 30 Oct 2026 15:01:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org DF0E24BAE7DB Authentication-Results: sourceware.org; dmarc=fail (p=none dis=none) header.from=efficios.com Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=efficios.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org DF0E24BAE7DB Authentication-Results: sourceware.org; arc=none smtp.remote-ip=158.69.221.121 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1793372488; cv=none; b=jS1oQ1PHXfTW4oqsOz0tsv3HA6163aRUS0BugQrC7O0T0K5NAb9mtmzdi91QKZohGAmk8Ib9woAlmlP8/o0TtT0SsQZK0AjqufFMqk3K3PkIH/1X+5NX7HKD++XFLrFSTr1vhrRCuxruTpbUHijI++Shht8VWmbAsgVe7GRx82M= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1793372488; c=relaxed/simple; bh=ONqVyGMmVNe9Osz4KD1eamTJuD+pF/UKefeSAiJzj3Q=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=PPuHotV9+k3K+AZXzAbAZDha0GBPq4Eyzpf9btUnucJXqn8zGO0/YyYYPruPUG137If+6YMKKxXMEjEDH9F65YRPvs0VJcqcjJHx0KA6Ducki5t8yuSRXnCxsFs0UE7kfTRO8Vx29ep40+pcXlnq5JCrL7Ai7z7WsmQJzInn6EE= ARC-Authentication-Results: i=1; sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DF0E24BAE7DB Received: by simark.ca (Postfix) id B10621E023; Fri, 30 Oct 2026 11:01:23 -0400 (EDT) From: Simon Marchi To: gdb-patches@sourceware.org Cc: Simon Marchi , Andrew Burgess , Mike Frysinger , Stephane Carrez Subject: [PATCH] sim/m68hc11: remove unused current_insn_size variable Date: Fri, 30 Oct 2026 11:01:20 -0400 Message-ID: <20261030150123.1147003-1-simon.marchi@efficios.com> X-Mailer: git-send-email 2.56.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org 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", 2001-05-20). Remove the variable, the code computing it, and the disabled check. Cc: Andrew Burgess Cc: Mike Frysinger Cc: Stephane Carrez Change-Id: Ibd7ee5ac16d5511d40a9ddcc175a94dcbc387b2b --- sim/m68hc11/gencode.c | 41 ----------------------------------------- 1 file changed, 41 deletions(-) diff --git a/sim/m68hc11/gencode.c b/sim/m68hc11/gencode.c index 248005a9dd84..822c90ef9a5e 100644 --- a/sim/m68hc11/gencode.c +++ b/sim/m68hc11/gencode.c @@ -1140,7 +1140,6 @@ static struct m6811_opcode_def m6812_page2_opcodes[] = { static int indent_level = 2; -static int current_insn_size = 0; /* Fatal error message and exit. This method is called when an inconsistency is detected in the generation table. */ @@ -1344,7 +1343,6 @@ gen_fetch_operands (FILE *fp, int col, fatal_error (opcode, "Wrong use of '*', 'addr' already used"); addr_set = 1; - current_insn_size += 1; print (fp, col, "addr = (uint16_t) cpu_fetch8 (cpu);"); print (fp, col, "%s%s = memory_read%s (cpu, addr);", vars[cur_var], operand_size, operand_size); @@ -1357,25 +1355,21 @@ gen_fetch_operands (FILE *fp, int col, addr_set = 1; if (strncmp (operands, "(x)", 3) == 0) { - current_insn_size += 1; print (fp, col, "addr = cpu_get_x (cpu) + (uint16_t) cpu_fetch8 (cpu);"); operands += 3; } else if (strncmp (operands, "(y)", 3) == 0) { - current_insn_size += 1; print (fp, col, "addr = cpu_get_y (cpu) + (uint16_t) cpu_fetch8 (cpu);"); operands += 3; } else if (strncmp (operands, "()", 2) == 0) { - current_insn_size += 2; print (fp, col, "addr = cpu_fetch16 (cpu);"); operands += 2; } else if (strncmp (operands, "[]", 2) == 0) { - current_insn_size += 1; print (fp, col, "addr = cpu_get_indexed_operand_addr (cpu, 0);"); operands += 2; } @@ -1395,7 +1389,6 @@ gen_fetch_operands (FILE *fp, int col, if (strncmp (operands, "x)", 2) == 0) { addr_set = 1; - current_insn_size += 1; print (fp, col, "addr = cpu_get_x (cpu) + (uint16_t) cpu_fetch8 (cpu);"); print (fp, col, "%s%s = memory_read%s (cpu, addr);", vars[cur_var], operand_size, operand_size); @@ -1404,7 +1397,6 @@ gen_fetch_operands (FILE *fp, int col, else if (strncmp (operands, "y)", 2) == 0) { addr_set = 1; - current_insn_size += 1; print (fp, col, "addr = cpu_get_y (cpu) + (uint16_t) cpu_fetch8 (cpu);"); print (fp, col, "%s%s = memory_read%s (cpu, addr);", vars[cur_var], operand_size, operand_size); @@ -1413,7 +1405,6 @@ gen_fetch_operands (FILE *fp, int col, else if (strncmp (operands, ")", 1) == 0) { addr_set = 1; - current_insn_size += 2; print (fp, col, "addr = cpu_fetch16 (cpu);"); print (fp, col, "%s%s = memory_read%s (cpu, addr);", vars[cur_var], operand_size, operand_size); @@ -1421,7 +1412,6 @@ gen_fetch_operands (FILE *fp, int col, } else if (strncmp (operands, "@)", 2) == 0) { - current_insn_size += 2; print (fp, col, "addr = cpu_fetch16 (cpu);"); print (fp, col, "%s%s = memory_read%s (cpu, addr);", vars[cur_var], operand_size, operand_size); @@ -1451,7 +1441,6 @@ gen_fetch_operands (FILE *fp, int col, if (strncmp (operands, "]", 1) == 0) { addr_set = 1; - current_insn_size += 1; print (fp, col, "addr = cpu_get_indexed_operand_addr (cpu,0);"); print (fp, col, "%s%s = memory_read%s (cpu, addr);", vars[cur_var], operand_size, operand_size); @@ -1461,7 +1450,6 @@ gen_fetch_operands (FILE *fp, int col, removed because it may be that there is a typo in strncmp test below. */ else if (strncmp (operands, "]", 1) == 0) { - current_insn_size += 1; print (fp, col, "%s%s = cpu_get_indexed_operand%s (cpu,0);", vars[cur_var], operand_size, operand_size); operands += 1; @@ -1482,7 +1470,6 @@ gen_fetch_operands (FILE *fp, int col, if (strncmp (operands, "}", 1) == 0) { - current_insn_size += 1; print (fp, col, "%s%s = cpu_get_indexed_operand%s (cpu, 1);", vars[cur_var], operand_size, operand_size); operands += 1; @@ -1525,7 +1512,6 @@ gen_fetch_operands (FILE *fp, int col, fatal_error (opcode, "Wrong use of 'r'"); addr_set = 1; - current_insn_size += 1; print (fp, col, "addr = cpu_fetch_relbranch (cpu);"); break; @@ -1534,19 +1520,10 @@ gen_fetch_operands (FILE *fp, int col, fatal_error (opcode, "Wrong use of 'R'"); addr_set = 1; - current_insn_size += 2; print (fp, col, "addr = cpu_fetch_relbranch16 (cpu);"); break; case '#': - if (strcmp (operand_size, "8") == 0) - { - current_insn_size += 1; - } - else - { - current_insn_size += 2; - } print (fp, col, "%s%s = cpu_fetch%s (cpu);", vars[cur_var], operand_size, operand_size); break; @@ -1655,7 +1632,6 @@ gen_save_result (FILE *fp, int col, case '*': if (addr_set == 0) { - current_insn_size += 1; print (fp, col, "addr = (uint16_t) cpu_fetch8 (cpu);"); } result_size = operand_size; @@ -1668,7 +1644,6 @@ gen_save_result (FILE *fp, int col, { if (addr_set == 0) { - current_insn_size += 1; print (fp, col, "addr = cpu_get_x (cpu) + cpu_fetch8 (cpu);"); } print (fp, col, "memory_write%s (cpu, addr, dst%s);", @@ -1680,7 +1655,6 @@ gen_save_result (FILE *fp, int col, { if (addr_set == 0) { - current_insn_size += 1; print (fp, col, "addr = cpu_get_y (cpu) + cpu_fetch8 (cpu);"); } print (fp, col, "memory_write%s (cpu, addr, dst%s);", @@ -1692,7 +1666,6 @@ gen_save_result (FILE *fp, int col, { if (addr_set == 0) { - current_insn_size += 2; print (fp, col, "addr = cpu_fetch16 (cpu);"); } print (fp, col, "memory_write%s (cpu, addr, dst%s);", @@ -1719,7 +1692,6 @@ gen_save_result (FILE *fp, int col, { if (addr_set == 0) { - current_insn_size += 1; print (fp, col, "addr = cpu_get_indexed_operand_addr (cpu,0);"); } print (fp, col, "memory_write%s (cpu, addr, dst%s);", @@ -1736,7 +1708,6 @@ gen_save_result (FILE *fp, int col, case '{': if (strncmp (operands, "}", 1) == 0) { - current_insn_size += 1; print (fp, col, "addr = cpu_get_indexed_operand_addr (cpu, 1);"); print (fp, col, "memory_write%s (cpu, addr, dst%s);", operand_size, operand_size); @@ -1880,11 +1851,7 @@ gen_interpreter_for_table (FILE *fp, int col, const char *cycles_table_name) { int i; - int init_size; - init_size = table == m6811_page1_opcodes - || table == m6812_page1_opcodes? 1 : 2; - /* Get the opcode and dispatch directly. */ print (fp, col, "op = cpu_fetch8 (cpu);"); print (fp, col, "cpu_add_cycles (cpu, %s[op]);", cycles_table_name); @@ -1899,15 +1866,7 @@ gen_interpreter_for_table (FILE *fp, int col, if (i > 0 && table[i].insn_code == table[i - 1].insn_code) continue; - current_insn_size = init_size; gen_interp (fp, col, &table[i]); -#if 0 - if (current_insn_size != table[i].insn_size) - { - fatal_error (&table[i], "Insn size %ld inconsistent with %ld", - current_insn_size, table[i].insn_size); - } -#endif } print (fp, col, "default:\n"); base-commit: bb0a4659ab1eb997ad095181ef309f7b7d9aa289 -- 2.56.0