Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

prefer membership tests #129

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 16 additions & 16 deletions gpr/src/gpr-ali.adb
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ package body GPR.ALI is
while C not in 'A' .. 'Z'
or else not Known_ALI_Lines (C)
loop
if C = CR or else C = LF then
if C in CR | LF then
Skip_Next_Line;
C := Nextc;

Expand Down Expand Up @@ -997,15 +997,15 @@ package body GPR.ALI is

-- Version field

if C in '0' .. '9' or else C in 'a' .. 'f' then
if C in '0' .. '9' | 'a' .. 'f' then
Units.Table (Units.Last).Version (1) := C;

for J in 2 .. 8 loop
C := Getc;
C := Getc;
Units.Table (Units.Last).Version (J) := C;
end loop;

-- BD/BN parameters
-- BD/BN parameters

elsif C = 'B' then
C := Getc;
Expand All @@ -1019,7 +1019,7 @@ package body GPR.ALI is
Units.Table (Units.Last).Body_Needed_For_SAL := True;
end if;

-- DE parameter (Dynamic elaboration checks)
-- DE parameter (Dynamic elaboration checks)

elsif C = 'D' then
C := Getc;
Expand All @@ -1029,7 +1029,7 @@ package body GPR.ALI is
Units.Table (Units.Last).Dynamic_Elab := True;
end if;

-- EB/EE parameters
-- EB/EE parameters

elsif C = 'E' then
C := Getc;
Expand All @@ -1042,7 +1042,7 @@ package body GPR.ALI is

Check_At_End_Of_Field;

-- GE parameter (generic)
-- GE parameter (generic)

elsif C = 'G' then
C := Getc;
Expand All @@ -1052,7 +1052,7 @@ package body GPR.ALI is
Units.Table (Units.Last).Is_Generic := True;
end if;

-- IL/IS/IU parameters
-- IL/IS/IU parameters

elsif C = 'I' then
C := Getc;
Expand All @@ -1067,7 +1067,7 @@ package body GPR.ALI is

Check_At_End_Of_Field;

-- KM/KU parameters
-- KM/KU parameters

elsif C = 'K' then
C := Getc;
Expand All @@ -1080,7 +1080,7 @@ package body GPR.ALI is

Check_At_End_Of_Field;

-- NE parameter
-- NE parameter

elsif C = 'N' then
C := Getc;
Expand All @@ -1090,7 +1090,7 @@ package body GPR.ALI is
Check_At_End_Of_Field;
end if;

-- PF/PR/PU/PK parameters
-- PF/PR/PU/PK parameters

elsif C = 'P' then
C := Getc;
Expand All @@ -1107,18 +1107,18 @@ package body GPR.ALI is

Check_At_End_Of_Field;

-- OL/OO/OS/OT parameters
-- OL/OO/OS/OT parameters

elsif C = 'O' then
C := Getc;

if C = 'L' or else C = 'O' or else C = 'S' or else C = 'T' then
if C in 'L' | 'O' | 'S' | 'T' then
Units.Table (Units.Last).Optimize_Alignment := C;
end if;

Check_At_End_Of_Field;

-- RC/RT parameters
-- RC/RT parameters

elsif C = 'R' then
C := Getc;
Expand All @@ -1133,7 +1133,7 @@ package body GPR.ALI is

Check_At_End_Of_Field;

-- SE/SP/SU parameters
-- SE/SP/SU parameters

elsif C = 'S' then
C := Getc;
Expand Down Expand Up @@ -1161,7 +1161,7 @@ package body GPR.ALI is

With_Loop : loop
Check_Unknown_Line;
exit With_Loop when C /= 'W' and then C /= 'Y' and then C /= 'Z';
exit With_Loop when C not in 'W' | 'Y' | 'Z';

if Ignore ('W') then
Skip_Next_Line;
Expand Down
4 changes: 2 additions & 2 deletions gpr/src/gpr-attr.adb
Original file line number Diff line number Diff line change
Expand Up @@ -1825,7 +1825,7 @@ package body GPR.Attr is
(Pkg : Package_Node_Id) return Attribute_Node_Id
is
begin
if Pkg = Empty_Package or else Pkg = Unknown_Package then
if Pkg in Empty_Package | Unknown_Package then
return Empty_Attribute;
else
return
Expand All @@ -1839,7 +1839,7 @@ package body GPR.Attr is

function Is_Package_Known (Pkg : Package_Node_Id) return Boolean is
begin
if Pkg = Empty_Package or else Pkg = Unknown_Package then
if Pkg in Empty_Package | Unknown_Package then
return False;
else
return Package_Attributes.Table (Pkg.Value).Known;
Expand Down
14 changes: 7 additions & 7 deletions gpr/src/gpr-conf.adb
Original file line number Diff line number Diff line change
Expand Up @@ -534,12 +534,12 @@ package body GPR.Conf is
end if;

