-- Find_Excluded_Sources below.
procedure Find_Excluded_Sources
- (In_Tree : Project_Tree_Ref;
+ (Project : Project_Id;
+ In_Tree : Project_Tree_Ref;
Data : Project_Data);
-- Find the list of files that should not be considered as source files
-- for this project. Sets the list in the Excluded_Sources_Htable.
---------------------------
procedure Find_Excluded_Sources
- (In_Tree : Project_Tree_Ref;
+ (Project : Project_Id;
+ In_Tree : Project_Tree_Ref;
Data : Project_Data)
is
Excluded_Sources : Variable_Value;
- Current : String_List_Id;
- Element : String_Element;
+
+ Excluded_Source_List_File : Variable_Value;
+
+ Current : String_List_Id;
+
+ Element : String_Element;
+
Location : Source_Ptr;
- Name : File_Name_Type;
+
+ Name : File_Name_Type;
+
+ File : Prj.Util.Text_File;
+ Line : String (1 .. 300);
+ Last : Natural;
+
+ Locally_Removed : Boolean := False;
begin
- -- If Excluded_Source_Files is not declared, check
- -- Locally_Removed_Files.
+ Excluded_Source_List_File :=
+ Util.Value_Of
+ (Name_Excluded_Source_List_File, Data.Decl.Attributes, In_Tree);
Excluded_Sources :=
Util.Value_Of
(Name_Excluded_Source_Files, Data.Decl.Attributes, In_Tree);
+ -- If Excluded_Source_Files is not declared, check
+ -- Locally_Removed_Files.
+
if Excluded_Sources.Default then
+ Locally_Removed := True;
Excluded_Sources :=
Util.Value_Of
(Name_Locally_Removed_Files, Data.Decl.Attributes, In_Tree);
-- If there are excluded sources, put them in the table
if not Excluded_Sources.Default then
+ if not Excluded_Source_List_File.Default then
+ if Locally_Removed then
+ Error_Msg
+ (Project, In_Tree,
+ "?both attributes Locally_Removed_Files and " &
+ "Excluded_Source_List_File are present",
+ Excluded_Source_List_File.Location);
+ else
+ Error_Msg
+ (Project, In_Tree,
+ "?both attributes Excluded_Source_Files and " &
+ "Excluded_Source_List_File are present",
+ Excluded_Source_List_File.Location);
+ end if;
+ end if;
+
Current := Excluded_Sources.Values;
while Current /= Nil_String loop
Element := In_Tree.String_Elements.Table (Current);
Excluded_Sources_Htable.Set (Name, (Name, False, Location));
Current := Element.Next;
end loop;
+
+ elsif not Excluded_Source_List_File.Default then
+ Location := Excluded_Source_List_File.Location;
+
+ declare
+ Source_File_Path_Name : constant String :=
+ Path_Name_Of
+ (File_Name_Type
+ (Excluded_Source_List_File.Value),
+ Data.Directory);
+
+ begin
+ if Source_File_Path_Name'Length = 0 then
+ Err_Vars.Error_Msg_File_1 :=
+ File_Name_Type (Excluded_Source_List_File.Value);
+ Error_Msg
+ (Project, In_Tree,
+ "file with excluded sources { does not exist",
+ Excluded_Source_List_File.Location);
+
+ else
+ -- Open the file
+
+ Prj.Util.Open (File, Source_File_Path_Name);
+
+ if not Prj.Util.Is_Valid (File) then
+ Error_Msg
+ (Project, In_Tree, "file does not exist", Location);
+ else
+ -- Read the lines one by one
+
+ while not Prj.Util.End_Of_File (File) loop
+ Prj.Util.Get_Line (File, Line, Last);
+
+ -- A non empty, non comment line should contain a file
+ -- name
+
+ if Last /= 0
+ and then (Last = 1 or else Line (1 .. 2) /= "--")
+ then
+ Name_Len := Last;
+ Name_Buffer (1 .. Name_Len) := Line (1 .. Last);
+ Canonical_Case_File_Name
+ (Name_Buffer (1 .. Name_Len));
+ Name := Name_Find;
+
+ -- Check that there is no directory information
+
+ for J in 1 .. Last loop
+ if Line (J) = '/'
+ or else Line (J) = Directory_Separator
+ then
+ Error_Msg_File_1 := Name;
+ Error_Msg
+ (Project,
+ In_Tree,
+ "file name cannot include " &
+ "directory information ({)",
+ Location);
+ exit;
+ end if;
+ end loop;
+
+ Excluded_Sources_Htable.Set
+ (Name, (Name, False, Location));
+ end if;
+ end loop;
+
+ Prj.Util.Close (File);
+ end if;
+ end if;
+ end;
end if;
end Find_Excluded_Sources;
if not Source_List_File.Default then
Error_Msg
(Project, In_Tree,
- "?both variables source_files and " &
+ "?both attributes source_files and " &
"source_list_file are present",
Source_List_File.Location);
end if;
begin
Source_Names.Reset;
- Find_Excluded_Sources (In_Tree, Data);
+ Find_Excluded_Sources (Project, In_Tree, Data);
case Get_Mode is
when Ada_Only =>
Name_Driver : constant Name_Id := N + 658;
Name_Excluded_Source_Dirs : constant Name_Id := N + 659;
Name_Excluded_Source_Files : constant Name_Id := N + 660;
- Name_Exec_Dir : constant Name_Id := N + 661;
- Name_Executable : constant Name_Id := N + 662;
- Name_Executable_Suffix : constant Name_Id := N + 663;
- Name_Extends : constant Name_Id := N + 664;
- Name_Externally_Built : constant Name_Id := N + 665;
- Name_Finder : constant Name_Id := N + 666;
- Name_Global_Configuration_Pragmas : constant Name_Id := N + 667;
- Name_Global_Config_File : constant Name_Id := N + 668;
- Name_Gnatls : constant Name_Id := N + 669;
- Name_Gnatstub : constant Name_Id := N + 670;
- Name_Implementation : constant Name_Id := N + 671;
- Name_Implementation_Exceptions : constant Name_Id := N + 672;
- Name_Implementation_Suffix : constant Name_Id := N + 673;
- Name_Include_Switches : constant Name_Id := N + 674;
- Name_Include_Path : constant Name_Id := N + 675;
- Name_Include_Path_File : constant Name_Id := N + 676;
- Name_Inherit_Source_Path : constant Name_Id := N + 677;
- Name_Language_Kind : constant Name_Id := N + 678;
- Name_Language_Processing : constant Name_Id := N + 679;
- Name_Languages : constant Name_Id := N + 680;
- Name_Library : constant Name_Id := N + 681;
- Name_Library_Ali_Dir : constant Name_Id := N + 682;
- Name_Library_Auto_Init : constant Name_Id := N + 683;
- Name_Library_Auto_Init_Supported : constant Name_Id := N + 684;
- Name_Library_Builder : constant Name_Id := N + 685;
- Name_Library_Dir : constant Name_Id := N + 686;
- Name_Library_GCC : constant Name_Id := N + 687;
- Name_Library_Interface : constant Name_Id := N + 688;
- Name_Library_Kind : constant Name_Id := N + 689;
- Name_Library_Name : constant Name_Id := N + 690;
- Name_Library_Major_Minor_Id_Supported : constant Name_Id := N + 691;
- Name_Library_Options : constant Name_Id := N + 692;
- Name_Library_Partial_Linker : constant Name_Id := N + 693;
- Name_Library_Reference_Symbol_File : constant Name_Id := N + 694;
- Name_Library_Src_Dir : constant Name_Id := N + 695;
- Name_Library_Support : constant Name_Id := N + 696;
- Name_Library_Symbol_File : constant Name_Id := N + 697;
- Name_Library_Symbol_Policy : constant Name_Id := N + 698;
- Name_Library_Version : constant Name_Id := N + 699;
- Name_Library_Version_Switches : constant Name_Id := N + 700;
- Name_Linker : constant Name_Id := N + 701;
- Name_Linker_Executable_Option : constant Name_Id := N + 702;
- Name_Linker_Lib_Dir_Option : constant Name_Id := N + 703;
- Name_Linker_Lib_Name_Option : constant Name_Id := N + 704;
- Name_Local_Config_File : constant Name_Id := N + 705;
- Name_Local_Configuration_Pragmas : constant Name_Id := N + 706;
- Name_Locally_Removed_Files : constant Name_Id := N + 707;
- Name_Mapping_File_Switches : constant Name_Id := N + 708;
- Name_Mapping_Spec_Suffix : constant Name_Id := N + 709;
- Name_Mapping_Body_Suffix : constant Name_Id := N + 710;
- Name_Metrics : constant Name_Id := N + 711;
- Name_Naming : constant Name_Id := N + 712;
- Name_Object_Generated : constant Name_Id := N + 713;
- Name_Objects_Linked : constant Name_Id := N + 714;
- Name_Objects_Path : constant Name_Id := N + 715;
- Name_Objects_Path_File : constant Name_Id := N + 716;
- Name_Object_Dir : constant Name_Id := N + 717;
- Name_Pic_Option : constant Name_Id := N + 718;
- Name_Pretty_Printer : constant Name_Id := N + 719;
- Name_Prefix : constant Name_Id := N + 720;
- Name_Project : constant Name_Id := N + 721;
- Name_Roots : constant Name_Id := N + 722;
- Name_Required_Switches : constant Name_Id := N + 723;
- Name_Run_Path_Option : constant Name_Id := N + 724;
- Name_Runtime_Project : constant Name_Id := N + 725;
- Name_Shared_Library_Minimum_Switches : constant Name_Id := N + 726;
- Name_Shared_Library_Prefix : constant Name_Id := N + 727;
- Name_Shared_Library_Suffix : constant Name_Id := N + 728;
- Name_Separate_Suffix : constant Name_Id := N + 729;
- Name_Source_Dirs : constant Name_Id := N + 730;
- Name_Source_Files : constant Name_Id := N + 731;
- Name_Source_List_File : constant Name_Id := N + 732;
- Name_Spec : constant Name_Id := N + 733;
- Name_Spec_Suffix : constant Name_Id := N + 734;
- Name_Specification : constant Name_Id := N + 735;
- Name_Specification_Exceptions : constant Name_Id := N + 736;
- Name_Specification_Suffix : constant Name_Id := N + 737;
- Name_Stack : constant Name_Id := N + 738;
- Name_Switches : constant Name_Id := N + 739;
- Name_Symbolic_Link_Supported : constant Name_Id := N + 740;
- Name_Sync : constant Name_Id := N + 741;
- Name_Synchronize : constant Name_Id := N + 742;
- Name_Toolchain_Description : constant Name_Id := N + 743;
- Name_Toolchain_Version : constant Name_Id := N + 744;
- Name_Runtime_Library_Dir : constant Name_Id := N + 745;
+ Name_Excluded_Source_List_File : constant Name_Id := N + 661;
+ Name_Exec_Dir : constant Name_Id := N + 662;
+ Name_Executable : constant Name_Id := N + 663;
+ Name_Executable_Suffix : constant Name_Id := N + 664;
+ Name_Extends : constant Name_Id := N + 665;
+ Name_Externally_Built : constant Name_Id := N + 666;
+ Name_Finder : constant Name_Id := N + 667;
+ Name_Global_Configuration_Pragmas : constant Name_Id := N + 668;
+ Name_Global_Config_File : constant Name_Id := N + 669;
+ Name_Gnatls : constant Name_Id := N + 670;
+ Name_Gnatstub : constant Name_Id := N + 671;
+ Name_Implementation : constant Name_Id := N + 672;
+ Name_Implementation_Exceptions : constant Name_Id := N + 673;
+ Name_Implementation_Suffix : constant Name_Id := N + 674;
+ Name_Include_Switches : constant Name_Id := N + 675;
+ Name_Include_Path : constant Name_Id := N + 676;
+ Name_Include_Path_File : constant Name_Id := N + 677;
+ Name_Inherit_Source_Path : constant Name_Id := N + 678;
+ Name_Language_Kind : constant Name_Id := N + 679;
+ Name_Language_Processing : constant Name_Id := N + 680;
+ Name_Languages : constant Name_Id := N + 681;
+ Name_Library : constant Name_Id := N + 682;
+ Name_Library_Ali_Dir : constant Name_Id := N + 683;
+ Name_Library_Auto_Init : constant Name_Id := N + 684;
+ Name_Library_Auto_Init_Supported : constant Name_Id := N + 685;
+ Name_Library_Builder : constant Name_Id := N + 686;
+ Name_Library_Dir : constant Name_Id := N + 687;
+ Name_Library_GCC : constant Name_Id := N + 688;
+ Name_Library_Interface : constant Name_Id := N + 689;
+ Name_Library_Kind : constant Name_Id := N + 690;
+ Name_Library_Name : constant Name_Id := N + 691;
+ Name_Library_Major_Minor_Id_Supported : constant Name_Id := N + 692;
+ Name_Library_Options : constant Name_Id := N + 693;
+ Name_Library_Partial_Linker : constant Name_Id := N + 694;
+ Name_Library_Reference_Symbol_File : constant Name_Id := N + 695;
+ Name_Library_Src_Dir : constant Name_Id := N + 696;
+ Name_Library_Support : constant Name_Id := N + 697;
+ Name_Library_Symbol_File : constant Name_Id := N + 698;
+ Name_Library_Symbol_Policy : constant Name_Id := N + 699;
+ Name_Library_Version : constant Name_Id := N + 700;
+ Name_Library_Version_Switches : constant Name_Id := N + 701;
+ Name_Linker : constant Name_Id := N + 702;
+ Name_Linker_Executable_Option : constant Name_Id := N + 703;
+ Name_Linker_Lib_Dir_Option : constant Name_Id := N + 704;
+ Name_Linker_Lib_Name_Option : constant Name_Id := N + 705;
+ Name_Local_Config_File : constant Name_Id := N + 706;
+ Name_Local_Configuration_Pragmas : constant Name_Id := N + 707;
+ Name_Locally_Removed_Files : constant Name_Id := N + 708;
+ Name_Mapping_File_Switches : constant Name_Id := N + 709;
+ Name_Mapping_Spec_Suffix : constant Name_Id := N + 710;
+ Name_Mapping_Body_Suffix : constant Name_Id := N + 711;
+ Name_Metrics : constant Name_Id := N + 712;
+ Name_Naming : constant Name_Id := N + 713;
+ Name_Object_Generated : constant Name_Id := N + 714;
+ Name_Objects_Linked : constant Name_Id := N + 715;
+ Name_Objects_Path : constant Name_Id := N + 716;
+ Name_Objects_Path_File : constant Name_Id := N + 717;
+ Name_Object_Dir : constant Name_Id := N + 718;
+ Name_Pic_Option : constant Name_Id := N + 719;
+ Name_Pretty_Printer : constant Name_Id := N + 720;
+ Name_Prefix : constant Name_Id := N + 721;
+ Name_Project : constant Name_Id := N + 722;
+ Name_Roots : constant Name_Id := N + 723;
+ Name_Required_Switches : constant Name_Id := N + 724;
+ Name_Run_Path_Option : constant Name_Id := N + 725;
+ Name_Runtime_Project : constant Name_Id := N + 726;
+ Name_Shared_Library_Minimum_Switches : constant Name_Id := N + 727;
+ Name_Shared_Library_Prefix : constant Name_Id := N + 728;
+ Name_Shared_Library_Suffix : constant Name_Id := N + 729;
+ Name_Separate_Suffix : constant Name_Id := N + 730;
+ Name_Source_Dirs : constant Name_Id := N + 731;
+ Name_Source_Files : constant Name_Id := N + 732;
+ Name_Source_List_File : constant Name_Id := N + 733;
+ Name_Spec : constant Name_Id := N + 734;
+ Name_Spec_Suffix : constant Name_Id := N + 735;
+ Name_Specification : constant Name_Id := N + 736;
+ Name_Specification_Exceptions : constant Name_Id := N + 737;
+ Name_Specification_Suffix : constant Name_Id := N + 738;
+ Name_Stack : constant Name_Id := N + 739;
+ Name_Switches : constant Name_Id := N + 740;
+ Name_Symbolic_Link_Supported : constant Name_Id := N + 741;
+ Name_Sync : constant Name_Id := N + 742;
+ Name_Synchronize : constant Name_Id := N + 743;
+ Name_Toolchain_Description : constant Name_Id := N + 744;
+ Name_Toolchain_Version : constant Name_Id := N + 745;
+ Name_Runtime_Library_Dir : constant Name_Id := N + 746;
-- Other miscellaneous names used in front end
- Name_Unaligned_Valid : constant Name_Id := N + 746;
+ Name_Unaligned_Valid : constant Name_Id := N + 747;
-- Ada 2005 reserved words
- First_2005_Reserved_Word : constant Name_Id := N + 747;
- Name_Interface : constant Name_Id := N + 747;
- Name_Overriding : constant Name_Id := N + 748;
- Name_Synchronized : constant Name_Id := N + 749;
- Last_2005_Reserved_Word : constant Name_Id := N + 749;
+ First_2005_Reserved_Word : constant Name_Id := N + 748;
+ Name_Interface : constant Name_Id := N + 748;
+ Name_Overriding : constant Name_Id := N + 749;
+ Name_Synchronized : constant Name_Id := N + 750;
+ Last_2005_Reserved_Word : constant Name_Id := N + 750;
subtype Ada_2005_Reserved_Words is
Name_Id range First_2005_Reserved_Word .. Last_2005_Reserved_Word;
-- Mark last defined name for consistency check in Snames body
- Last_Predefined_Name : constant Name_Id := N + 749;
+ Last_Predefined_Name : constant Name_Id := N + 750;
---------------------------------------
-- Subtypes Defining Name Categories --