From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450:4864:20::334]) by sourceware.org (Postfix) with ESMTPS id B644C3849AD3 for ; Fri, 17 May 2024 08:32:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B644C3849AD3 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 B644C3849AD3 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::334 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1715934788; cv=none; b=tG8EJwH4f3tgFAYCVoGeG69WHfFacEjR6eXjDbq7cDHliGFkOYx6Gf90mu+c/i0zZVNHTH8W2jsBn8pCJke41IRTYnQlQCpWOdAiirTkvOSkTXWyFInNX/ilpDSOwWVr2jobYjOvuN6SnLLkWFReDYAIp8BxlVUf/le3OA4CV3I= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1715934788; c=relaxed/simple; bh=qu9r28COzNHbDx7O4IXx0shLwkPJTsAUNp0oN5ua3pM=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=bcnjduwHWbEl2RBJ37gRTlfwqxGobLzDiWryOfrmklHtbSWmgGuEaEjP2tUlSWP3zf40bIw9qfx+26r453Qv1cVUIygwyzmcUVZAK8idf9fa1YOogfxdWqxxdbg8QSOp1da/JViuteNMwPiM5wKHsxruMnKRF9mV+8ZHEMpC7+c= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-41fd5dc0480so57798245e9.1 for ; Fri, 17 May 2024 01:32:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1715934758; x=1716539558; 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=y6SdF1HM7bEMKLspibASJWCy5KYDCNL8Ee2bsnSCysY=; b=jmpFbblM135YK1Js/rax7DH7qOp99zgyDjHx5TfDlu+rwzK7XOv9XY5mXHiSlht6cN f6/ma+yEMawBkRgTz53kKc71y/RTNAKvJyMOsHHI6AX5oK95xh5oJnMV1Kj5tCxXbb5c KNMx0OwN8SndZ7DbBs9ms0a2twLGk8c+aDP+xTvq2/y5uZzbgxMbHRYpr7mnslszQPhd DKZ2VKVwQ65ObJoO865WkJY6Dc3qht2Ekppm7nqaGgCOFiESDOL6+SDjtOUrRFx+vBmP mYI03olWz5f7NivzzPkJCKQ8LqaOeRq1bCDlP86bOJTLrFb434Ha/WLu8nG3B7uz+vpD I7ow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715934758; x=1716539558; 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=y6SdF1HM7bEMKLspibASJWCy5KYDCNL8Ee2bsnSCysY=; b=CL/8++nCOJ5QaD68laYV2kxnolBVcyUMHGygwXKNtVuwbKBMxKhR78YsSJ408f7LA0 2syqmOIXYDnokNLJPPL/PlF/Tlw13xo0Uo8ojf+HXc4/THbbm+0YDJUuawdGCADXFNRu 4U8NUJXreUoPEnh5eotjcbd/BsLjx3jsySt+MBM1TQ+ufEHLCedx0CrBvi+VOYX06tlQ Z5FFIBwROL28H5DfpmA9BhjBvPrPr/tQAvtdHezusB5iImeYJ1+vSnrAw8e0ggHu8zHo x0QQ1tBk70h2uQJfBiBq2Wu0plG+8qqK71C+74jXh1dQlRik2rLsfJPWzxPD1pXt6EKq PX5Q== X-Gm-Message-State: AOJu0Yzkz1z+kWfamjl3BfG4Wjv9NlMMz2Te3G2gLYbZEiSkBZLaUkDt D7EA0LccJnwX4NoAHICPckctVXxnzF2PYSQz8gk+iK5u9Jw4UOwr9hl3VsfXjp5DUzfHynfK5WQ = X-Google-Smtp-Source: AGHT+IGYJpA1BEEWzYNGjlf70DgzOgk/5YZpNlwbCKLzeWeqRhhIe8OlQGoaS2y7UVfc7F4f+kJdjw== X-Received: by 2002:a05:600c:1d0a:b0:41a:ff7d:2473 with SMTP id 5b1f17b1804b1-41feaa2f414mr175839845e9.4.1715934758595; Fri, 17 May 2024 01:32:38 -0700 (PDT) Received: from poulhies-Precision-5550.lan ([2001:861:3382:1a90:de37:8b1c:1f33:2610]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-420273cff03sm75197045e9.26.2024.05.17.01.32.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 May 2024 01:32:38 -0700 (PDT) From: =?UTF-8?q?Marc=20Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Steve Baird Subject: [COMMITTED 24/35] ada: Do not query the modification time of a special file. Date: Fri, 17 May 2024 10:31:56 +0200 Message-ID: <20240517083207.130391-24-poulhies@adacore.com> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240517083207.130391-1-poulhies@adacore.com> References: <20240517083207.130391-1-poulhies@adacore.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-14.0 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 autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: From: Steve Baird In Ada.Directories, the function Modification_Time raises Name_Error if it is called for a special file. So don't do that in Start_Search_Internal. gcc/ada/ * libgnat/a-direct.adb (Start_Search_Internal): Do not call Modification_Time for a special file; declare a Calendar.Time constant No_Time and use that instead. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/libgnat/a-direct.adb | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/gcc/ada/libgnat/a-direct.adb b/gcc/ada/libgnat/a-direct.adb index 32e020c48c3..adff12277e8 100644 --- a/gcc/ada/libgnat/a-direct.adb +++ b/gcc/ada/libgnat/a-direct.adb @@ -29,7 +29,7 @@ -- -- ------------------------------------------------------------------------------ -with Ada.Calendar; use Ada.Calendar; +with Ada.Calendar.Formatting; use Ada.Calendar; with Ada.Characters.Handling; use Ada.Characters.Handling; with Ada.Containers.Vectors; with Ada.Directories.Validity; use Ada.Directories.Validity; @@ -1392,6 +1392,17 @@ package body Ada.Directories is end record; Res : Result := (Found => False); + + -- This declaration of No_Time copied from GNAT.Calendar + -- because adding a "with GNAT.Calendar;" to this unit + -- results in problems. + + No_Time : constant Ada.Calendar.Time := + Ada.Calendar.Formatting.Time_Of + (Ada.Calendar.Year_Number'First, + Ada.Calendar.Month_Number'First, + Ada.Calendar.Day_Number'First, + Time_Zone => 0); begin -- Get the file attributes for the directory item @@ -1452,7 +1463,10 @@ package body Ada.Directories is Full_Name => To_Unbounded_String (Path), Attr_Error_Code => 0, Kind => Res.Kind, - Modification_Time => Modification_Time (Path), + Modification_Time => + (if Res.Kind = Special_File + then No_Time + else Modification_Time (Path)), Size => Res.Size)); end if; end if; -- 2.43.2