From patchwork Mon Jun 10 09:07:30 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: 1945800 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=POtxBcGN; 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 4VyR4g1cZgz20Tk for ; Mon, 10 Jun 2024 19:16:19 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 7A6C6385C6D1 for ; Mon, 10 Jun 2024 09:16:17 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wr1-x432.google.com (mail-wr1-x432.google.com [IPv6:2a00:1450:4864:20::432]) by sourceware.org (Postfix) with ESMTPS id EB6413858D34 for ; Mon, 10 Jun 2024 09:08:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org EB6413858D34 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 EB6413858D34 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::432 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718010498; cv=none; b=V6oYzhcx4JfhXZWEob4P5BTL8UW+Bj6pB8H+MNyYadhHUEp+p2fgbEcnwJN+y9SH81nkrdVlqXmU44sp1DdPreifuxwTvD+IX70iO++LCVVm+AD0AyPKEqmZ0YvFR/VkplkTslFnSCpbJAk8e9xHauPXWIluXGxmFWCC8K0Hrso= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718010498; c=relaxed/simple; bh=I8YnDHFtTOVeEd53ritrMCMSb2Uctg39UWi1iQFyzh0=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=Nc339OfaI6IA+412u6JjXRYPe5aFy+Pz0fQ0jEaf4MgDiwEfwtXaCYdlMM4nYjnVRxjLZDoSEGC9Q0nYqThWXAED0PGBA9z8KiucuJITgP4vuacmli5L38KcudL1AZvX/L+ghnT/N9uZtA/zC9HwRJ/OKv6exCMADG893ddD6Z8= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wr1-x432.google.com with SMTP id ffacd0b85a97d-35f1cb7a40fso1144615f8f.0 for ; Mon, 10 Jun 2024 02:08:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1718010493; x=1718615293; 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=2GcrSNRRP2rVwn5Lfq8fTp/orIOABQg28yJ/iO1uQp8=; b=POtxBcGNYFV5MrPQj4Xxidr8TpWcLLPugHjO0tBMiMD0ssJxWXQ9eZ5iLi/oBpMoFZ BgLs3AV8DbslXVDQ8y9hGATBVMp2EI/BSPpfM3tPdiYLZ4O6cA6Hb0bQ4NnZ4jlJ97dc aqIz7IMnNf6nvfH78uLG36IXNyTLdSMeMTaBNUNzotL+mMzA1Ssb3QFPRQngDDq/dieK 13wdvl3N+Y97fj44CCC9fcayed4TWm+/5dd1/mypXQYauZ8CLgwQ0gK/dKYjr6NS6dx9 0Fk3twiPuCkWeKwoxRL65OAGjDJGeHZqV4dRFAW83jwrq4LrIOaQ19p7GJsTR+IWLf4A 7BuA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718010493; x=1718615293; 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=2GcrSNRRP2rVwn5Lfq8fTp/orIOABQg28yJ/iO1uQp8=; b=peOOBRiQFViLIAHdbOWguHi/DhwGTkMFL8HYWmB0V/7lBV0g6uj0FThmRI+zH9bFWA nxESxHUdkne9yMawVryUjHsaV98S/NTUUvvDQO/G9F0XCgyJqVNpY9OlPGxK6j6mc08Q esLoVK+gqdBpG4p47YRMUsLWWMZXcoHIbX9uveAuH9Tr8Fn1t7Lm1kIIfvjSsMl1AHGV 3dJaJKkzM0nIMYEE73m9/0GHYq26Q8uVx3Y6sPPLlPvZjjCggVPxdycmeJ7Qi4+OwB9o +riuyuzxGV0+mUXaQS+BQZU9QNrbojCBRIb5U51Jh2JVYE4fzpLpi048Jy6aBbgm8bd4 jmdQ== X-Gm-Message-State: AOJu0YzVwFR+neneOKvVdxGaxJ2KTPETyT1JrVOTWok9Y7hl/zljoZm7 xDpeLWMW2ytdM4nYqoQzYSfOd38/Ur1gMkxakIwn9H2FAgEJRqACZ5gSPgL1opB18teFf14E+ZE = X-Google-Smtp-Source: AGHT+IERmOZnacFiSEweIhBeO9Lo7EvPkAjg5Tdl1GCztM4lSgNo4n9HQzCuleMnTKKZcTQqWNYjVw== X-Received: by 2002:adf:f405:0:b0:35f:10cf:6068 with SMTP id ffacd0b85a97d-35f10cf6256mr3590378f8f.27.1718010492796; Mon, 10 Jun 2024 02:08:12 -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.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Jun 2024 02:08:12 -0700 (PDT) From: =?utf-8?q?Marc_Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Ronan Desplanques Subject: [COMMITTED 14/30] ada: Remove incorrect assertion in run-time Date: Mon, 10 Jun 2024 11:07:30 +0200 Message-ID: <20240610090747.1557638-14-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.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_ASCII_DIVIDERS, 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: Ronan Desplanques There is a special case of file paths on Windows that are absolute but don't start with a drive letter: UNC paths. This patch removes an assertion in System.OS_Lib.Normalize_Pathname that failed to take this case into account. It also renames a local subprogram of Normalize_Pathname to make its purpose clearer. gcc/ada/ * libgnat/s-os_lib.adb (Normalize_Pathname): Remove incorrect assert statement. (Missed_Drive_Letter): Rename into... (Drive_Letter_Omitted): This. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/libgnat/s-os_lib.adb | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/gcc/ada/libgnat/s-os_lib.adb b/gcc/ada/libgnat/s-os_lib.adb index 20e109aaa0b..dd2156e1dcb 100644 --- a/gcc/ada/libgnat/s-os_lib.adb +++ b/gcc/ada/libgnat/s-os_lib.adb @@ -2089,8 +2089,10 @@ package body System.OS_Lib is -- Returns True only if the Name is including a drive -- letter at start. - function Missed_Drive_Letter (Name : String) return Boolean; - -- Missed drive letter at start of the normalized pathname + function Drive_Letter_Omitted (Name : String) return Boolean; + -- Name must be an absolute path. Returns True if and only if + -- Name doesn't start with a drive letter and Name is not a + -- UNC path. ------------------- -- Is_With_Drive -- @@ -2104,11 +2106,11 @@ package body System.OS_Lib is or else Name (Name'First) in 'A' .. 'Z'); end Is_With_Drive; - ------------------------- - -- Missed_Drive_Letter -- - ------------------------- + -------------------------- + -- Drive_Letter_Omitted -- + -------------------------- - function Missed_Drive_Letter (Name : String) return Boolean is + function Drive_Letter_Omitted (Name : String) return Boolean is begin return On_Windows and then not Is_With_Drive (Name) @@ -2117,7 +2119,7 @@ package body System.OS_Lib is /= Directory_Separator or else Name (Name'First + 1) /= Directory_Separator); - end Missed_Drive_Letter; + end Drive_Letter_Omitted; ----------------- -- Final_Value -- @@ -2174,7 +2176,7 @@ package body System.OS_Lib is elsif Directory = "" or else not Is_Absolute_Path (Directory) - or else Missed_Drive_Letter (Directory) + or else Drive_Letter_Omitted (Directory) then -- Directory name not given or it is not absolute or without drive -- letter on Windows, get current directory. @@ -2251,7 +2253,7 @@ package body System.OS_Lib is end if; if Is_Absolute_Path (Name) then - if Missed_Drive_Letter (Name) then + if Drive_Letter_Omitted (Name) then Fill_Directory (Drive_Only => True); -- Take only drive letter part with colon @@ -2286,8 +2288,6 @@ package body System.OS_Lib is -- Ensure drive letter is upper-case - pragma Assert (Path_Buffer (2) = ':'); - if Path_Buffer (1) in 'a' .. 'z' then System.Case_Util.To_Upper (Path_Buffer (1 .. 1)); end if;