From patchwork Mon Apr 17 19:43:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 67849 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id DD2E53857712 for ; Mon, 17 Apr 2023 19:43:57 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DD2E53857712 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1681760637; bh=8Gj6hl2ibEpcQSjueL/CV8zfm6+qSUph/wUNHELEoAM=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=nDJbZxnOx6BVo+q3IhMa/Eho+hxz64kPDT48VWN59p6foTWyerKtml2zjwHSlWUHp sd7McxOBsNPHA2kU5Id/lp7f6+CJ6+/pKJFZguq8OdN1ZM8TXEcnfWp7zSXtNhw7+0 d/VB4gSt3KiRCfwVfv5QQLQlhkM7Zrq15APAr00U= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from mail-il1-x131.google.com (mail-il1-x131.google.com [IPv6:2607:f8b0:4864:20::131]) by sourceware.org (Postfix) with ESMTPS id 184F03858C53 for ; Mon, 17 Apr 2023 19:43:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 184F03858C53 Received: by mail-il1-x131.google.com with SMTP id e9e14a558f8ab-32942f4b670so21701435ab.0 for ; Mon, 17 Apr 2023 12:43:35 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681760614; x=1684352614; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=8Gj6hl2ibEpcQSjueL/CV8zfm6+qSUph/wUNHELEoAM=; b=FysFnBUVGTI9L53S+k1R6Zg15m0EtYt2MsF97HPzWF/wAku+36nMIG13gyxpJlyPNr nGboFI0y8DJ6Gen06wNFr+D0EBATxfpPCzIQpghI4UzS1XIn1yIgksGcLLWbCmxEQKcA phOnr31xwMjZxKzsgNyANoYgl3FCHFxfmhf7eKIia5ATq0+mZSivyZcbX5b7JDgk5Lpf B+wnkMjWMIeIkwk147/5/offB0jdtB5wiGdEufJn/XkhIXPs44W+6FjFXiCuCN0RU9Ib 0ryGD/fc96yBx2issc26U7uGJKu0cQDeqh+VGnish2UWZWauYwCSfvYUO8rgKBtLykfu gqVw== X-Gm-Message-State: AAQBX9cGVY2MjB0KJNBuXsu5Nh/DG51BM6KxP/rBP1wwNTIXF0f4BHJU NTcUVlL+IyG3J0Wq6aY3hq1lo+q29zNwUQxE1HnHCg== X-Google-Smtp-Source: AKy350Zc9WHhexTgyl7S6BU5mLPCiO4C96W+q8c8j478I0oUiRhOK/NnFaqW6oPe6ATE9Gw2AUwUvA== X-Received: by 2002:a05:6e02:78d:b0:328:51af:fc4c with SMTP id q13-20020a056e02078d00b0032851affc4cmr10646152ils.12.1681760614303; Mon, 17 Apr 2023 12:43:34 -0700 (PDT) Received: from localhost.localdomain (71-211-191-82.hlrn.qwest.net. [71.211.191.82]) by smtp.gmail.com with ESMTPSA id p34-20020a056638192200b00403d770399csm3602867jal.3.2023.04.17.12.43.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Apr 2023 12:43:33 -0700 (PDT) To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [pushed] Remove some unnecessary casts from ada-lang.c Date: Mon, 17 Apr 2023 13:43:24 -0600 Message-Id: <20230417194324.1606586-1-tromey@adacore.com> X-Mailer: git-send-email 2.39.1 MIME-Version: 1.0 X-Spam-Status: No, score=-11.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Tom Tromey via Gdb-patches From: Tom Tromey Reply-To: Tom Tromey Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" I noticed some unnecessary casts to LONGEST in ada-lang.c. This patch removes the ones I think are very clearly not needed. I'm checking this in as obvious. --- gdb/ada-lang.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index a3fc88a3488..97e03f78d5d 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -3286,7 +3286,7 @@ ada_array_bound_from_type (struct type *arr_type, int n, int which) arr_type = decode_constrained_packed_array_type (arr_type); if (arr_type == NULL || !ada_is_simple_array_type (arr_type)) - return (LONGEST) - which; + return - which; if (arr_type->code () == TYPE_CODE_PTR) type = arr_type->target_type (); @@ -3319,10 +3319,9 @@ ada_array_bound_from_type (struct type *arr_type, int n, int which) index_type = elt_type->index_type (); } - return - (LONGEST) (which == 0 - ? ada_discrete_type_low_bound (index_type) - : ada_discrete_type_high_bound (index_type)); + return (which == 0 + ? ada_discrete_type_low_bound (index_type) + : ada_discrete_type_high_bound (index_type)); } /* Given that arr is an array value, returns the lower bound of the @@ -10113,7 +10112,7 @@ ada_unop_in_range (struct type *expect_type, lim_warning (_("Membership test incompletely implemented; " "always returns true")); type = language_bool_type (exp->language_defn, exp->gdbarch); - return value_from_longest (type, (LONGEST) 1); + return value_from_longest (type, 1); case TYPE_CODE_RANGE: arg2 = value_from_longest (type, @@ -10223,7 +10222,7 @@ ada_equal_binop (struct type *expect_type, if (op == BINOP_NOTEQUAL) tem = !tem; struct type *type = language_bool_type (exp->language_defn, exp->gdbarch); - return value_from_longest (type, (LONGEST) tem); + return value_from_longest (type, tem); } /* A helper function for TERNOP_SLICE. */