From patchwork Mon Jun 10 09:07:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Marc_Poulhi=C3=A8s?= X-Patchwork-Id: 1945791 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=adacore.com header.i=@adacore.com header.a=rsa-sha256 header.s=google header.b=J3J8NrM/; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VyR0m5wMdz20fK for ; Mon, 10 Jun 2024 19:12:56 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 5EF50385E45E for ; Mon, 10 Jun 2024 09:12:53 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) by sourceware.org (Postfix) with ESMTPS id 63B96385842A for ; Mon, 10 Jun 2024 09:08:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 63B96385842A 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 63B96385842A Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::433 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718010499; cv=none; b=U2+Zzen0pvKwq0naqJAAETmzUwgFVH7lt5FFnsfnJfi8ITaq3/rR5EJC49EF60EkA0X2bkNUUbgtd/Xj1F+sBTTtpuQhpKKEJFSZL5JmxCuQlhqCu90WJXY0UINzKFvTgpnOcw8Cq/iiED1GKNzgwHD4W+/G4kJCuQMOD9mCfOA= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718010499; c=relaxed/simple; bh=dvm//aoSp5Zp6uuUnPJBbxRyX0XHYOotOf8N+8fWkkE=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=POuJvR72Dul9XoI/iacfVtxIaLRbMdikSuMh3Yg8YG037hNM9BiaUtkCfS4bUkMaH/pZc5gunSBxwyWCtcqwieAbdhVX8s3tOnp1rztRuG5FdE7V02qshP8V0fl+p6VmHLoqL9XVUsvq+LRI8UjbB0nC70md5wFdgPGZp7bs8c4= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wr1-x433.google.com with SMTP id ffacd0b85a97d-35ef3a037a0so2517892f8f.0 for ; Mon, 10 Jun 2024 02:08:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1718010495; x=1718615295; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=qsBf/p0/AFw5DyFqreRLfIBmYNDmJL300AlljqydF1Y=; b=J3J8NrM/C6bi+wlSDEYWdz0ZAlJPGcunRfD5wwlow4Elso7bxMcDJE5ZLztS5hKv+6 jMjW22eyucxAHiz3fX4majUKQF7RbZOrq533uJBAn4L5/r25M1/iP60UUVU5J2wOct6/ 0Bb9xLOq0yoPp+LYK2AaTwvwikNe8h3u1KoODi3q+zh/XMeQtqLI6XO8bkFabKhZdwT3 1rL/FFZVVh4OvsJQbPJqcrppJLV8tReK9RnaDjRZHvqVFvLJn+AF7RKM6tTmBmYPKq1l BWNh33WxUa7e8pHMjLkoSulWKA11Tolgc+DjIx6c2bieIH6lgiY+iVIjUUMELfKv5tvq X5Bw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718010495; x=1718615295; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=qsBf/p0/AFw5DyFqreRLfIBmYNDmJL300AlljqydF1Y=; b=Y5eRc7VMVG6PgVeCH4rnR0TAZoQGsAf7Kll29XdG+/vUsitEtwfsZ4uTQqY0OGfwjl TAZZjuAKoJ7/09pofY+7g0sgxQQS8hJCg66B/Ymdifvu/Nrspm2s8Z+DPoo/NcjA5GSL em4iTOVcGQ45caA37rfxuf6hVZIwon6ezf3d17Eu3FpCS0Z6uWEa2HGV1CUW5kdfqpna ilzqY0rNnDF8qM780xV88dH4j6oRKKZaiMiC6L0fo9xm4VyvrUGaMOMB6WYkwAh2WeIM MpPh8XHtRtJ+u6N7kS++IB0r33Y7ye9MSeNeVJGcbhLem9V0v7Oe29zelqJNo0WwnMEy C/SA== X-Gm-Message-State: AOJu0YwyNviX/WT5WmBSZAO24yM959SLnsdFW242sQ6Iua9sb+0S4wSw ured6uZZ1OwEhKqgmKZkDhV3mrd4n+LfYKSiQbGrZYc35jIxel3WJRVsdP7Dq9pHIp44PsqVqXI = X-Google-Smtp-Source: AGHT+IGWsjV6yxwHcAUgUCGR97Xc1Sv/NJMlixCpJdMEVVUxjJKnUohSEFmXX2HpHEnK9GgIZ5Ksfw== X-Received: by 2002:a5d:67c2:0:b0:35f:d06:6997 with SMTP id ffacd0b85a97d-35f0d066a0amr6483747f8f.24.1718010495192; Mon, 10 Jun 2024 02:08:15 -0700 (PDT) Received: from poulhies-Precision-5550.telnowedge.local (lmontsouris-659-1-24-67.w81-250.abo.wanadoo.fr. [81.250.175.67]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-35f0f551c20sm6454970f8f.69.2024.06.10.02.08.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Jun 2024 02:08:14 -0700 (PDT) From: =?utf-8?q?Marc_Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Yannick Moy Subject: [COMMITTED 17/30] ada: Remove streaming facilities from generics for formal containers Date: Mon, 10 Jun 2024 11:07:33 +0200 Message-ID: <20240610090747.1557638-17-poulhies@adacore.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240610090747.1557638-1-poulhies@adacore.com> References: <20240610090747.1557638-1-poulhies@adacore.com> MIME-Version: 1.0 X-Spam-Status: No, score=-13.7 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: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org From: Yannick Moy The dependency on Ada.Streams is problematic for light runtimes. As these streaming facilities are in fact not used in formal containers, remove the corresponding dead code. gcc/ada/ * libgnat/a-chtgfo.adb (Generic_Read, Generic_Write): Remove. * libgnat/a-chtgfo.ads: Same. Remove dependency on Ada.Streams. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/libgnat/a-chtgfo.adb | 68 ------------------------------------ gcc/ada/libgnat/a-chtgfo.ads | 24 ------------- 2 files changed, 92 deletions(-) diff --git a/gcc/ada/libgnat/a-chtgfo.adb b/gcc/ada/libgnat/a-chtgfo.adb index c3fff336e9d..df7b554c050 100644 --- a/gcc/ada/libgnat/a-chtgfo.adb +++ b/gcc/ada/libgnat/a-chtgfo.adb @@ -359,74 +359,6 @@ package body Ada.Containers.Hash_Tables.Generic_Formal_Operations is end loop; end Generic_Iteration; - ------------------ - -- Generic_Read -- - ------------------ - - procedure Generic_Read - (Stream : not null access Root_Stream_Type'Class; - HT : out Hash_Table_Type) - is - N : Count_Type'Base; - - begin - Clear (HT); - - Count_Type'Base'Read (Stream, N); - - if Checks and then N < 0 then - raise Program_Error with "stream appears to be corrupt"; - end if; - - if N = 0 then - return; - end if; - - if Checks and then N > HT.Capacity then - raise Capacity_Error with "too many elements in stream"; - end if; - - for J in 1 .. N loop - declare - Node : constant Count_Type := New_Node (Stream); - Indx : constant Hash_Type := Index (HT, HT.Nodes (Node)); - B : Count_Type renames HT.Buckets (Indx); - begin - Set_Next (HT.Nodes (Node), Next => B); - B := Node; - end; - - HT.Length := HT.Length + 1; - end loop; - end Generic_Read; - - ------------------- - -- Generic_Write -- - ------------------- - - procedure Generic_Write - (Stream : not null access Root_Stream_Type'Class; - HT : Hash_Table_Type) - is - procedure Write (Node : Count_Type); - pragma Inline (Write); - - procedure Write is new Generic_Iteration (Write); - - ----------- - -- Write -- - ----------- - - procedure Write (Node : Count_Type) is - begin - Write (Stream, HT.Nodes (Node)); - end Write; - - begin - Count_Type'Base'Write (Stream, HT.Length); - Write (HT); - end Generic_Write; - ----------- -- Index -- ----------- diff --git a/gcc/ada/libgnat/a-chtgfo.ads b/gcc/ada/libgnat/a-chtgfo.ads index 76633d8da05..f4471bec3d2 100644 --- a/gcc/ada/libgnat/a-chtgfo.ads +++ b/gcc/ada/libgnat/a-chtgfo.ads @@ -30,8 +30,6 @@ -- Hash_Table_Type is used to implement hashed containers. This package -- declares hash-table operations that do not depend on keys. -with Ada.Streams; - generic with package HT_Types is new Generic_Formal_Hash_Table_Types (<>); @@ -113,26 +111,4 @@ package Ada.Containers.Hash_Tables.Generic_Formal_Operations is procedure Generic_Iteration (HT : Hash_Table_Type); -- Calls Process for each node in hash table HT - generic - use Ada.Streams; - with procedure Write - (Stream : not null access Root_Stream_Type'Class; - Node : Node_Type); - procedure Generic_Write - (Stream : not null access Root_Stream_Type'Class; - HT : Hash_Table_Type); - -- Used to implement the streaming attribute for hashed containers. It - -- calls Write for each node to write its value into Stream. - - generic - use Ada.Streams; - with function New_Node (Stream : not null access Root_Stream_Type'Class) - return Count_Type; - procedure Generic_Read - (Stream : not null access Root_Stream_Type'Class; - HT : out Hash_Table_Type); - -- Used to implement the streaming attribute for hashed containers. It - -- first clears hash table HT, then populates the hash table by calling - -- New_Node for each item in Stream. - end Ada.Containers.Hash_Tables.Generic_Formal_Operations;