diff options
author | Arnaud Charlet <charlet@gcc.gnu.org> | 2017-04-27 15:53:26 +0200 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2017-04-27 15:53:26 +0200 |
commit | 8ab31c0c31ecf1fa368974dc98196955cb2c25cd (patch) | |
tree | 63f7052ed1045975db29cac73a1b1a68e9f50ef0 /gcc/ada/lib-load.adb | |
parent | a2168462958f03ca5b060ad49e217a3e262750d0 (diff) | |
download | gcc-8ab31c0c31ecf1fa368974dc98196955cb2c25cd.zip gcc-8ab31c0c31ecf1fa368974dc98196955cb2c25cd.tar.gz gcc-8ab31c0c31ecf1fa368974dc98196955cb2c25cd.tar.bz2 |
[multiple changes]
2017-04-27 Eric Botcazou <ebotcazou@adacore.com>
* fe.h (Warn_On_Questionable_Layout): Declare.
* warnsw.ads (Warn_On_Record_Holes): Move down.
(Warn_On_Questionable_Layout): New boolean variable.
(Warning_Record): Add Warn_On_Questionable_Layout field.
* warnsw.adb (All_Warnings): Set Warn_On_Questionable_Layout.
(Restore_Warnings): Likewise.
(Save_Warnings): Likewise.
(Set_Dot_Warning_Switch): Handle 'q' and 'Q' letters.
* gcc-interface/decl.c (gnat_to_gnu_entity): Adjust call to
components_to_record.
(gnu_field_to_gnat): New function.
(warn_on_field_placement): Likewise.
(components_to_record): Add GNAT_RECORD_TYPE and remove REORDER
parameters. Rename local variables and adjust recursive call.
Rework final scan of the field list and implement warnings on the
problematic placement of specific sorts of fields.
2017-04-27 Bob Duff <duff@adacore.com>
* errout.adb, exp_aggr.adb, exp_attr.adb, exp_code.adb, fname.adb,
* fname.ads, freeze.adb, inline.adb, lib.adb, lib.ads, lib-list.adb,
* lib-load.adb, lib-writ.adb, par.adb, restrict.adb, rtsfind.adb,
* sem.adb, sem_cat.adb, sem_ch10.adb, sem_ch12.adb, sem_ch3.adb,
* sem_ch4.adb, sem_ch6.adb, sem_ch8.adb, sem_ch9.adb, sem_elab.adb,
* sem_intr.adb, sem_res.adb, sem_util.adb, sem_warn.adb, sprint.adb:
For efficiency, cache results of Is_Internal_File_Name and
Is_Predefined_File_Name in the Units table. This avoids a lot
of repeated text processing.
2017-04-27 Emmanuel Briot <briot@adacore.com>
* g-comlin.adb (Sort_Sections): remove useless test.
2017-04-27 Claire Dross <dross@adacore.com>
* a-cfhase.adb, a-cfhase.ads (=): Generic parameter removed to
allow the use of regular equality over elements in contracts.
(Formal_Model): Ghost package containing model functions that are
used in subprogram contracts.
(Current_To_Last): Removed, model functions should be used instead.
(First_To_Previous): Removed, model functions should be used instead.
(Strict_Equal): Removed, model functions should be used instead.
(No_Overlap): Removed, model functions should be used instead.
(Equivalent_Keys): Functions over cursors are removed. They were
awkward with explicit container parameters.
* a-cforse.adb, a-cforse.ads (=): Generic parameter removed to
allow the use of regular equality over elements in contracts.
(Formal_Model): Ghost package containing model functions that
are used in subprogram contracts.
(Current_To_Last): Removed, model functions should be used instead.
(First_To_Previous): Removed, model functions should be used instead.
(Strict_Equal): Removed, model functions should be used instead.
(No_Overlap): Removed, model functions should be used instead.
2017-04-27 Yannick Moy <moy@adacore.com>
* gnat1drv.adb: Code cleanup.
2017-04-27 Ed Schonberg <schonberg@adacore.com>
* exp_util.adb (Replace_Entity): The prefix of a 'Result
attribute reference in a post- condition is the subprogram to
which the condition applies. If the condition is inherited
by a type extension, the prefix becomes a reference to the
inherited operation, but there is no need to create a wrapper
for this operation, because 'Result is expanded independently
when elaborating the postconditions.
From-SVN: r247338
Diffstat (limited to 'gcc/ada/lib-load.adb')
-rw-r--r-- | gcc/ada/lib-load.adb | 186 |
1 files changed, 112 insertions, 74 deletions
diff --git a/gcc/ada/lib-load.adb b/gcc/ada/lib-load.adb index dc8deb5..e05bde1 100644 --- a/gcc/ada/lib-load.adb +++ b/gcc/ada/lib-load.adb @@ -145,7 +145,15 @@ package body Lib.Load is Cunit : Node_Id; Du_Name : Node_Or_Entity_Id; End_Lab : Node_Id; - Save_CS : constant Boolean := Get_Comes_From_Source_Default; + Fname : constant File_Name_Type := + Get_File_Name (Spec_Name, Subunit => False); + Pre_Name : constant Boolean := + Is_Predefined_File_Name (Fname, Renamings_Included => False); + Ren_Name : constant Boolean := + Is_Predefined_Renaming_File_Name (Fname); + GNAT_Name : constant Boolean := + Is_GNAT_File_Name (Fname); + Save_CS : constant Boolean := Get_Comes_From_Source_Default; begin -- The created dummy package unit does not come from source @@ -205,29 +213,35 @@ package body Lib.Load is Units.Increment_Last; Unum := Units.Last; - Units.Table (Unum) := ( - Cunit => Cunit, - Cunit_Entity => Cunit_Entity, - Dependency_Num => 0, - Dynamic_Elab => False, - Error_Location => Sloc (With_Node), - Expected_Unit => Spec_Name, - Fatal_Error => Error_Detected, - Generate_Code => False, - Has_RACW => False, - Filler => False, - Ident_String => Empty, - Loading => False, - Main_Priority => Default_Main_Priority, - Main_CPU => Default_Main_CPU, - Munit_Index => 0, - No_Elab_Code_All => False, - Serial_Number => 0, - Source_Index => No_Source_File, - Unit_File_Name => Get_File_Name (Spec_Name, Subunit => False), - Unit_Name => Spec_Name, - Version => 0, - OA_Setting => 'O'); + Units.Table (Unum) := + (Cunit => Cunit, + Cunit_Entity => Cunit_Entity, + Dependency_Num => 0, + Dynamic_Elab => False, + Error_Location => Sloc (With_Node), + Expected_Unit => Spec_Name, + Fatal_Error => Error_Detected, + Generate_Code => False, + Has_RACW => False, + Filler => False, + Ident_String => Empty, + + Is_Predefined_Renaming => Ren_Name, + Is_Predefined_Unit => Pre_Name or Ren_Name, + Is_Internal_Unit => Pre_Name or Ren_Name or GNAT_Name, + Filler2 => False, + + Loading => False, + Main_Priority => Default_Main_Priority, + Main_CPU => Default_Main_CPU, + Munit_Index => 0, + No_Elab_Code_All => False, + Serial_Number => 0, + Source_Index => No_Source_File, + Unit_File_Name => Fname, + Unit_Name => Spec_Name, + Version => 0, + OA_Setting => 'O'); Set_Comes_From_Source_Default (Save_CS); Set_Error_Posted (Cunit_Entity); @@ -285,7 +299,13 @@ package body Lib.Load is ---------------------- procedure Load_Main_Source is - Fname : File_Name_Type; + Fname : constant File_Name_Type := Next_Main_Source; + Pre_Name : constant Boolean := + Is_Predefined_File_Name (Fname, Renamings_Included => False); + Ren_Name : constant Boolean := + Is_Predefined_Renaming_File_Name (Fname); + GNAT_Name : constant Boolean := + Is_GNAT_File_Name (Fname); Version : Word := 0; begin @@ -299,7 +319,6 @@ package body Lib.Load is -- Cunit_Entity fields also get filled in later by the parser. Units.Increment_Last; - Fname := Next_Main_Source; Units.Table (Main_Unit).Unit_File_Name := Fname; @@ -311,29 +330,35 @@ package body Lib.Load is Version := Source_Checksum (Main_Source_File); end if; - Units.Table (Main_Unit) := ( - Cunit => Empty, - Cunit_Entity => Empty, - Dependency_Num => 0, - Dynamic_Elab => False, - Error_Location => No_Location, - Expected_Unit => No_Unit_Name, - Fatal_Error => None, - Generate_Code => False, - Has_RACW => False, - Filler => False, - Ident_String => Empty, - Loading => True, - Main_Priority => Default_Main_Priority, - Main_CPU => Default_Main_CPU, - Munit_Index => 0, - No_Elab_Code_All => False, - Serial_Number => 0, - Source_Index => Main_Source_File, - Unit_File_Name => Fname, - Unit_Name => No_Unit_Name, - Version => Version, - OA_Setting => 'O'); + Units.Table (Main_Unit) := + (Cunit => Empty, + Cunit_Entity => Empty, + Dependency_Num => 0, + Dynamic_Elab => False, + Error_Location => No_Location, + Expected_Unit => No_Unit_Name, + Fatal_Error => None, + Generate_Code => False, + Has_RACW => False, + Filler => False, + Ident_String => Empty, + + Is_Predefined_Renaming => Ren_Name, + Is_Predefined_Unit => Pre_Name or Ren_Name, + Is_Internal_Unit => Pre_Name or Ren_Name or GNAT_Name, + Filler2 => False, + + Loading => True, + Main_Priority => Default_Main_Priority, + Main_CPU => Default_Main_CPU, + Munit_Index => 0, + No_Elab_Code_All => False, + Serial_Number => 0, + Source_Index => Main_Source_File, + Unit_File_Name => Fname, + Unit_Name => No_Unit_Name, + Version => Version, + OA_Setting => 'O'); end if; end Load_Main_Source; @@ -356,6 +381,9 @@ package body Lib.Load is Unum : Unit_Number_Type; Unump : Unit_Number_Type; Fname : File_Name_Type; + Pre_Name : Boolean; + Ren_Name : Boolean; + GNAT_Name : Boolean; Src_Ind : Source_File_Index; Save_PMES : constant Boolean := Parsing_Main_Extended_Source; @@ -467,7 +495,11 @@ package body Lib.Load is Uname_Actual := Load_Name; end if; - Fname := Get_File_Name (Uname_Actual, Subunit); + Fname := Get_File_Name (Uname_Actual, Subunit); + Pre_Name := + Is_Predefined_File_Name (Fname, Renamings_Included => False); + Ren_Name := Is_Predefined_Renaming_File_Name (Fname); + GNAT_Name := Is_GNAT_File_Name (Fname); if Debug_Flag_L then Write_Eol; @@ -676,29 +708,35 @@ package body Lib.Load is -- File was found if Src_Ind /= No_Source_File then - Units.Table (Unum) := ( - Cunit => Empty, - Cunit_Entity => Empty, - Dependency_Num => 0, - Dynamic_Elab => False, - Error_Location => Sloc (Error_Node), - Expected_Unit => Uname_Actual, - Fatal_Error => None, - Generate_Code => False, - Has_RACW => False, - Filler => False, - Ident_String => Empty, - Loading => True, - Main_Priority => Default_Main_Priority, - Main_CPU => Default_Main_CPU, - Munit_Index => 0, - No_Elab_Code_All => False, - Serial_Number => 0, - Source_Index => Src_Ind, - Unit_File_Name => Fname, - Unit_Name => Uname_Actual, - Version => Source_Checksum (Src_Ind), - OA_Setting => 'O'); + Units.Table (Unum) := + (Cunit => Empty, + Cunit_Entity => Empty, + Dependency_Num => 0, + Dynamic_Elab => False, + Error_Location => Sloc (Error_Node), + Expected_Unit => Uname_Actual, + Fatal_Error => None, + Generate_Code => False, + Has_RACW => False, + Filler => False, + Ident_String => Empty, + + Is_Predefined_Renaming => Ren_Name, + Is_Predefined_Unit => Pre_Name or Ren_Name, + Is_Internal_Unit => Pre_Name or Ren_Name or GNAT_Name, + Filler2 => False, + + Loading => True, + Main_Priority => Default_Main_Priority, + Main_CPU => Default_Main_CPU, + Munit_Index => 0, + No_Elab_Code_All => False, + Serial_Number => 0, + Source_Index => Src_Ind, + Unit_File_Name => Fname, + Unit_Name => Uname_Actual, + Version => Source_Checksum (Src_Ind), + OA_Setting => 'O'); -- Parse the new unit @@ -880,7 +918,7 @@ package body Lib.Load is -- code will have to be generated for it. procedure Make_Instance_Unit (N : Node_Id; In_Main : Boolean) is - Sind : constant Source_File_Index := Source_Index (Main_Unit); + Sind : constant Source_File_Index := Source_Index (Main_Unit); begin Units.Increment_Last; |