From patchwork Wed Dec 4 16:41:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Simon Marchi (Code Review)" X-Patchwork-Id: 36514 Received: (qmail 27615 invoked by alias); 4 Dec 2019 16:41:25 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 27550 invoked by uid 89); 4 Dec 2019 16:41:24 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3 autolearn=ham version=3.3.1 spammy= X-HELO: mx1.osci.io Received: from polly.osci.io (HELO mx1.osci.io) (8.43.85.229) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 04 Dec 2019 16:41:22 +0000 Received: by mx1.osci.io (Postfix, from userid 994) id DBC572053D; Wed, 4 Dec 2019 11:41:16 -0500 (EST) Received: from gnutoolchain-gerrit.osci.io (gnutoolchain-gerrit.osci.io [IPv6:2620:52:3:1:5054:ff:fe06:16ca]) by mx1.osci.io (Postfix) with ESMTP id 517A120422; Wed, 4 Dec 2019 11:41:10 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by gnutoolchain-gerrit.osci.io (Postfix) with ESMTP id 192682816F; Wed, 4 Dec 2019 11:41:10 -0500 (EST) X-Gerrit-PatchSet: 3 Date: Wed, 4 Dec 2019 11:41:10 -0500 From: "Sourceware to Gerrit sync (Code Review)" To: Tom Tromey , gdb-patches@sourceware.org Cc: Simon Marchi Auto-Submitted: auto-generated X-Gerrit-MessageType: merged Subject: [pushed] Move type_byte_order earlier X-Gerrit-Change-Id: I4666431ecbb32ec98918f39f72d22c86b2bc8dde X-Gerrit-Change-Number: 728 X-Gerrit-ChangeURL: X-Gerrit-Commit: 7ab4a236ce85f1e0950e88e267e679a066b77bed In-Reply-To: References: Reply-To: noreply@gnutoolchain-gerrit.osci.io, simon.marchi@polymtl.ca, tromey@sourceware.org, gdb-patches@sourceware.org MIME-Version: 1.0 Content-Disposition: inline User-Agent: Gerrit/3.0.3-79-g83ff7f88f1 Message-Id: <20191204164110.192682816F@gnutoolchain-gerrit.osci.io> 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 * 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 + * gdbtypes.c (type_byte_order): Move earlier. Assert for unknown + endian-ness. + +2019-12-04 Tom Tromey + * 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; +} + /* 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; -}