Save_Config_Cunit_Boolean_Restrictions;
- -- If there was a -gnatem switch, initialize the mappings of unit names
- -- to file names and of file names to path names from the mapping file.
-
- if Mapping_File_Name /= null then
- Fmap.Initialize (Mapping_File_Name.all);
- end if;
-
-- Adjust Optimize_Alignment mode from debug switches if necessary
if Debug_Flag_Dot_SS then
Sem_Eval.Initialize;
Sem_Type.Init_Interp_Tables;
+ -- If there was a -gnatem switch, initialize the mappings of unit names
+ -- to file names and of file names to path names from the mapping file.
+
+ if Mapping_File_Name /= null then
+ Fmap.Initialize (Mapping_File_Name.all);
+ end if;
+
-- Capture compilation date and time
Opt.Compilation_Time := System.OS_Lib.Current_Time_String;
N : File_Name_Type;
begin
- Name_Buffer (1 .. 10) := "system.ads";
- Name_Len := 10;
- N := Name_Find;
+ N := Fmap.Mapped_File_Name (Name_To_Unit_Name (Name_System));
+
+ if N = No_File then
+ N := Name_Find ("system.ads");
+ end if;
+
S := Load_Source_File (N);
-- Failed to read system.ads, fatal error
-- which require recognition and either partial or complete processing
-- during parsing, and this unit performs this required processing.
+with Fmap;
with Fname.UF; use Fname.UF;
with Osint; use Osint;
with Rident; use Rident;
and then
Nkind (Selector_Name (Expr1)) = N_Identifier)
then
- if Nkind (Expr1) = N_Identifier
- and then Chars (Expr1) = Name_System
- then
- Error_Msg_N
- ("pragma Source_File_Name may not be used for System",
- Arg1);
- return Error;
- end if;
-
-- Process index argument if present
if Arg_Count = 3 then
Check_Arg_Is_String_Literal (Arg2);
+ if Nkind (Expr1) = N_Identifier
+ and then Chars (Expr1) = Name_System
+ then
+ -- We allow pragma Source_File_Name on System if it confirms
+ -- a mapping that already exists in Fmap. The goal is to
+ -- accommodate GPRbuild, which uses both a map file and
+ -- a pragma, while at the same time preventing users from
+ -- using just a pragma. Using just a pragma is a problem
+ -- because those are not registered yet when
+ -- Get_Target_Parameters is called.
+ if Fmap.Mapped_File_Name (Name_To_Unit_Name (Name_System))
+ /= Get_Fname (Arg2)
+ then
+ Error_Msg_N
+ ("pragma Source_File_Name may not be used for System",
+ Arg1);
+ return Error;
+ end if;
+ end if;
+
if Chars (Arg2) = Name_Spec_File_Name then
Set_File_Name
(Get_Spec_Name (Unam), Get_Fname (Arg2), Index);