-- Component type. Elements of this component type can appear as one
-- of the operands of concatenation as well as arrays.
- Ityp : constant Entity_Id := Etype (First_Index (Atyp));
- -- Index type
+ Istyp : constant Entity_Id := Etype (First_Index (Atyp));
+ -- Index subtype
+
+ Ityp : constant Entity_Id := Base_Type (Istyp);
+ -- Index type. This is the base type of the index subtype, and is used
+ -- for all computed bounds (which may be out of range of Istyp in the
+ -- case of null ranges).
Intyp : Entity_Id;
-- This is the type we use to do arithmetic to compute the bounds and
function To_Intyp (X : Node_Id) return Node_Id is
begin
- if Base_Type (Ityp) = Base_Type (Intyp) then
+ if Ityp = Base_Type (Intyp) then
return X;
elsif Is_Enumeration_Type (Ityp) then
else
-- If the value is known at compile time, and known to be out of
- -- range of the index type or the base type, we can signal that
+ -- range of the index subtype or its base type, we can signal that
-- we are sure to have a constraint error at run time.
-- There are two reasons for doing this. First of all, it is of
Analyze_And_Resolve (X);
if Compile_Time_Compare
- (X, Type_High_Bound (Ityp),
+ (X, Type_High_Bound (Istyp),
Assume_Valid => False) = GT
or else
Compile_Time_Compare
- (X, Type_High_Bound (Base_Type (Ityp)),
+ (X, Type_High_Bound (Ityp),
Assume_Valid => False) = GT
then
Apply_Compile_Time_Constraint_Error
raise Concatenation_Error;
else
- if Base_Type (Ityp) = Base_Type (Intyp) then
+ if Ityp = Base_Type (Intyp) then
return X;
else
return Convert_To (Ityp, X);
-- identity type, and for larger unsigned types we use 64-bits.
elsif Is_Modular_Integer_Type (Ityp) then
- if RM_Size (Base_Type (Ityp)) < RM_Size (Standard_Unsigned) then
+ if RM_Size (Ityp) < RM_Size (Standard_Unsigned) then
Intyp := Standard_Unsigned;
- elsif RM_Size (Base_Type (Ityp)) = RM_Size (Standard_Unsigned) then
- Intyp := Base_Type (Ityp);
+ elsif RM_Size (Ityp) = RM_Size (Standard_Unsigned) then
+ Intyp := Ityp;
else
Intyp := RTE (RE_Long_Long_Unsigned);
end if;
-- Similar treatment for signed types
else
- if RM_Size (Base_Type (Ityp)) < RM_Size (Standard_Integer) then
+ if RM_Size (Ityp) < RM_Size (Standard_Integer) then
Intyp := Standard_Integer;
- elsif RM_Size (Base_Type (Ityp)) = RM_Size (Standard_Integer) then
- Intyp := Base_Type (Ityp);
+ elsif RM_Size (Ityp) = RM_Size (Standard_Integer) then
+ Intyp := Ityp;
else
Intyp := Standard_Long_Long_Integer;
end if;
Opnd_Low_Bound (NN) :=
Make_Attribute_Reference (Loc,
- Prefix => New_Reference_To (Ityp, Loc),
+ Prefix => New_Reference_To (Istyp, Loc),
Attribute_Name => Name_First);
Set := True;
package body Prj.Nmsc is
- type Source_Data_Access is access Source_Data;
-
No_Continuation_String : aliased String := "";
Continuation_String : aliased String := "\";
-- Used in Check_Library for continuation error messages at the same
declare
Language : Language_Index;
Source : Source_Id;
- Src_Data : Source_Data_Access;
Alt_Lang : Alternate_Language_Id;
Alt_Lang_Data : Alternate_Language_Data;
Continuation : Boolean := False;
while Language /= No_Language_Index loop
Source := Data.First_Source;
Source_Loop : while Source /= No_Source loop
- Src_Data :=
- In_Tree.Sources.Table (Source)'Unrestricted_Access;
-
- exit Source_Loop when Src_Data.Language = Language;
+ declare
+ Src_Data : Source_Data renames
+ In_Tree.Sources.Table (Source);
+ begin
+ exit Source_Loop when Src_Data.Language = Language;
- Alt_Lang := Src_Data.Alternate_Languages;
+ Alt_Lang := Src_Data.Alternate_Languages;
- Alternate_Loop :
- while Alt_Lang /= No_Alternate_Language loop
- Alt_Lang_Data :=
- In_Tree.Alt_Langs.Table (Alt_Lang);
- exit Source_Loop
- when Alt_Lang_Data.Language = Language;
- Alt_Lang := Alt_Lang_Data.Next;
- end loop Alternate_Loop;
+ Alternate_Loop :
+ while Alt_Lang /= No_Alternate_Language loop
+ Alt_Lang_Data :=
+ In_Tree.Alt_Langs.Table (Alt_Lang);
+ exit Source_Loop
+ when Alt_Lang_Data.Language = Language;
+ Alt_Lang := Alt_Lang_Data.Next;
+ end loop Alternate_Loop;
- Source := Src_Data.Next_In_Project;
+ Source := Src_Data.Next_In_Project;
+ end;
end loop Source_Loop;
if Source = No_Source then
Name : File_Name_Type;
Source : Source_Id;
- Src_Data : Source_Data_Access;
Project_2 : Project_Id;
Data_2 : Project_Data;
loop
Source := Data_2.First_Source;
while Source /= No_Source loop
- Src_Data := In_Tree.Sources.Table (Source)'Unrestricted_Access;
- Src_Data.In_Interfaces := False;
- Source := Src_Data.Next_In_Project;
+ declare
+ Src_Data : Source_Data renames
+ In_Tree.Sources.Table (Source);
+ begin
+ Src_Data.In_Interfaces := False;
+ Source := Src_Data.Next_In_Project;
+ end;
end loop;
Project_2 := Data_2.Extends;
loop
Source := Data_2.First_Source;
while Source /= No_Source loop
- Src_Data :=
- In_Tree.Sources.Table (Source)'Unrestricted_Access;
- if Src_Data.File = Name then
- if not Src_Data.Locally_Removed then
- Src_Data.In_Interfaces := True;
- Src_Data.Declared_In_Interfaces := True;
-
- if Src_Data.Other_Part /= No_Source then
- In_Tree.Sources.Table
- (Src_Data.Other_Part).In_Interfaces := True;
- In_Tree.Sources.Table
- (Src_Data.Other_Part).Declared_In_Interfaces :=
- True;
- end if;
+ declare
+ Src_Data : Source_Data renames
+ In_Tree.Sources.Table (Source);
+ begin
+ if Src_Data.File = Name then
+ if not Src_Data.Locally_Removed then
+ Src_Data.In_Interfaces := True;
+ Src_Data.Declared_In_Interfaces := True;
- if Current_Verbosity = High then
- Write_Str (" interface: ");
- Write_Line (Get_Name_String (Src_Data.Path.Name));
+ if Src_Data.Other_Part /= No_Source then
+ In_Tree.Sources.Table
+ (Src_Data.Other_Part).In_Interfaces := True;
+ In_Tree.Sources.Table
+ (Src_Data.Other_Part).Declared_In_Interfaces :=
+ True;
+ end if;
+
+ if Current_Verbosity = High then
+ Write_Str (" interface: ");
+ Write_Line
+ (Get_Name_String (Src_Data.Path.Name));
+ end if;
end if;
- end if;
- exit Big_Loop;
- end if;
+ exit Big_Loop;
+ end if;
- Source := Src_Data.Next_In_Project;
+ Source := Src_Data.Next_In_Project;
+ end;
end loop;
Project_2 := Data_2.Extends;
if Data.Interfaces_Defined then
Source := Data.First_Source;
while Source /= No_Source loop
- Src_Data := In_Tree.Sources.Table (Source)'Unrestricted_Access;
-
- if not Src_Data.Declared_In_Interfaces then
- Src_Data.In_Interfaces := False;
- end if;
+ declare
+ Src_Data : Source_Data renames
+ In_Tree.Sources.Table (Source);
+ begin
+ if not Src_Data.Declared_In_Interfaces then
+ Src_Data.In_Interfaces := False;
+ end if;
- Source := Src_Data.Next_In_Project;
+ Source := Src_Data.Next_In_Project;
+ end;
end loop;
end if;
end if;
procedure Check_Library (Proj : Project_Id; Extends : Boolean) is
Proj_Data : Project_Data;
Src_Id : Source_Id;
- Src : Source_Data_Access;
begin
if Proj /= No_Project then
Src_Id := Proj_Data.First_Source;
while Src_Id /= No_Source loop
- Src := In_Tree.Sources.Table (Src_Id)'Unrestricted_Access;
-
- exit when Src.Lang_Kind /= File_Based
- or else Src.Kind /= Spec;
+ declare
+ Src : Source_Data renames
+ In_Tree.Sources.Table (Src_Id);
+ begin
+ exit when Src.Lang_Kind /= File_Based
+ or else Src.Kind /= Spec;
- Src_Id := Src.Next_In_Project;
+ Src_Id := Src.Next_In_Project;
+ end;
end loop;
if Src_Id /= No_Source then
is
Mains : constant Variable_Value :=
Prj.Util.Value_Of (Name_Main, Data.Decl.Attributes, In_Tree);
+ List : String_List_Id;
+ Elem : String_Element;
begin
Data.Mains := Mains.Values;
(Project, In_Tree,
"a library project file cannot have Main specified",
Mains.Location);
+
+ else
+ List := Mains.Values;
+ while List /= Nil_String loop
+ Elem := In_Tree.String_Elements.Table (List);
+
+ if Length_Of_Name (Elem.Value) = 0 then
+ Error_Msg
+ (Project, In_Tree,
+ "?a main cannot have an empty name",
+ Elem.Location);
+ exit;
+ end if;
+
+ List := Elem.Next;
+ end loop;
end if;
end Get_Mains;
declare
Source : Source_Id;
- Src_Data : Source_Data_Access;
begin
Source := Data.First_Source;
while Source /= No_Source loop
- Src_Data := In_Tree.Sources.Table (Source)'Unrestricted_Access;
+ declare
+ Src_Data : Source_Data renames
+ In_Tree.Sources.Table (Source);
+ begin
- if Src_Data.Naming_Exception
- and then Src_Data.Path = No_Path_Information
- then
- if Src_Data.Unit /= No_Name then
- Error_Msg_Name_1 := Name_Id (Src_Data.Display_File);
- Error_Msg_Name_2 := Name_Id (Src_Data.Unit);
- Error_Msg
- (Project, In_Tree,
- "source file %% for unit %% not found",
- No_Location);
- end if;
+ if Src_Data.Naming_Exception
+ and then Src_Data.Path = No_Path_Information
+ then
+ if Src_Data.Unit /= No_Name then
+ Error_Msg_Name_1 := Name_Id (Src_Data.Display_File);
+ Error_Msg_Name_2 := Name_Id (Src_Data.Unit);
+ Error_Msg
+ (Project, In_Tree,
+ "source file %% for unit %% not found",
+ No_Location);
+ end if;
- Remove_Source (Source, No_Source, Project, Data, In_Tree);
- end if;
+ Remove_Source (Source, No_Source, Project, Data, In_Tree);
+ end if;
- Source := Src_Data.Next_In_Project;
+ Source := Src_Data.Next_In_Project;
+ end;
end loop;
end;
Add_Src := True;
while Source /= No_Source loop
declare
- Src_Data : constant Source_Data_Access :=
- In_Tree.Sources.Table (Source)'Unrestricted_Access;
- begin
+ Src_Data : Source_Data renames
+ In_Tree.Sources.Table (Source);
+ begin
if Unit /= No_Name
and then Src_Data.Unit = Unit
and then
and then Src_Data.Unit = Unit
and then
(Src_Data.Kind = Kind
- or else
- (Src_Data.Kind = Sep and then Kind = Impl)
- or else
- (Src_Data.Kind = Impl and then Kind = Sep)))
+ or else
+ (Src_Data.Kind = Sep and then Kind = Impl)
+ or else
+ (Src_Data.Kind = Impl and then Kind = Sep)))
or else
(Unit = No_Name and then Src_Data.File = File_Name)
then
procedure Process_Sources_In_Multi_Language_Mode is
Source : Source_Id;
- Src_Data : Source_Data_Access;
Name_Loc : Name_Location;
OK : Boolean;
FF : File_Found;
Source := Data.First_Source;
while Source /= No_Source loop
- Src_Data := In_Tree.Sources.Table (Source)'Unrestricted_Access;
+ declare
+ Src_Data : Source_Data renames
+ In_Tree.Sources.Table (Source);
- -- A file that is excluded cannot also be an exception file name
+ begin
+ -- A file that is excluded cannot also be an exception file
+ -- name
- if Excluded_Sources_Htable.Get (Src_Data.File) /=
- No_File_Found
- then
- Error_Msg_File_1 := Src_Data.File;
- Error_Msg
- (Project, In_Tree,
- "{ cannot be both excluded and an exception file name",
- No_Location);
- end if;
+ if Excluded_Sources_Htable.Get (Src_Data.File) /=
+ No_File_Found
+ then
+ Error_Msg_File_1 := Src_Data.File;
+ Error_Msg
+ (Project, In_Tree,
+ "{ cannot be both excluded and an exception file name",
+ No_Location);
+ end if;
- Name_Loc := (Name => Src_Data.File,
- Location => No_Location,
- Source => Source,
- Except => Src_Data.Unit /= No_Name,
- Found => False);
+ Name_Loc := (Name => Src_Data.File,
+ Location => No_Location,
+ Source => Source,
+ Except => Src_Data.Unit /= No_Name,
+ Found => False);
- if Current_Verbosity = High then
- Write_Str ("Putting source #");
- Write_Str (Source'Img);
- Write_Str (", file ");
- Write_Str (Get_Name_String (Src_Data.File));
- Write_Line (" in Source_Names");
- end if;
+ if Current_Verbosity = High then
+ Write_Str ("Putting source #");
+ Write_Str (Source'Img);
+ Write_Str (", file ");
+ Write_Str (Get_Name_String (Src_Data.File));
+ Write_Line (" in Source_Names");
+ end if;
- Source_Names.Set (K => Src_Data.File, E => Name_Loc);
+ Source_Names.Set (K => Src_Data.File, E => Name_Loc);
- -- If this is an Ada exception, record it in table Unit_Exceptions
+ -- If this is an Ada exception, record it in table
+ -- Unit_Exceptions
- if Src_Data.Unit /= No_Name then
- declare
- Unit_Except : Unit_Exception :=
- Unit_Exceptions.Get (Src_Data.Unit);
+ if Src_Data.Unit /= No_Name then
+ declare
+ Unit_Except : Unit_Exception :=
+ Unit_Exceptions.Get (Src_Data.Unit);
- begin
- Unit_Except.Name := Src_Data.Unit;
+ begin
+ Unit_Except.Name := Src_Data.Unit;
- if Src_Data.Kind = Spec then
- Unit_Except.Spec := Src_Data.File;
- else
- Unit_Except.Impl := Src_Data.File;
- end if;
+ if Src_Data.Kind = Spec then
+ Unit_Except.Spec := Src_Data.File;
+ else
+ Unit_Except.Impl := Src_Data.File;
+ end if;
- Unit_Exceptions.Set (Src_Data.Unit, Unit_Except);
- end;
- end if;
+ Unit_Exceptions.Set (Src_Data.Unit, Unit_Except);
+ end;
+ end if;
- Source := Src_Data.Next_In_Project;
+ Source := Src_Data.Next_In_Project;
+ end;
end loop;
Find_Explicit_Sources
Source := In_Tree.First_Source;
while Source /= No_Source loop
- Src_Data := In_Tree.Sources.Table (Source)'Unrestricted_Access;
+ declare
+ Src_Data : Source_Data renames
+ In_Tree.Sources.Table (Source);
- if Src_Data.File = FF.File then
+ begin
+ if Src_Data.File = FF.File then
- -- Check that this is from this project or a project that
- -- the current project extends.
+ -- Check that this is from this project or a project that
+ -- the current project extends.
- if Src_Data.Project = Project or else
- Is_Extending (Project, Src_Data.Project, In_Tree)
- then
- Src_Data.Locally_Removed := True;
- Src_Data.In_Interfaces := False;
- Add_Forbidden_File_Name (FF.File);
- OK := True;
- exit;
+ if Src_Data.Project = Project or else
+ Is_Extending (Project, Src_Data.Project, In_Tree)
+ then
+ Src_Data.Locally_Removed := True;
+ Src_Data.In_Interfaces := False;
+ Add_Forbidden_File_Name (FF.File);
+ OK := True;
+ exit;
+ end if;
end if;
- end if;
- Source := Src_Data.Next_In_Sources;
+ Source := Src_Data.Next_In_Sources;
+ end;
end loop;
if not FF.Found and not OK then
Check_Object_File_Names : declare
Src_Id : Source_Id;
- Src_Data : Source_Data_Access;
Source_Name : File_Name_Type;
- procedure Check_Object;
+ procedure Check_Object (Src_Data : Source_Data);
-- Check if object file name of the current source is already in
-- hash table Object_File_Names. If it is, report an error. If it
-- is not, put it there with the file name of the current source.
-- Check_Object --
------------------
- procedure Check_Object is
+ procedure Check_Object (Src_Data : Source_Data) is
begin
Source_Name := Object_File_Names.Get (Src_Data.Object);
Object_File_Names.Reset;
Src_Id := In_Tree.First_Source;
while Src_Id /= No_Source loop
- Src_Data := In_Tree.Sources.Table (Src_Id)'Unrestricted_Access;
+ declare
+ Src_Data : Source_Data renames
+ In_Tree.Sources.Table (Src_Id);
- if Src_Data.Compiled and then Src_Data.Object_Exists
- and then Project_Extends (Project, Src_Data.Project, In_Tree)
- then
- if Src_Data.Unit = No_Name then
- if Src_Data.Kind = Impl then
- Check_Object;
- end if;
+ begin
+ if Src_Data.Compiled and then Src_Data.Object_Exists
+ and then Project_Extends
+ (Project, Src_Data.Project, In_Tree)
+ then
+ if Src_Data.Unit = No_Name then
+ if Src_Data.Kind = Impl then
+ Check_Object (Src_Data);
+ end if;
- else
- case Src_Data.Kind is
- when Spec =>
- if Src_Data.Other_Part = No_Source then
- Check_Object;
- end if;
+ else
+ case Src_Data.Kind is
+ when Spec =>
+ if Src_Data.Other_Part = No_Source then
+ Check_Object (Src_Data);
+ end if;
- when Sep =>
- null;
+ when Sep =>
+ null;
- when Impl =>
- if Src_Data.Other_Part /= No_Source then
- Check_Object;
+ when Impl =>
+ if Src_Data.Other_Part /= No_Source then
+ Check_Object (Src_Data);
- else
- -- Check if it is a subunit
-
- declare
- Src_Ind : constant Source_File_Index :=
- Sinput.P.Load_Project_File
- (Get_Name_String
- (Src_Data.Path.Name));
-
- begin
- if Sinput.P.Source_File_Is_Subunit
- (Src_Ind)
- then
- In_Tree.Sources.Table (Src_Id).Kind := Sep;
- else
- Check_Object;
- end if;
- end;
- end if;
- end case;
+ else
+ -- Check if it is a subunit
+
+ declare
+ Src_Ind : constant Source_File_Index :=
+ Sinput.P.Load_Project_File
+ (Get_Name_String
+ (Src_Data.Path.Name));
+
+ begin
+ if Sinput.P.Source_File_Is_Subunit
+ (Src_Ind)
+ then
+ In_Tree.Sources.Table (Src_Id).Kind :=
+ Sep;
+ else
+ Check_Object (Src_Data);
+ end if;
+ end;
+ end if;
+ end case;
+ end if;
end if;
- end if;
- Src_Id := Src_Data.Next_In_Sources;
+ Src_Id := Src_Data.Next_In_Sources;
+ end;
end loop;
end Check_Object_File_Names;
end Process_Sources_In_Multi_Language_Mode;