public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: "Tom Tromey (Code Review)" <gerrit@gnutoolchain-gerrit.osci.io>
To: gdb-patches@sourceware.org
Cc: Simon Marchi <simon.marchi@polymtl.ca>
Subject: [review v2] Move type_byte_order earlier
Date: Wed, 04 Dec 2019 14:36:00 -0000	[thread overview]
Message-ID: <20191204143635.A821A28174@gnutoolchain-gerrit.osci.io> (raw)
In-Reply-To: <gerrit.1574880479000.I4666431ecbb32ec98918f39f72d22c86b2bc8dde@gnutoolchain-gerrit.osci.io>

Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/728
......................................................................

Move type_byte_order earlier

I failed to notice that the scalar_storage_order patch put
type_byte_order at the end of gdbtypes.c.  The end of the file is
normally where the file's _initialize function goes.  This moves
type_byte_order earlier, into a more relevant section.

gdb/ChangeLog
2019-12-04  Tom Tromey  <tromey@adacore.com>

	* gdbtypes.c (type_byte_order): Move earlier.  Assert for unknown
	endian-ness.

Change-Id: I4666431ecbb32ec98918f39f72d22c86b2bc8dde
---
M gdb/ChangeLog
M gdb/gdbtypes.c
2 files changed, 25 insertions(+), 18 deletions(-)



diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 681ae48..64f2db3 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,10 @@
 2019-12-04  Tom Tromey  <tromey@adacore.com>
 
+	* gdbtypes.c (type_byte_order): Move earlier.  Assert for unknown
+	endian-ness.
+
+2019-12-04  Tom Tromey  <tromey@adacore.com>
+
 	* dwarf2read.c (dwarf2_init_float_type)
 	(dwarf2_init_complex_target_type): Add byte_order parameter.
 	(read_base_type): Compute byte order earlier.
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index 0609634..737ebfe 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -3423,6 +3423,26 @@
 				    value_address (val), val) == 1;
 }
 
+/* See gdbtypes.h.  */
+
+enum bfd_endian
+type_byte_order (const struct type *type)
+{
+  bfd_endian byteorder = gdbarch_byte_order (get_type_arch (type));
+  if (TYPE_ENDIANITY_NOT_DEFAULT (type))
+    {
+      if (byteorder == BFD_ENDIAN_BIG)
+        return BFD_ENDIAN_LITTLE;
+      else
+	{
+	  gdb_assert (byteorder == BFD_ENDIAN_LITTLE);
+	  return BFD_ENDIAN_BIG;
+	}
+    }
+
+  return byteorder;
+}
+
 \f
 /* Overload resolution.  */
 
@@ -5701,21 +5721,3 @@
 			   show_strict_type_checking,
 			   &setchecklist, &showchecklist);
 }
-
-/* See gdbtypes.h.  */
-enum bfd_endian
-type_byte_order (const struct type *type)
-{
-  bfd_endian byteorder = gdbarch_byte_order (get_type_arch (type));
-  if (TYPE_ENDIANITY_NOT_DEFAULT (type))
-    {
-      if (byteorder == BFD_ENDIAN_BIG)
-        return BFD_ENDIAN_LITTLE;
-      else if (byteorder == BFD_ENDIAN_LITTLE)
-        return BFD_ENDIAN_BIG;
-      else
-        return BFD_ENDIAN_UNKNOWN;
-    }
-
-  return byteorder;
-}

-- 
Gerrit-Project: binutils-gdb
Gerrit-Branch: master
Gerrit-Change-Id: I4666431ecbb32ec98918f39f72d22c86b2bc8dde
Gerrit-Change-Number: 728
Gerrit-PatchSet: 2
Gerrit-Owner: Tom Tromey <tromey@sourceware.org>
Gerrit-CC: Simon Marchi <simon.marchi@polymtl.ca>
Gerrit-MessageType: newpatchset

  parent reply	other threads:[~2019-12-04 14:36 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-27 18:48 [review] " Tom Tromey (Code Review)
2019-11-27 22:05 ` Simon Marchi (Code Review)
2019-12-04 14:36 ` Tom Tromey (Code Review) [this message]
2019-12-04 15:32 ` [review v2] " Simon Marchi (Code Review)
2019-12-04 16:41 ` [pushed] " Sourceware to Gerrit sync (Code Review)

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=20191204143635.A821A28174@gnutoolchain-gerrit.osci.io \
    --to=gerrit@gnutoolchain-gerrit.osci.io \
    --cc=gdb-patches@sourceware.org \
    --cc=simon.marchi@polymtl.ca \
    --cc=tromey@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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).