From 0a4f86a80d2ca1c2ce90a5eb6d696644a80a8c48 Mon Sep 17 00:00:00 2001 From: Ronan Desplanques Date: Thu, 14 Nov 2024 17:11:03 +0100 Subject: [PATCH] ada: Tweak Is_Predefined_File_Name This patch slightly widens the set of filenames that the compiler considers predefined. That makes it possible to build the GNAT runtime using only the file mapping facilities of the compiler, without having to rename files. gcc/ada/ChangeLog: * fname.adb (Is_Predefined_File_Name): Tweak test. --- gcc/ada/fname.adb | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/gcc/ada/fname.adb b/gcc/ada/fname.adb index 165411cf6ecf..7c5572a8c03d 100644 --- a/gcc/ada/fname.adb +++ b/gcc/ada/fname.adb @@ -141,6 +141,8 @@ package body Fname is if Fname'Length > 12 and then Fname (Fname'First .. Fname'First + 1) /= "i-" and then Fname (Fname'First .. Fname'First + 1) /= "s-" + and then not Has_Prefix (Fname, "system-") + and then not Has_Prefix (Fname, "interfac__") then return False; end if; @@ -151,23 +153,24 @@ package body Fname is -- Definitely predefined if prefix is a- i- or s- - if Fname'Length >= 2 then - declare - S : String renames Fname (Fname'First .. Fname'First + 1); - begin - if S = "a-" or else S = "i-" or else S = "s-" then - return True; - end if; - end; - end if; + pragma Assert (Fname'Length >= 2); + declare + S : String renames Fname (Fname'First .. Fname'First + 1); + begin + if S = "a-" or else S = "i-" or else S = "s-" then + return True; + end if; + end; -- We include the "." in the prefixes below, so we don't match (e.g.) -- adamant.ads. So the first line matches "ada.ads", "ada.adb", and -- "ada.ali". But that's not necessary if they have 8 characters. if Has_Prefix (Fname, "ada.") -- Ada - or else Has_Prefix (Fname, "interfac") -- Interfaces + or else Fname = "interfac.ads" + or else Has_Prefix (Fname, "interfac__") or else Has_Prefix (Fname, "system.a") -- System + or else Has_Prefix (Fname, "system-") -- System with platform suffix then return True; end if; -- 2.47.2