* [review] Move type_byte_order earlier
@ 2019-11-27 18:48 Tom Tromey (Code Review)
2019-11-27 22:05 ` Simon Marchi (Code Review)
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Tom Tromey (Code Review) @ 2019-11-27 18:48 UTC (permalink / raw)
To: gdb-patches
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-11-27 Tom Tromey <tromey@adacore.com>
* gdbtypes.c (type_byte_order): Move earlier.
Change-Id: I4666431ecbb32ec98918f39f72d22c86b2bc8dde
---
M gdb/ChangeLog
M gdb/gdbtypes.c
2 files changed, 22 insertions(+), 18 deletions(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 66afaea..876a027 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,9 @@
2019-11-27 Tom Tromey <tromey@adacore.com>
+ * gdbtypes.c (type_byte_order): Move earlier.
+
+2019-11-27 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 ff89009..31bfa47 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -3349,6 +3349,24 @@
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 if (byteorder == BFD_ENDIAN_LITTLE)
+ return BFD_ENDIAN_BIG;
+ else
+ return BFD_ENDIAN_UNKNOWN;
+ }
+
+ return byteorder;
+}
+
\f
/* Overload resolution. */
@@ -5627,21 +5645,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: 1
Gerrit-Owner: Tom Tromey <tromey@sourceware.org>
Gerrit-MessageType: newchange
^ permalink raw reply [flat|nested] 5+ messages in thread
* [review] Move type_byte_order earlier
2019-11-27 18:48 [review] Move type_byte_order earlier Tom Tromey (Code Review)
@ 2019-11-27 22:05 ` Simon Marchi (Code Review)
2019-12-04 14:36 ` [review v2] " Tom Tromey (Code Review)
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Simon Marchi (Code Review) @ 2019-11-27 22:05 UTC (permalink / raw)
To: Tom Tromey, gdb-patches
Simon Marchi has posted comments on this change.
Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/728
......................................................................
Patch Set 1:
(2 comments)
| --- gdb/gdbtypes.c
| +++ gdb/gdbtypes.c
| @@ -3344,12 +3344,30 @@ is_unique_ancestor (struct type *base, struct value *val)
| int offset = -1;
|
| return is_unique_ancestor_worker (base, value_type (val), &offset,
| value_contents_for_printing (val),
| value_embedded_offset (val),
| value_address (val), val) == 1;
| }
|
| +/* See gdbtypes.h. */
| +enum bfd_endian
PS1, Line 3353:
Might as well add a newline between the comment and the return type.
| +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;
PS1, Line 3364:
Also not related to this patch, but is there really a legitimate case
for this else (byteorder being not _BIG and not _LITTLE)? Sounds to
me like this should be an assert.
| + }
| +
| + return byteorder;
| +}
| +
| \f
| /* Overload resolution. */
|
| /* Return the sum of the rank of A with the rank of B. */
--
Gerrit-Project: binutils-gdb
Gerrit-Branch: master
Gerrit-Change-Id: I4666431ecbb32ec98918f39f72d22c86b2bc8dde
Gerrit-Change-Number: 728
Gerrit-PatchSet: 1
Gerrit-Owner: Tom Tromey <tromey@sourceware.org>
Gerrit-CC: Simon Marchi <simon.marchi@polymtl.ca>
Gerrit-Comment-Date: Wed, 27 Nov 2019 22:05:33 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment
^ permalink raw reply [flat|nested] 5+ messages in thread
* [review v2] Move type_byte_order earlier
2019-11-27 18:48 [review] Move type_byte_order earlier Tom Tromey (Code Review)
2019-11-27 22:05 ` Simon Marchi (Code Review)
@ 2019-12-04 14:36 ` Tom Tromey (Code Review)
2019-12-04 15:32 ` Simon Marchi (Code Review)
2019-12-04 16:41 ` [pushed] " Sourceware to Gerrit sync (Code Review)
3 siblings, 0 replies; 5+ messages in thread
From: Tom Tromey (Code Review) @ 2019-12-04 14:36 UTC (permalink / raw)
To: gdb-patches; +Cc: Simon Marchi
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
^ permalink raw reply [flat|nested] 5+ messages in thread
* [review v2] Move type_byte_order earlier
2019-11-27 18:48 [review] Move type_byte_order earlier Tom Tromey (Code Review)
2019-11-27 22:05 ` Simon Marchi (Code Review)
2019-12-04 14:36 ` [review v2] " Tom Tromey (Code Review)
@ 2019-12-04 15:32 ` Simon Marchi (Code Review)
2019-12-04 16:41 ` [pushed] " Sourceware to Gerrit sync (Code Review)
3 siblings, 0 replies; 5+ messages in thread
From: Simon Marchi (Code Review) @ 2019-12-04 15:32 UTC (permalink / raw)
To: Tom Tromey, gdb-patches
Simon Marchi has posted comments on this change.
Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/728
......................................................................
Patch Set 2: Code-Review+2
--
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-Reviewer: Simon Marchi <simon.marchi@polymtl.ca>
Gerrit-Comment-Date: Wed, 04 Dec 2019 15:32:07 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
^ permalink raw reply [flat|nested] 5+ messages in thread
* [pushed] Move type_byte_order earlier
2019-11-27 18:48 [review] Move type_byte_order earlier Tom Tromey (Code Review)
` (2 preceding siblings ...)
2019-12-04 15:32 ` Simon Marchi (Code Review)
@ 2019-12-04 16:41 ` Sourceware to Gerrit sync (Code Review)
3 siblings, 0 replies; 5+ messages in thread
From: Sourceware to Gerrit sync (Code Review) @ 2019-12-04 16:41 UTC (permalink / raw)
To: Tom Tromey, gdb-patches; +Cc: Simon Marchi
Sourceware to Gerrit sync has submitted this change.
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(-)
Approvals:
Simon Marchi: Looks good to me, approved
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index ffae608..af39621 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: 3
Gerrit-Owner: Tom Tromey <tromey@sourceware.org>
Gerrit-Reviewer: Simon Marchi <simon.marchi@polymtl.ca>
Gerrit-MessageType: merged
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2019-12-04 16:41 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-27 18:48 [review] Move type_byte_order earlier Tom Tromey (Code Review)
2019-11-27 22:05 ` Simon Marchi (Code Review)
2019-12-04 14:36 ` [review v2] " Tom Tromey (Code Review)
2019-12-04 15:32 ` Simon Marchi (Code Review)
2019-12-04 16:41 ` [pushed] " Sourceware to Gerrit sync (Code Review)
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).