From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id eJjtAveGAGvQxSQAWB0awg (envelope-from ) for ; Fri, 20 Nov 2026 12:44:23 -0500 Authentication-Results: simark.ca; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=MMapwOf3; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id E774E1E023; Fri, 20 Nov 2026 12:44:22 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-6.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,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 289E91E023 for ; Fri, 20 Nov 2026 12:44:22 -0500 (EST) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 22DE7431572B for ; Fri, 20 Nov 2026 17:44:20 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 22DE7431572B Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=MMapwOf3 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTP id ACCAE44B7016 for ; Fri, 20 Nov 2026 17:43:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org ACCAE44B7016 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org ACCAE44B7016 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1795196634; cv=none; b=CMWkQrckUhehfvzuUJnR2UU6TTu2MNrNy8pvN5WpCvSVb9eUzY/hrGhtCb/C9uB/rePTwmvoG81whJPqMWjlwUprwrXw5nnnwx5XmQZzGodeM4w+sDinszqfaeMRdTYZ86J/LUZxXC+W+EWBVAvNioDiijdpq2z99NC3NjCRnlY= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1795196634; c=relaxed/simple; bh=O5IX+qnmKfxt8YZu7JcEkF59Xz9LjDQxXqJA9nISMiY=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=o2bEbi3r7yxOZgCcNK2Cmt3AsVu4eDh5aF0qEleXWMVLpexj5g+5k4S+TYKK+2P4YpvlnjXAeTslVpEcuL/r0Y3LUv7pHsgd/Q8x2eqWOIfNjfWeyLc34zcJNbqySC4ZX+zGpU0SuKhY5GlYWGk43125r5wtthsSELO0QWuTdtI= ARC-Authentication-Results: i=1; sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=MMapwOf3 DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org ACCAE44B7016 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1795196634; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=UhFKM9VcPyvUZV/SUpsHt5quq7TiPQZaZDw0zhxXX3A=; b=MMapwOf3+vmHOPY4a51OPEjTtrqs5xd88k+9+QiC59OuzimD3ZiGsrpDFq+Lkr0VfZIwy7 pxFImnNv94Fsu6Er561nJvGpR+t/wXUoufveviwGQx4zUTy56i/QzDSc5gUQUb+TV5AvAe Ah+sdgmZ6VktFpc5VA6UsSAxfY236nQ= Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-631-3p6GZ_1cMIW7D52s7thUeQ-1; Fri, 20 Nov 2026 17:43:50 +0000 X-MC-Unique: 3p6GZ_1cMIW7D52s7thUeQ-1 X-Mimecast-MFC-AGG-ID: 3p6GZ_1cMIW7D52s7thUeQ_1795196629 Received: by mail-wr1-f71.google.com with SMTP id ffacd0b85a97d-48e0461e040so917180f8f.0 for ; Fri, 20 Nov 2026 09:43:49 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1795196629; x=1795801429; h=content-type:mime-version:message-id:date:references:in-reply-to :subject:cc:to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to:content-type; bh=UhFKM9VcPyvUZV/SUpsHt5quq7TiPQZaZDw0zhxXX3A=; b=jG76srQ9UlM1plrDC1/3orTmahYm8QdSuz6bp011TEX/XR/rlz/YIIxDASfW4vyWd+ KBWVHBGkmh6gwBECJrMFuNbdI4Cu3sCq4WoCPJuC4gULSWF4z1ehmhP6+NCCDtzGR9Mf 2MpL47XNxFBnfRQ58vGWRcsP+OHaGmTkb0GcFFsx/JlnUMd44Q80ofujaGtroftB9n8t oNhf5XtKbDfo9fp2X4dqDSWVgr4HxYOBR9+9IoVHfspFNAEADlxOjgOkjY1+MaNDnLfu ZxlguZxK/0ZvkKX7cRfLheJ6VVHpO6PKdyBMZnrMiRZG6E0+bSiCbyX7S0SWfenv/bJx CEUQ== X-Forwarded-Encrypted: i=1; AL+hErFs98csBsS+Xo06EgY0lS/1c3Fwb82ir/r7M3W/unxTNfQ6F1IJud7dfrkozB+Fnhg7VS0RXUSb95OoDA==@sourceware.org X-Gm-Message-State: APuU4Z/Wa0/halmIndvAZT+jGtnYrJ1owaa2Rx9qA0HTuHCAN0tpA9hq 7jTBxRoixf33pRLXcH4BSI49ZEc/6clQ4haTIdztASoHgEmc2X2XMtl6NoOtgWkjRmjXB7UZ94A caU6Rko5k1nIQ2OB6ppCa/6/iIUWb1Z0vCfBdpLEasdrvI9X3o6Nna8g+p0Eoifk= X-Gm-Gg: AZFdTZfNsWkaKqO6v5bmtnv9qoglmxEKYPxDjCS+KNRa42z6yEKi7jNh801nJ3mqrSB Xk4NV1W5IK1+40Cas8vybKjBllj5yHHFdvmKUJc7KCCwhSgBw4jBndFWkjjs7jdMo3W0Zp6hyMH /9JSyUVc3wg+qyr6jjxBq2KyitMyBX4iiKQGYEHwMitlc/7l/bzmgoOpSLcLJTx0vc+9WKwHH/J 00CD+EQjCs76Cd3NyjURSbnITrr7izpubEnOiAvnXqcBZOQGxIcST+4qCQBXRndQP7lSMDCOwIh riWy5/llAz9YTyITasGgBP8aOCrRjT1A4KliYDnpp9ftlZKvDBwaJjmEN1HFdQHcak1gWVt9ZTL 2plzoDKxmW2Py8fOgs1icVE8VpVlrmhaC+is9LukZGVisvA== X-Received: by 2002:a05:6000:2689:b0:488:7dc6:4e9 with SMTP id ffacd0b85a97d-4abb0c5d752mr8405838f8f.10.1795196628748; Fri, 20 Nov 2026 09:43:48 -0800 (PST) X-Received: by 2002:a05:6000:2689:b0:488:7dc6:4e9 with SMTP id ffacd0b85a97d-4abb0c5d752mr8405785f8f.10.1795196628278; Fri, 20 Nov 2026 09:43:48 -0800 (PST) Received: from localhost ([83.216.138.189]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4ab6b110d56sm6898658f8f.40.2026.11.20.09.43.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Nov 2026 09:43:47 -0800 (PST) From: Andrew Burgess To: Simon Marchi , gdb-patches@sourceware.org Cc: Simon Marchi , Mike Frysinger , Stephane Carrez Subject: Re: [PATCH] sim/m68hc11: remove unused current_insn_size variable In-Reply-To: <20261030150123.1147003-1-simon.marchi@efficios.com> References: <20261030150123.1147003-1-simon.marchi@efficios.com> Date: Fri, 20 Nov 2026 17:43:47 +0000 Message-ID: MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: oUxermQqV8aUMC3FfZIF63wuWYLmXPV3XgyOr5UL4ks_1795196629 X-Mimecast-Originator: redhat.com Content-Type: text/plain 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 Simon Marchi writes: > 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. Fine with me. Anything disabled for that long counts as dead code in my book. Approved-By: Andrew Burgess Thanks, Andrew > > 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