From: Simon Marchi <simon.marchi@efficios.com>
To: gdb-patches@sourceware.org
Cc: Simon Marchi <simon.marchi@efficios.com>
Subject: [PATCH] gdb: make gdbarch.sh write gdbarch.{c,h} directly
Date: Mon, 11 May 2020 17:18:25 -0400 [thread overview]
Message-ID: <20200511211825.1538934-1-simon.marchi@efficios.com> (raw)
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 <http://www.gnu.org/licenses/>. */
-/* 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 <http://www.gnu.org/licenses/>. */
-/* 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 <<EOF
@@ -1239,7 +1223,6 @@ EOF
done
exec 1>&2
-compare_new gdbarch.log
copyright ()
@@ -1267,17 +1250,7 @@ cat <<EOF
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-/* 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
next reply other threads:[~2020-05-11 21:18 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-11 21:18 Simon Marchi [this message]
2020-05-12 20:56 ` Tom Tromey
2020-05-12 21:16 ` Simon Marchi
2020-05-24 15:12 ` Simon Marchi
2020-05-24 15:39 ` Pedro Alves
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200511211825.1538934-1-simon.marchi@efficios.com \
--to=simon.marchi@efficios.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox