From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id GcMVMsKKlGp8IhUAWB0awg (envelope-from ) for ; Sun, 30 Aug 2026 15:55:46 -0400 Authentication-Results: simark.ca; dkim=pass (1024-bit key; unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=SEhgkjTM; dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=jp//AqTX; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=d6emnuSO; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=B29Bff49; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id C7ACA1E033; Sun, 30 Aug 2026 15:55:46 -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.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, 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 [38.145.34.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 89DE61E033 for ; Sun, 30 Aug 2026 15:55:45 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B63224BA2E22 for ; Sun, 30 Aug 2026 19:55:44 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B63224BA2E22 Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=SEhgkjTM; dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=jp//AqTX; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=d6emnuSO; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=B29Bff49 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) by sourceware.org (Postfix) with ESMTPS id 4B44A4BA23DE for ; Sun, 30 Aug 2026 19:54:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 4B44A4BA23DE Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 4B44A4BA23DE Authentication-Results: sourceware.org; arc=none smtp.remote-ip=195.135.223.131 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1788119689; cv=none; b=Qmaa5YRHkOzkELohobdM333m3fhO0iIFTpDmM2KQQgloe0/5cYND1BwSUcnc8wvfW8HYYgO0gfbft1Z7rB6B/6+HRC/PZwVkGbju+XoyM8ex74vUFfF969rsn2bpR/4GoqnpNJ+tyeFH0yjO/S9LXnl5OEdqZqsn6IUOUFlYJyo= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1788119689; c=relaxed/simple; bh=WruX+U0zqXDpZMTBS8aw91zcy9zrx0tKt8qicxh7EY0=; h=DKIM-Signature:DKIM-Signature:DKIM-Signature:DKIM-Signature: Message-ID:Date:MIME-Version:Subject:From:To; b=b5JHANAEz3A8exgpkQxlnuNi14C//Ifr7z2GMTtRZ4lceuD2uSfh1INSHre8NH6BcwZ7HuA1EQYfATkacR3OHfMYid34TVIE0TGIfAt18x7796nHiGgJozsvrI8cZMqs6iFoJVZPfQ4Vkb1YOViMjzwRdZ4i97uPfXs8VWYCg3g= ARC-Authentication-Results: i=1; sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=SEhgkjTM; dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=jp//AqTX; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=d6emnuSO; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=B29Bff49 DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4B44A4BA23DE Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 127B71F846 for ; Sun, 30 Aug 2026 19:54:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1788119684; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2mM4vF+Sdv0vks+OFci+KtjbIGSmwIkUKS1agteOOvg=; b=SEhgkjTMT7Wdq/GQ/W859eZk8T5XBZlLLZ0zlP3enJlOeQPzCPLooH0VJ3SbraTWmjNGEF SvjIrfdFm27XmqkO0y4WbprtVCRMOzpSwnrKm+SpyawXxmAR9c1RpNTdWcvS08m+OvmzEW kD9Xi5FlA/HfF5XlyLKndtnAcmb87J0= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1788119684; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2mM4vF+Sdv0vks+OFci+KtjbIGSmwIkUKS1agteOOvg=; b=jp//AqTXfA41zUnEXCyXtP7AbE2BUU9SIgx0DP+sn1AUrWoRSEF9Ft3EUbPYXTh68NQNK0 7LY83rZK1fYE/IBQ== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=d6emnuSO; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=B29Bff49 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1788119680; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2mM4vF+Sdv0vks+OFci+KtjbIGSmwIkUKS1agteOOvg=; b=d6emnuSOOsss694T9iT+9FPCcbcB2ZGYWvKT/zumrmQXjBY8/FQOzuzy2l8S0oB8hkgS9D lv6sG3hCvAg97kTrIxZh7neJi/nrIz510FxMlLQ8q+tPFJQnzUvs1RSEha4vDarS0swoo4 DjB4YV5OW8GTYVKKtPIoHwgbQUXogvM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1788119680; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2mM4vF+Sdv0vks+OFci+KtjbIGSmwIkUKS1agteOOvg=; b=B29Bff49TgjEBrXzEpxesjNTb5zjfK9WrtnER7jAlaHzdXF9G9VBqcIaEj3+STxE6k0yCD MgYqyoAHjOtorHDA== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id DC0F113685 for ; Sun, 30 Aug 2026 19:54:39 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id oCU+NH+KlGovVAAAD6G6ig (envelope-from ) for ; Sun, 30 Aug 2026 19:54:39 +0000 Message-ID: Date: Sun, 30 Aug 2026 21:54:39 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] [gdb] Use shfmt on regformats/regdat.sh From: Tom de Vries To: gdb-patches@sourceware.org References: <20260828141241.3921145-1-tdevries@suse.de> Content-Language: en-US In-Reply-To: <20260828141241.3921145-1-tdevries@suse.de> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 127B71F846 X-Rspamd-Server: rspamd1.dmz-prg2.suse.org X-Rspamd-Action: no action X-Spamd-Result: default: False [-4.51 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:dkim,suse.de:mid]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; MID_RHS_MATCH_FROM(0.00)[]; RCPT_COUNT_ONE(0.00)[1]; DNSWL_BLOCKED(0.00)[2a07:de40:b281:106:10:150:64:167:received,2a07:de40:b281:104:10:150:64:97:from]; RCVD_TLS_ALL(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; TO_DN_NONE(0.00)[]; PREVIOUSLY_DELIVERED(0.00)[gdb-patches@sourceware.org]; DKIM_TRACE(0.00)[suse.de:+] 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 On 8/28/26 4:12 PM, Tom de Vries wrote: > Run shfmt [1] on gdb/regformats/regdat.sh: > ... > $ shfmt \ > --language-dialect=posix \ > --indent=4 \ > --func-next-line \ > --space-redirects \ > --write \ > gdb/regformats/regdat.sh > ... > followed by emacs whitespace-cleanup (because shfmt doesn't know about mixed > tab/spaces indentation). > > Normalizes things like: > ... > if true > then > ... > to: > ... > if true; then > ... > as suggested by Simon [2]. > > Also: > - fixes up inconsistent indentation I've submitted a v2 ( https://sourceware.org/pipermail/gdb-patches/2026-August/229844.html ) that splits off this part into a separate patch, for easier review. Thanks, - TOm > - makes sure statements are on their own line > - removes double empty line > - minor whitespace changes: > - do_read () -> do_read() > - cat < cat << EOF > > [1] https://github.com/mvdan/sh > [2] https://sourceware.org/pipermail/gdb-patches/2026-August/229818.html > --- > gdb/regformats/regdat.sh | 149 +++++++++++++++++++-------------------- > 1 file changed, 71 insertions(+), 78 deletions(-) > > diff --git a/gdb/regformats/regdat.sh b/gdb/regformats/regdat.sh > index f93270ba0ca..0df4d07c44b 100755 > --- a/gdb/regformats/regdat.sh > +++ b/gdb/regformats/regdat.sh > @@ -23,17 +23,14 @@ set -u > # Format of the input files > read="type entry" > > -do_read () > +do_read() > { > type="" > entry="" > - while read -r line > - do > - if test "${line}" = "" > - then > + while read -r line; do > + if test "${line}" = ""; then > continue > - elif expr "${line}" : "#" > /dev/null > - then > + elif expr "${line}" : "#" > /dev/null; then > continue > else > > @@ -42,21 +39,20 @@ do_read () > # Work around this by eliminating ``::'' .... > line="$(echo "${line}" | sed -e 's/::/: :/g' -e 's/::/: :/g')" > > - OFS="${IFS}" ; IFS="[:]" > + OFS="${IFS}" > + IFS="[:]" > # Word-splitting on read variable is required. > # shellcheck disable=SC2086 > - eval read ${read} < + eval read ${read} << EOF > ${line} > EOF > IFS="${OFS}" > > # .... and then going back through each field and strip out those > # that ended up with just that space character. > - for r in ${read} > - do > + for r in ${read}; do > eval "rvalue=\$$r" > - if test "${rvalue:-}" = " " > - then > + if test "${rvalue:-}" = " "; then > eval "$r=''" > fi > done > @@ -64,8 +60,7 @@ EOF > break > fi > done > - if [ -n "${type}" ] > - then > + if [ -n "${type}" ]; then > true > else > false > @@ -73,13 +68,13 @@ EOF > } > > if test ! -r "$1"; then > - echo "$0: Could not open $1." 1>&2 > - exit 1 > + echo "$0: Could not open $1." 1>&2 > + exit 1 > fi > > -copyright () > +copyright() > { > -cat < + cat << EOF > /* *INDENT-OFF* */ /* THIS FILE IS GENERATED */ > > /* A register protocol for GDB, the GNU debugger. > @@ -105,7 +100,6 @@ cat < EOF > } > > - > exec > new-"$3" > copyright "$1" > echo '#include "regdef.h"' > @@ -121,51 +115,50 @@ expedite=x > feature=x > osabi=unknown > exec < "$1" > -while do_read > -do > - if test "${type}" = "name"; then > - name="${entry}" > - > - echo "const_target_desc_up tdesc_${name};" > - echo "" > - > - # This is necessary for -Wmissing-declarations. > - echo "void init_registers_${name} (void);" > - > - echo "void" > - echo "init_registers_${name} (void)" > - echo "{" > - echo " target_desc_up result = allocate_target_description ();" > - echo " struct tdesc_feature *feature = tdesc_create_feature (result.get (), \"${name}\");" > - continue > - elif test "${type}" = "xmltarget"; then > - xmltarget="${entry}" > - continue > - elif test "${type}" = "xmlarch"; then > - xmlarch="${entry}" > - continue > - elif test "${type}" = "xmlosabi"; then > - xmlosabi="${entry}" > - continue > - elif test "${type}" = "expedite"; then > - expedite="${entry}" > - continue > - elif test "${type}" = "feature"; then > - feature="${entry}" > - continue > - elif test "${type}" = "osabi"; then > - osabi="${entry}" > - continue > - elif test "${name}" = x; then > - echo "$0: $1 does not specify \`\`name''." 1>&2 > - exit 1 > - else > - echo " tdesc_create_reg (feature, \"${entry}\"," > - echo " 0, 0, NULL, ${type}, NULL);" > +while do_read; do > + if test "${type}" = "name"; then > + name="${entry}" > + > + echo "const_target_desc_up tdesc_${name};" > + echo "" > + > + # This is necessary for -Wmissing-declarations. > + echo "void init_registers_${name} (void);" > + > + echo "void" > + echo "init_registers_${name} (void)" > + echo "{" > + echo " target_desc_up result = allocate_target_description ();" > + echo " struct tdesc_feature *feature = tdesc_create_feature (result.get (), \"${name}\");" > + continue > + elif test "${type}" = "xmltarget"; then > + xmltarget="${entry}" > + continue > + elif test "${type}" = "xmlarch"; then > + xmlarch="${entry}" > + continue > + elif test "${type}" = "xmlosabi"; then > + xmlosabi="${entry}" > + continue > + elif test "${type}" = "expedite"; then > + expedite="${entry}" > + continue > + elif test "${type}" = "feature"; then > + feature="${entry}" > + continue > + elif test "${type}" = "osabi"; then > + osabi="${entry}" > + continue > + elif test "${name}" = x; then > + echo "$0: $1 does not specify \`\`name''." 1>&2 > + exit 1 > + else > + echo " tdesc_create_reg (feature, \"${entry}\"," > + echo " 0, 0, NULL, ${type}, NULL);" > > - offset=$((offset + type)) > - i=$((i + 1)) > - fi > + offset=$((offset + type)) > + i=$((i + 1)) > + fi > done > > echo > @@ -173,28 +166,28 @@ echo "static const char *expedite_regs_${name}[] = { \"$(echo "${expedite}" | se > > echo "#ifndef IN_PROCESS_AGENT" > if test "${feature}" != x; then > - echo "static const char *xmltarget_${name} = 0;" > -elif test "${xmltarget}" = x; then > - if test "${xmlarch}" = x && test "${xmlosabi}" = x; then > echo "static const char *xmltarget_${name} = 0;" > - else > - echo "static const char *xmltarget_${name} = \"@\\" > - if test "${xmlarch}" != x; then > - echo "${xmlarch}\\" > - fi > - if test "${xmlosabi}" != x; then > - echo "${xmlosabi}\\" > +elif test "${xmltarget}" = x; then > + if test "${xmlarch}" = x && test "${xmlosabi}" = x; then > + echo "static const char *xmltarget_${name} = 0;" > + else > + echo "static const char *xmltarget_${name} = \"@\\" > + if test "${xmlarch}" != x; then > + echo "${xmlarch}\\" > + fi > + if test "${xmlosabi}" != x; then > + echo "${xmlosabi}\\" > + fi > + echo "\";" > fi > - echo "\";" > - fi > else > - echo "static const char *xmltarget_${name} = \"${xmltarget}\";" > + echo "static const char *xmltarget_${name} = \"${xmltarget}\";" > fi > echo > > osabi_enum=$(grep "${osabi}" "$2" | sed 's/.*(\([^,]\+\),.*/GDB_OSABI_\1/') > > -cat < +cat << EOF > result->xmltarget = xmltarget_${name}; > #endif > > > base-commit: 5d09165a3e9c8d32742fc764e98e927950f7b2f5