From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id /+YoLuVEI2rv5DYAWB0awg (envelope-from ) for ; Fri, 05 Jun 2026 17:51:33 -0400 Authentication-Results: simark.ca; dkim=pass (2048-bit key; secure) header.d=adacore.com header.i=@adacore.com header.a=rsa-sha256 header.s=google header.b=NnkZwkG9; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id AD2BD1E024; Fri, 05 Jun 2026 17:51:33 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-5.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [IPv6:2620:52:6:3111::32]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id EA9F61E024 for ; Fri, 05 Jun 2026 17:51:32 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id D690D4BCA408 for ; Fri, 5 Jun 2026 21:51:31 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D690D4BCA408 Authentication-Results: sourceware.org; dkim=pass (2048-bit key, secure) header.d=adacore.com header.i=@adacore.com header.a=rsa-sha256 header.s=google header.b=NnkZwkG9 Received: from mail-oi1-x230.google.com (mail-oi1-x230.google.com [IPv6:2607:f8b0:4864:20::230]) by sourceware.org (Postfix) with ESMTPS id 4005C4BA543C for ; Fri, 5 Jun 2026 21:51:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 4005C4BA543C Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 4005C4BA543C Authentication-Results: sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::230 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1780696267; cv=none; b=ZeGgj+yCUcVDrT+vO9Dp8VTWkCZ0OYS3X+XaeSqIUqU0ivQtORdgJZAxJXF+GdZjzkqdKFPyv8pNozZzxrqgUZCcVX9oZU6ainmEBnhLftkllkrZO1vPc67bNVCnoUhT+dCYFgMkO675Y4SHHIfBZZrrwiuR59yRmlMSd6OvGJM= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1780696267; c=relaxed/simple; bh=ELQyHgL1l9gOR9rzMpQHepTkjwv8HJBQFqOp/vKOy8M=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=R/Ob6zWSbr13F15H12Bas8JHR9PWicE97l10lEv/h9x6w9NXXxpU596ToNkYrriee55nyyx1GYKz3BtApdppla+iXQO8ynxJ5hXVD17SQ0OF5dtPgP3rdW9WybrZ7mMsZZPoAbbNMQREy3TG6NuwL/HquZZAhtZE81ONA6FSOcI= ARC-Authentication-Results: i=1; sourceware.org; dkim=pass (2048-bit key, secure) header.d=adacore.com header.i=@adacore.com header.a=rsa-sha256 header.s=google header.b=NnkZwkG9 DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4005C4BA543C Received: by mail-oi1-x230.google.com with SMTP id 5614622812f47-48611ccd5aeso1362381b6e.2 for ; Fri, 05 Jun 2026 14:51:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1780696266; x=1781301066; darn=sourceware.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=dnVYZRH/4yAFy1LPnWgH7McUwZBqNAoHalWPMjvgNYk=; b=NnkZwkG9igwyUxYqPYUxuwRe+VcVbR5S1f4OX30CbLD+hG13/KU5ZLRYT/NTD0vlWy u7dr8NjtESBAL9dyjSR0AMAEdLKOhTrHFeprAlEwEWOMuXfxofV7VlkpRAgKWf+jq2uT cLpCp9Ys7ivluREJsVJFLHpnSmPahq7AqrU7zXf6/I6Dwu8VJKGvJW1sBGZthEjAN30r gOhbfadZSaUu7S3Qpb5qtaa4O2/RwM/XwqSxLwDivdxTaAgpX2ly7AkeR8sWqlTFV2rG S2bOo/H+c7u0VdHlApFSyVLMaak8CEElESmnIp/o8LFai4w+c0IZR1nptLYpZ30RaG08 +Bjg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780696266; x=1781301066; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=dnVYZRH/4yAFy1LPnWgH7McUwZBqNAoHalWPMjvgNYk=; b=eoDg8aVJpTIMfPPWBJCiTlvyhvmROonOUkPgw/umfcdt0/RbCBmsoijmDcfDo4BI/D WSwZCpsPSJE1LrakFFYYe+KBN1GjhCTuBf0855+HPmLBZc3ZujR/bJ0SkNu52TYty74R 3ztKEm7iH464XRLe6oXdPSK0jdg28PcPGE7Kuz2EjCN9kXeTczHYJ/j8EH1/Y4dVKqso fvNduE106PqOj1XRF/pbESBGFJfXoWt2uhBFcsA/Q7U0hVHjUSweDXwi0wo2HMOh0RAu KNr6csK+5xvDJjPdxHrNFg++ckb7aAMq/ZBLZQ6GRJbePhYeVg0Vpy3UHR85lvlsROF8 rlBA== X-Gm-Message-State: AOJu0YxcChT5Mz185RDCC49J4HSghC3itygII6kueiNbET8QSqIKqKxV L/0cmQL6gEAXt46aLb1knCZlgdO5tneHqPsjkdtJTYzZaxIb2SVpdsxCKOW94sh/r1bSY/6SWr9 eAVY= X-Gm-Gg: Acq92OFd4q1TrQwVX+Hqe6HVFRBHI5QysT0cimppArpSb07zHObM4R2co/ccOehY7/K e0isfYEdFwBqmeALcgtH14OWBV5RpbWPPGfeqmLkmQ2a5fkao18UkmRK4nR99UOkb78lja6Zb20 F3BWI3NlkeXeylF+p5v33W6CcsVQwa9AAEjdWl7wwKq2GSWee7RN0wTT4n6nJGH+fYs1CCKRF5P T5qkM844Ktq54Ewl7fsxE8lMv0bj2uzZRR1JoW7kjniQsAw3XUs3tCkziQm6HV/21zMYskHZZyZ s650WfarS/jp5wC4HvWAy88GkvT7C86l3tY5oNVf5JJuCMidBA0vCwDrI+Kb57rEZX1drARMdGz leMmEZkCdqrVq73UCDufhuTlrqBBy+YU6NfCr2jXrsOUs94XnW00EaoZV4RtaRqCyQvqHplWa84 GSC2cO+82XCfDJV17FqFmRJ8Rs+MldjjA1HfEBNl3sOaMcaWSRYlwdbA== X-Received: by 2002:a05:6808:3083:b0:484:afc2:eecf with SMTP id 5614622812f47-4868e02be75mr4062182b6e.24.1780696266637; Fri, 05 Jun 2026 14:51:06 -0700 (PDT) Received: from bapiya (75-166-225-82.hlrn.qwest.net. [75.166.225.82]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-7e6e75c5495sm6728478a34.10.2026.06.05.14.51.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Jun 2026 14:51:06 -0700 (PDT) From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH] Remove ada_value_slice Date: Fri, 5 Jun 2026 15:51:04 -0600 Message-ID: <20260605215104.656469-1-tromey@adacore.com> X-Mailer: git-send-email 2.54.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org ada_value_slice and ada_value_slice_from_ptr are nearly identical. >From what I can tell, the former can be removed without any problem. --- gdb/ada-lang.c | 46 ++-------------------------------------------- 1 file changed, 2 insertions(+), 44 deletions(-) diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index bb044e2c5a0..153debc6569 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -3183,49 +3183,6 @@ ada_value_slice_from_ptr (struct value *array_ptr, struct type *type, } -static struct value * -ada_value_slice (struct value *array, LONGEST low, LONGEST high) -{ - struct type *type = ada_check_typedef (array->type ()); - struct type *base_index_type = type->index_type ()->target_type (); - type_allocator alloc (type->index_type ()); - struct type *index_type - = create_static_range_type (alloc, type->index_type (), low, high); - - dynamic_prop prop_storage; - dynamic_prop *prop = type->dyn_prop (DYN_PROP_BYTE_STRIDE); - bool is_byte_stride = true; - if (prop == nullptr) - { - prop = type->dyn_prop (DYN_PROP_BIT_STRIDE); - is_byte_stride = false; - if (prop == nullptr) - { - prop = &prop_storage; - prop->set_const_val (type->field (0).bitsize ()); - } - } - - struct type *slice_type = create_array_type_with_stride - (alloc, type->target_type (), index_type, - prop, is_byte_stride); - std::optional low_pos, high_pos; - - - low_pos = discrete_position (base_index_type, low); - high_pos = discrete_position (base_index_type, high); - - if (!low_pos.has_value () || !high_pos.has_value ()) - { - warning (_("unable to get positions in slice, use bounds instead")); - low_pos = low; - high_pos = high; - } - - return value_cast (slice_type, - value_slice (array, low, *high_pos - *low_pos + 1)); -} - /* If type is a record type in the form of a standard GNAT array descriptor, returns the number of dimensions for type. If arr is a simple array, returns the number of "array of"s that prefix its @@ -10306,7 +10263,8 @@ ada_ternop_slice_operation::evaluate (struct type *expect_type, else if (high_bound < low_bound) return empty_array (array->type (), low_bound, high_bound); else - return ada_value_slice (array, low_bound, high_bound); + return ada_value_slice_from_ptr (array, array->type (), + low_bound, high_bound); } /* Implement BINOP_IN_BOUNDS. */ base-commit: 18ad8c1a54d5d0e3fe3ff6c13f217e0dc840f991 -- 2.54.0