From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from barracuda.ebox.ca (barracuda.ebox.ca [96.127.255.19]) by sourceware.org (Postfix) with ESMTPS id DE2A6386F839 for ; Mon, 11 May 2020 21:18:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org DE2A6386F839 X-ASG-Debug-ID: 1589231906-0c856e314b85b610001-fS2M51 Received: from smtp.ebox.ca (smtp.ebox.ca [96.127.255.82]) by barracuda.ebox.ca with ESMTP id B70lntsu97LDIKMP (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 11 May 2020 17:18:26 -0400 (EDT) X-Barracuda-Envelope-From: simon.marchi@efficios.com X-Barracuda-RBL-Trusted-Forwarder: 96.127.255.82 Received: from smarchi-efficios.lan (unknown [192.222.164.54]) by smtp.ebox.ca (Postfix) with ESMTP id 57FB6441B21; Mon, 11 May 2020 17:18:26 -0400 (EDT) From: Simon Marchi X-Barracuda-Effective-Source-IP: 192-222-164-54.qc.cable.ebox.net[192.222.164.54] X-Barracuda-Apparent-Source-IP: 192.222.164.54 X-Barracuda-RBL-IP: 192.222.164.54 To: gdb-patches@sourceware.org Cc: Simon Marchi Subject: [PATCH] gdb: make gdbarch.sh write gdbarch.{c,h} directly Date: Mon, 11 May 2020 17:18:25 -0400 X-ASG-Orig-Subj: [PATCH] gdb: make gdbarch.sh write gdbarch.{c,h} directly Message-Id: <20200511211825.1538934-1-simon.marchi@efficios.com> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Barracuda-Connect: smtp.ebox.ca[96.127.255.82] X-Barracuda-Start-Time: 1589231906 X-Barracuda-Encrypted: DHE-RSA-AES256-SHA X-Barracuda-URL: https://96.127.255.19:443/cgi-mod/mark.cgi X-Barracuda-Scan-Msg-Size: 5171 X-Virus-Scanned: by bsmtpd at ebox.ca X-Barracuda-BRTS-Status: 1 X-Barracuda-Spam-Score: 0.50 X-Barracuda-Spam-Status: No, SCORE=0.50 using global scores of TAG_LEVEL=1000.0 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=8.0 tests=BSF_RULE_7582B X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.3.81783 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- 0.50 BSF_RULE_7582B Custom Rule 7582B X-Spam-Status: No, score=-30.6 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_NONE, KAM_DMARC_STATUS, KAM_SHORT, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_SOFTFAIL, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 May 2020 21:18:38 -0000 It was suggested in this thread [1] that gdbarch.sh should write to gdbarch.h and gdbarch.c directly. This patch implements that. When running gdbarch.sh, we currently need to move new-gdbarch.c over gdbarch.c and new-gdbarch.h over gdbarch.h. It might have been useful at some point to not have gdbarch.sh overwrite gdbarch.h and gdbarch.c, but with git it's really unnecessary. Any changes to gdbarch.sh can be inspected using `git diff`. A next step would be to have the Makefile automatically run gdbarch.sh if it sees that gdbarch.c and gdbarch.h are out of date. Or maybe even remove gdbarch.c and gdbarch.h from the tree and generate them in the build directory when building. But that requires more thinking and discussions, and I think that this change is already useful in itself. [1] https://sourceware.org/pipermail/gdb-patches/2020-May/168265.html gdb/ChangeLog; * gdbarch.sh: Write to gdbarch.c/gdbarch.h directly. Don't compare old and new versions. (compare_new): Remove. --- gdb/gdbarch.c | 12 +----------- gdb/gdbarch.h | 12 +----------- gdb/gdbarch.sh | 39 ++++++--------------------------------- 3 files changed, 8 insertions(+), 55 deletions(-) diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c index e7d4ccca9e7d..55e4a67e2c5a 100644 --- a/gdb/gdbarch.c +++ b/gdb/gdbarch.c @@ -20,17 +20,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -/* This file was created with the aid of ``gdbarch.sh''. - - The Bourne shell script ``gdbarch.sh'' creates the files - ``new-gdbarch.c'' and ``new-gdbarch.h and then compares them - against the existing ``gdbarch.[hc]''. Any differences found - being reported. - - If editing this file, please also run gdbarch.sh and merge any - changes into that script. Conversely, when making sweeping changes - to this file, modifying gdbarch.sh and using its output may prove - easier. */ +/* This file was created with the aid of ``gdbarch.sh''. */ #include "defs.h" diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h index 6dbb9d571ddb..c7621f2fda14 100644 --- a/gdb/gdbarch.h +++ b/gdb/gdbarch.h @@ -20,17 +20,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -/* This file was created with the aid of ``gdbarch.sh''. - - The Bourne shell script ``gdbarch.sh'' creates the files - ``new-gdbarch.c'' and ``new-gdbarch.h and then compares them - against the existing ``gdbarch.[hc]''. Any differences found - being reported. - - If editing this file, please also run gdbarch.sh and merge any - changes into that script. Conversely, when making sweeping changes - to this file, modifying gdbarch.sh and using its output may prove - easier. */ +/* This file was created with the aid of ``gdbarch.sh''. */ #ifndef GDBARCH_H #define GDBARCH_H diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh index 13775078c25a..e297b1c56a09 100755 --- a/gdb/gdbarch.sh +++ b/gdb/gdbarch.sh @@ -24,22 +24,6 @@ LANG=C ; export LANG LC_ALL=C ; export LC_ALL - -compare_new () -{ - file=$1 - if test ! -r "${file}" - then - echo "${file} missing? cp new-${file} ${file}" 1>&2 - elif diff -u "${file}" "new-${file}" - then - echo "${file} unchanged" 1>&2 - else - echo "${file} has changed? cp new-${file} ${file}" 1>&2 - fi -} - - # Format of the input table read="class returntype function formal actual staticdefault predefault postdefault invalid_p print garbage_at_eol" @@ -1203,7 +1187,7 @@ EOF # # The .log file # -exec > new-gdbarch.log +exec > gdbarch.log function_list | while do_read do cat <&2 -compare_new gdbarch.log copyright () @@ -1267,17 +1250,7 @@ cat <. */ -/* This file was created with the aid of \`\`gdbarch.sh''. - - The Bourne shell script \`\`gdbarch.sh'' creates the files - \`\`new-gdbarch.c'' and \`\`new-gdbarch.h and then compares them - against the existing \`\`gdbarch.[hc]''. Any differences found - being reported. - - If editing this file, please also run gdbarch.sh and merge any - changes into that script. Conversely, when making sweeping changes - to this file, modifying gdbarch.sh and using its output may prove - easier. */ +/* This file was created with the aid of \`\`gdbarch.sh''. */ EOF } @@ -1695,8 +1668,8 @@ gdbarch_num_cooked_regs (gdbarch *arch) #endif EOF exec 1>&2 -#../move-if-change new-gdbarch.h gdbarch.h -compare_new gdbarch.h +../move-if-change new-gdbarch.h gdbarch.h +rm -f new-gdbarch.h # @@ -2605,5 +2578,5 @@ EOF # close things off exec 1>&2 -#../move-if-change new-gdbarch.c gdbarch.c -compare_new gdbarch.c +../move-if-change new-gdbarch.c gdbarch.c +rm -f new-gdbarch.c -- 2.26.2