-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2006, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
--- ware Foundation; either version 2, or (at your option) any later ver- --
+-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
--- Public License distributed with GNAT; see file COPYING. If not, write --
--- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
--- Boston, MA 02110-1301, USA. --
+-- Public License distributed with GNAT; see file COPYING3. If not, go to --
+-- http://www.gnu.org/licenses for a complete copy of the license. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
with Fname.UF; use Fname.UF;
with Lib.Load; use Lib.Load;
+with Namet.Sp; use Namet.Sp;
with Uname; use Uname;
with Osint; use Osint;
with Sinput.L; use Sinput.L;
-- If we have no unit name, things are seriously messed up by previous
-- errors, and we should not try to continue compilation.
- if Unit_Name (Cur_Unum) = No_Name then
+ if Unit_Name (Cur_Unum) = No_Unit_Name then
raise Unrecoverable_Error;
end if;
or not Same_File_Name_Except_For_Case
(File_Name, Unit_File_Name (Cur_Unum)))
then
- Error_Msg_Name_1 := File_Name;
+ Error_Msg_File_1 := File_Name;
Error_Msg
("?file name does not match unit name, should be{", Sloc (Curunit));
end if;
and then Expected_Unit (Cur_Unum) /= Unit_Name (Cur_Unum)
then
Loc := Error_Location (Cur_Unum);
- Error_Msg_Name_1 := Unit_File_Name (Cur_Unum);
- Get_Name_String (Error_Msg_Name_1);
+ Error_Msg_File_1 := Unit_File_Name (Cur_Unum);
+ Get_Name_String (Error_Msg_File_1);
-- Check for predefined file case
Name_Buffer (1) = 'g')
then
declare
- Expect_Name : constant Name_Id := Expected_Unit (Cur_Unum);
- Actual_Name : constant Name_Id := Unit_Name (Cur_Unum);
+ Expect_Name : constant Unit_Name_Type := Expected_Unit (Cur_Unum);
+ Actual_Name : constant Unit_Name_Type := Unit_Name (Cur_Unum);
begin
- Error_Msg_Name_1 := Expect_Name;
- Error_Msg ("% is not a predefined library unit!", Loc);
+ Error_Msg_Unit_1 := Expect_Name;
+ Error_Msg -- CODEFIX
+ ("$$ is not a predefined library unit!", Loc);
-- In the predefined file case, we know the user did not
-- construct their own package, but we got the wrong one.
-- of misspelling of predefined unit names without needing
-- a full list of them.
- -- Before actually issinying the message, we will check that the
+ -- Before actually issuing the message, we will check that the
-- unit name is indeed a plausible misspelling of the one we got.
if Is_Bad_Spelling_Of
- (Found => Get_Name_String (Expect_Name),
- Expect => Get_Name_String (Actual_Name))
+ (Name_Id (Expect_Name), Name_Id (Actual_Name))
then
- Error_Msg_Name_1 := Actual_Name;
- Error_Msg ("possible misspelling of %!", Loc);
+ Error_Msg_Unit_1 := Actual_Name;
+ Error_Msg -- CODEFIX
+ ("possible misspelling of $$!", Loc);
end if;
end;
Required => False,
Subunit => False,
Error_Node => Curunit,
- Corr_Body => Cur_Unum);
+ Corr_Body => Cur_Unum,
+ PMES => (Cur_Unum = Main_Unit));
- -- If we successfully load the unit, then set the spec pointer. Once
- -- again note that if the loaded unit has a fatal error, Load will
+ -- If we successfully load the unit, then set the spec/body pointers.
+ -- Once again note that if the loaded unit has a fatal error, Load will
-- have set our Fatal_Error flag to propagate this condition.
if Unum /= No_Unit then
Set_Library_Unit (Curunit, Cunit (Unum));
+ Set_Library_Unit (Cunit (Unum), Curunit);
-- If this is a separate spec for the main unit, then we reset
-- Main_Unit_Entity to point to the entity for this separate spec
+ -- and this is also where we generate the SCO's for this spec.
if Cur_Unum = Main_Unit then
Main_Unit_Entity := Cunit_Entity (Unum);
+
+ if Generate_SCO then
+ SCO_Record (Unum);
+ end if;
end if;
-- If we don't find the spec, then if we have a subprogram body, we
Spec_Name := Get_Parent_Spec_Name (Unit_Name (Cur_Unum));
- if Spec_Name /= No_Name then
+ if Spec_Name /= No_Unit_Name then
Unum :=
Load_Unit
- (Load_Name => Spec_Name,
- Required => True,
- Subunit => False,
- Error_Node => Curunit,
- From_Limited_With => From_Limited_With);
+ (Load_Name => Spec_Name,
+ Required => True,
+ Subunit => False,
+ Error_Node => Curunit);
if Unum /= No_Unit then
Set_Parent_Spec (Unit (Curunit), Cunit (Unum));
Load_Unit
(Load_Name => Body_Name,
Required => True,
- Subunit => True,
+ Subunit => False,
Error_Node => Name (Unit (Curunit)));
if Unum /= No_Unit then
Unum :=
Load_Unit
- (Load_Name => Spec_Name,
- Required => False,
- Subunit => False,
- Error_Node => With_Node,
- Renamings => True,
- From_Limited_With => From_Limited_With
- or else
- Limited_Present (Context_Node));
+ (Load_Name => Spec_Name,
+ Required => False,
+ Subunit => False,
+ Error_Node => With_Node,
+ Renamings => True,
+ With_Node => Context_Node);
-- If we find the unit, then set spec pointer in the N_With_Clause
-- to point to the compilation unit for the spec. Remember that