summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@efficios.com>2020-05-11 17:18:25 -0400
committerSimon Marchi <simon.marchi@polymtl.ca>2020-05-24 11:11:36 -0400
commit41a77cbaadd63b92362f5ea35b2cd11f90edf170 (patch)
tree90873d1b17f04d3a6a6117dfe0c8a26dbd0a674b
parente08bd6c5081f4957ddb60117ac94775dcd618db7 (diff)
downloadbinutils-gdb-41a77cbaadd63b92362f5ea35b2cd11f90edf170.tar.gz
gdb: make gdbarch.sh write gdbarch.{c,h} directly
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. Change-Id: I7970a9e8af0afc0145cb5a28e73d94fbaa1e25b9
-rw-r--r--gdb/gdbarch.c12
-rw-r--r--gdb/gdbarch.h12
-rwxr-xr-xgdb/gdbarch.sh39
3 files changed, 8 insertions, 55 deletions
diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c
index e7d4ccca9e7..55e4a67e2c5 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 6dbb9d571dd..c7621f2fda1 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 13775078c25..e297b1c56a0 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