diff --git a/gpr/src/gpr-compilation-sync.adb b/gpr/src/gpr-compilation-sync.adb index 37fe294b..3eece31c 100644 --- a/gpr/src/gpr-compilation-sync.adb +++ b/gpr/src/gpr-compilation-sync.adb @@ -196,12 +196,7 @@ package body GPR.Compilation.Sync is function Match (Name : String; R_Set : Regexp_Set) return Boolean is begin - for Regexp of R_Set loop - if Match (Name, Regexp) then - return True; - end if; - end loop; - return False; + return (for some Regexp of R_Set => Match (Name, Regexp)); end Match; S_Name : constant String := Simple_Name (File); diff --git a/gpr/src/gpr-conf.adb b/gpr/src/gpr-conf.adb index 3a017b4e..530a4469 100644 --- a/gpr/src/gpr-conf.adb +++ b/gpr/src/gpr-conf.adb @@ -1422,12 +1422,9 @@ package body GPR.Conf is function Is_Base_Name (Path : String) return Boolean is begin - for I in Path'Range loop - if Path (I) = Directory_Separator or else Path (I) = '/' then - return False; - end if; - end loop; - return True; + return + (for all I in Path'Range => + not (Path (I) = Directory_Separator or else Path (I) = '/')); end Is_Base_Name; -- Local Variables diff --git a/gpr/src/gpr-env.adb b/gpr/src/gpr-env.adb index af23704e..a147a89f 100644 --- a/gpr/src/gpr-env.adb +++ b/gpr/src/gpr-env.adb @@ -351,22 +351,13 @@ package body GPR.Env is Last : constant Integer := Path'Last - Dir'Length + 1; begin - for J in Path'First .. Last loop - - -- Note: the order of the conditions below is important, since - -- it ensures a minimal number of string comparisons. - - if (J = Path'First or else Path (J - 1) = Path_Separator) + return + (for some J in Path'First .. Last => + (J = Path'First or else Path (J - 1) = Path_Separator) and then - (J + Dir'Length > Path'Last - or else Path (J + Dir'Length) = Path_Separator) - and then Dir = Path (J .. J + Dir'Length - 1) - then - return True; - end if; - end loop; - - return False; + (J + Dir'Length > Path'Last + or else Path (J + Dir'Length) = Path_Separator) + and then Dir = Path (J .. J + Dir'Length - 1)); end Is_Present; -- Start of processing for Add_To_Path diff --git a/gpr/src/gpr-util.adb b/gpr/src/gpr-util.adb index cd3ad67c..b1a815f2 100644 --- a/gpr/src/gpr-util.adb +++ b/gpr/src/gpr-util.adb @@ -2217,22 +2217,16 @@ package body GPR.Util is -- Definitely predefined if prefix is a- i- or s- followed by letter - if Name_Len >= 3 - and then Name_Buffer (2) = '-' - and then (Name_Buffer (1) = 'a' - or else - Name_Buffer (1) = 'g' - or else - Name_Buffer (1) = 'i' - or else - Name_Buffer (1) = 's') - and then (Name_Buffer (3) in 'a' .. 'z' - or else - Name_Buffer (3) in 'A' .. 'Z') + if Name_Len >= 3 and then Name_Buffer (2) = '-' + and then + (Name_Buffer (1) = 'a' or else Name_Buffer (1) = 'g' + or else Name_Buffer (1) = 'i' or else Name_Buffer (1) = 's') + and then + (Name_Buffer (3) in 'a' .. 'z' or else Name_Buffer (3) in 'A' .. 'Z') then return True; - -- Definitely false if longer than 12 characters (8.3) + -- Definitely false if longer than 12 characters (8.3) elsif Name_Len > 8 then return False; @@ -2241,17 +2235,13 @@ package body GPR.Util is -- Otherwise check against special list, first padding to 8 characters while Name_Len < 8 loop - Name_Len := Name_Len + 1; + Name_Len := Name_Len + 1; Name_Buffer (Name_Len) := ' '; end loop; - for J in Predef_Names'Range loop - if Name_Buffer (1 .. 8) = Predef_Names (J) then - return True; - end if; - end loop; - - return False; + return + (for some J in Predef_Names'Range => + Name_Buffer (1 .. 8) = Predef_Names (J)); end Is_Ada_Predefined_File_Name; ---------------------------- @@ -3969,12 +3959,9 @@ package body GPR.Util is function Is_Base_Name (Path : String) return Boolean is begin - for I in Path'Range loop - if Is_Directory_Separator (Path (I)) then - return False; - end if; - end loop; - return True; + return + (for all I in Path'Range => + not (Is_Directory_Separator (Path (I)))); end Is_Base_Name; RTS_Name : constant String := GPR.Conf.Runtime_Name_For (Language); diff --git a/gpr/src/gpr_build_util.adb b/gpr/src/gpr_build_util.adb index 364d1796..0281a80e 100644 --- a/gpr/src/gpr_build_util.adb +++ b/gpr/src/gpr_build_util.adb @@ -1968,15 +1968,11 @@ package body Gpr_Build_Util is function Is_Virtually_Empty return Boolean is begin if One_Queue_Per_Obj_Dir then - for J in Q_First .. Q.Last loop - if not Q.Table (J).Processed - and then Available_Obj_Dir (Q.Table (J).Info) - then - return False; - end if; - end loop; - - return True; + return + (for all J in Q_First .. Q.Last => + not + (not Q.Table (J).Processed + and then Available_Obj_Dir (Q.Table (J).Info))); else return Is_Empty; diff --git a/src/gprslave.adb b/src/gprslave.adb index fb396501..f0657dbc 100644 --- a/src/gprslave.adb +++ b/src/gprslave.adb @@ -579,12 +579,7 @@ procedure Gprslave is function Working_Dir_Exists (Directory : String) return Boolean is begin - for B of Builders loop - if Work_Directory (B) = Directory then - return True; - end if; - end loop; - return False; + return (for some B of Builders => Work_Directory (B) = Directory); end Working_Dir_Exists; end Builders;