OK :=
Target = ""
or else Target = "native"
or else
(Tgt_Name /= No_Name
and then (Tgt_Name = Empty_String
or else Target = Get_Name_String (Tgt_Name)));
Target in "" | "native"
or else
(Tgt_Name /= No_Name
and then
(Tgt_Name = Empty_String
or else Target = Get_Name_String (Tgt_Name)));

if not OK then
if Autoconf_Specified then
Expand Down Expand Up @@ -1423,7 +1423,7 @@ 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
if Path (I) in Directory_Separator | '/' then
return False;
end if;
end loop;
Expand Down
64 changes: 24 additions & 40 deletions gpr/src/gpr-dect.adb
Original file line number Diff line number Diff line change
Expand Up @@ -226,25 +226,18 @@ package body GPR.Dect is
-- is not allowed in aggregate projects, but is allowed in aggregate
-- library projects.

if ((Qualif = Aggregate
or else
Qualif = Aggregate_Library)
and then
(Name = Name_Naming or else
Name = Name_Compiler or else
Name = Name_Linker))
if
((Qualif in Aggregate | Aggregate_Library)
and then (Name in Name_Naming | Name_Compiler | Name_Linker))
or else
(Qualif = Aggregate
and then
(Name = Name_Install or else
Name = Name_Binder))
(Qualif = Aggregate and then (Name in Name_Install | Name_Binder))
then
Error_Msg_Name_1 := Name;

Error_Msg
(Flags,
"package %% cannot be used in aggregate"
& (if Qualif = Aggregate then "" else " library") & " projects",
"package %% cannot be used in aggregate" &
(if Qualif = Aggregate then "" else " library") & " projects",
Location_Of (Current_Package, In_Tree));
end if;
end Check_Package_Allowed;
Expand All @@ -266,49 +259,40 @@ package body GPR.Dect is
begin
case Qualif is
when Aggregate | Aggregate_Library =>
if Name = Snames.Name_Languages
or else Name = Snames.Name_Source_Files
or else Name = Snames.Name_Source_List_File
or else Name = Snames.Name_Locally_Removed_Files
or else Name = Snames.Name_Excluded_Source_Files
or else Name = Snames.Name_Excluded_Source_List_File
or else Name = Snames.Name_Exec_Dir
or else Name = Snames.Name_Source_Dirs
or else Name = Snames.Name_Inherit_Source_Path
if Name in Snames.Name_Languages | Snames.Name_Source_Files |
Snames.Name_Source_List_File |
Snames.Name_Locally_Removed_Files |
Snames.Name_Excluded_Source_Files |
Snames.Name_Excluded_Source_List_File |
Snames.Name_Exec_Dir | Snames.Name_Source_Dirs |
Snames.Name_Inherit_Source_Path
or else
(Qualif = Aggregate and then Name = Snames.Name_Interfaces)
(Qualif = Aggregate and then Name = Snames.Name_Interfaces)
or else
(Qualif = Aggregate and then Name = Snames.Name_Library_Dir)
(Qualif = Aggregate and then Name = Snames.Name_Library_Dir)
or else
(Qualif = Aggregate and then Name = Snames.Name_Library_Name)
or else Name = Snames.Name_Main
or else Name = Snames.Name_Roots
(Qualif = Aggregate and then Name = Snames.Name_Library_Name)
or else Name = Snames.Name_Main or else Name = Snames.Name_Roots
or else Name = Snames.Name_Externally_Built
or else Name = Snames.Name_Executable
or else Name = Snames.Name_Executable_Suffix
or else
(Qualif = Aggregate and then
Name = Snames.Name_Default_Switches)
(Qualif = Aggregate and then Name = Snames.Name_Default_Switches)
then
Error_Msg_Name_1 := Name;
Error_Msg
(Flags,
"%% is not valid in aggregate projects",
Location_Of (Attribute, In_Tree),
Always => True);
(Flags, "%% is not valid in aggregate projects",
Location_Of (Attribute, In_Tree), Always => True);
end if;

when others =>
if Name = Snames.Name_Project_Files
or else Name = Snames.Name_Project_Path
or else Name = Snames.Name_External
if Name in Snames.Name_Project_Files | Snames.Name_Project_Path |
Snames.Name_External
then
Error_Msg_Name_1 := Name;
Error_Msg
(Flags,
"%% is only valid in aggregate projects",
Location_Of (Attribute, In_Tree),
Always => True);
(Flags, "%% is only valid in aggregate projects",
Location_Of (Attribute, In_Tree), Always => True);
end if;
end case;
end Check_Attribute_Allowed;
Expand Down
Loading