diff options
-rw-r--r-- | gcc/ada/ChangeLog | 60 | ||||
-rw-r--r-- | gcc/ada/alloc.ads | 2 | ||||
-rw-r--r-- | gcc/ada/errout.adb | 5 | ||||
-rw-r--r-- | gcc/ada/erroutc.adb | 11 | ||||
-rw-r--r-- | gcc/ada/errutil.adb | 7 | ||||
-rw-r--r-- | gcc/ada/exp_ch9.adb | 4 | ||||
-rw-r--r-- | gcc/ada/exp_disp.adb | 10 | ||||
-rw-r--r-- | gcc/ada/exp_dist.adb | 12 | ||||
-rw-r--r-- | gcc/ada/exp_prag.adb | 2 | ||||
-rw-r--r-- | gcc/ada/sem_ch6.adb | 12 | ||||
-rw-r--r-- | gcc/ada/sem_ch7.adb | 6 | ||||
-rw-r--r-- | gcc/ada/sem_res.adb | 47 | ||||
-rw-r--r-- | gcc/ada/sem_util.adb | 4 | ||||
-rw-r--r-- | gcc/ada/warnsw.ads | 8 |
14 files changed, 159 insertions, 31 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 209e16e..af97683 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,63 @@ +2017-04-28 Eric Botcazou <ebotcazou@adacore.com> + + * exp_ch9.adb (Build_Lock_Free_Unprotected_Subprogram_Body): Also + initialize Block_Decls variable. + (Expand_Entry_Barrier): Add pragma Warnings on Func_Body variable. + (Build_Dispatching_Requeue): Add pragma Warnings on Op variable. + * exp_disp.adb (Expand_Interface_Actuals): Initialize + Formal_DDT and Actual_DDT variables. + (Expand_Interface_Thunk): Initialize Iface_Formal. + (Make_DT): Initialize Size_Comp. + (Make_Select_Specific_Data_Table): Initialize Decls. + * exp_dist.adb (Add_RACW_Primitive_Declarations_And_Bodies): + Also initialize more RPC_Receiver_* variables. + (Build_To_Any_Function): Initialize Cstr_Formal. + * exp_prag.adb (Expand_Pragma_Contract_Cases): Initialize Msg_Str. + +2017-04-28 Ed Schonberg <schonberg@adacore.com> + + * sem_ch6.adb (Freeze_Type_Refs): For an interface conversion + node between access types, freeze the designated type as well, + so that dispatch table pointers are created in the proper scope, + and not in the constructed body of the expression function. + +2017-04-28 Bob Duff <duff@adacore.com> + + * alloc.ads (Nodes_Initial): Go back to previous value. The large + value makes large compilations faster, but small compilations slower. + +2017-04-28 Arnaud Charlet <charlet@adacore.com> + + * sem_util.adb: minor typos in Is_Child_Or_Sibling. + +2017-04-28 Hristian Kirtchev <kirtchev@adacore.com> + + * erroutc.adb (Compilation_Errors): Do not consider info messages + as suitable warnings when warnings must be treated as errors. + * sem_ch7.adb (Analyze_Package_Specification): Do not consider + internally-generated packages when outputting completion + information. + * errout.adb (Output_Messages): Do not consider info messages as + suitable warnings when warnings must be treated as errors. + * errutil.adb (Finalize): Do not consider info messages as + suitable warnings when warnings must be treated as errors. + + +2017-04-28 Eric Botcazou <ebotcazou@adacore.com> + + * warnsw.ads: Minor fix for incorrect wording in comment. + +2017-04-28 Ed Schonberg <schonberg@adacore.com> + + * sem_res.adb (In_Instance_Code): New predicate in + Valid_Conversion, to determine whether a type conversion appears + as (or within) an actual for a formal object. Type conversions + in instances are not rechecked in Valid_Conversion because + visibility changes between generic location andi instance may + lead to spurious errors, but conversions within an actual must be + fully checked, and they are not fully resolved when pre-analyzing + the actuals. + 2017-04-28 Hristian Kirtchev <kirtchev@adacore.com> * exp_ch6.adb (Expand_N_Extended_Return_Statement): Use diff --git a/gcc/ada/alloc.ads b/gcc/ada/alloc.ads index 380ea2c..c42afbb 100644 --- a/gcc/ada/alloc.ads +++ b/gcc/ada/alloc.ads @@ -100,7 +100,7 @@ package Alloc is Names_Initial : constant := 6_000; -- Namet Names_Increment : constant := 100; - Nodes_Initial : constant := 5_000_000; -- Atree + Nodes_Initial : constant := 50_000; -- Atree Nodes_Increment : constant := 100; Nodes_Release_Threshold : constant := 100_000; diff --git a/gcc/ada/errout.adb b/gcc/ada/errout.adb index f71cc88..0ff4b4e 100644 --- a/gcc/ada/errout.adb +++ b/gcc/ada/errout.adb @@ -2119,9 +2119,12 @@ package body Errout is Write_Max_Errors; + -- Even though info messages are a subclass of warnings, they must not + -- be treated as errors when -gnatwe is in effect. + if Warning_Mode = Treat_As_Error then Total_Errors_Detected := - Total_Errors_Detected + Warnings_Detected; + Total_Errors_Detected + Warnings_Detected - Info_Messages; Warnings_Detected := Info_Messages; end if; end Output_Messages; diff --git a/gcc/ada/erroutc.adb b/gcc/ada/erroutc.adb index cf1095c..b4fc53a 100644 --- a/gcc/ada/erroutc.adb +++ b/gcc/ada/erroutc.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2016, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2017, 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- -- @@ -242,10 +242,11 @@ package body Erroutc is function Compilation_Errors return Boolean is begin - return Total_Errors_Detected /= 0 - or else (Warnings_Detected /= 0 - and then Warning_Mode = Treat_As_Error) - or else Warnings_Treated_As_Errors /= 0; + return + Total_Errors_Detected /= 0 + or else (Warnings_Detected - Info_Messages /= 0 + and then Warning_Mode = Treat_As_Error) + or else Warnings_Treated_As_Errors /= 0; end Compilation_Errors; ------------------ diff --git a/gcc/ada/errutil.adb b/gcc/ada/errutil.adb index e10624f..057ce76 100644 --- a/gcc/ada/errutil.adb +++ b/gcc/ada/errutil.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1991-2016, Free Software Foundation, Inc. -- +-- Copyright (C) 1991-2017, 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- -- @@ -586,9 +586,12 @@ package body Errutil is end if; end if; + -- Even though info messages are a subclass of warnings, they must not + -- be treated as errors when -gnatwe is in effect. + if Warning_Mode = Treat_As_Error then Total_Errors_Detected := - Total_Errors_Detected + Warnings_Detected; + Total_Errors_Detected + Warnings_Detected - Info_Messages; Warnings_Detected := Info_Messages; end if; diff --git a/gcc/ada/exp_ch9.adb b/gcc/ada/exp_ch9.adb index b79a41b..d10ae74 100644 --- a/gcc/ada/exp_ch9.adb +++ b/gcc/ada/exp_ch9.adb @@ -2956,7 +2956,7 @@ package body Exp_Ch9 is Ekind (Corresponding_Spec (N)) = E_Procedure; -- Indicates if N is a protected procedure body - Block_Decls : List_Id; + Block_Decls : List_Id := No_List; Try_Write : Entity_Id; Desired_Comp : Entity_Id; Decl : Node_Id; @@ -6117,6 +6117,7 @@ package body Exp_Ch9 is Cond_Id : Entity_Id; Entry_Body : Node_Id; Func_Body : Node_Id; + pragma Warnings (Off, Func_Body); -- Start of processing for Expand_Entry_Barrier @@ -9985,6 +9986,7 @@ package body Exp_Ch9 is declare Elmt : Elmt_Id; Op : Entity_Id; + pragma Warnings (Off, Op); begin Elmt := First_Elmt (Primitive_Operations (Etype (Conc_Typ))); diff --git a/gcc/ada/exp_disp.adb b/gcc/ada/exp_disp.adb index b74724e..b26aab0 100644 --- a/gcc/ada/exp_disp.adb +++ b/gcc/ada/exp_disp.adb @@ -1546,8 +1546,8 @@ package body Exp_Disp is Formal : Entity_Id; Formal_Typ : Entity_Id; Subp : Entity_Id; - Formal_DDT : Entity_Id; - Actual_DDT : Entity_Id; + Formal_DDT : Entity_Id := Empty; -- initialize to prevent warning + Actual_DDT : Entity_Id := Empty; -- initialize to prevent warning begin -- This subprogram is called directly from the semantics, so we need a @@ -1729,7 +1729,7 @@ package body Exp_Disp is Expr : Node_Id; Formal : Node_Id; Ftyp : Entity_Id; - Iface_Formal : Node_Id; + Iface_Formal : Node_Id := Empty; -- initialize to prevent warning New_Arg : Node_Id; Offset_To_Top : Node_Id; Target_Formal : Entity_Id; @@ -5274,7 +5274,7 @@ package body Exp_Disp is declare Prim_Elmt : Elmt_Id; Prim : Entity_Id; - Size_Comp : Node_Id; + Size_Comp : Node_Id := Empty; begin Prim_Elmt := First_Elmt (Primitive_Operations (Typ)); @@ -6377,7 +6377,7 @@ package body Exp_Disp is Loc : constant Source_Ptr := Sloc (Typ); Conc_Typ : Entity_Id; - Decls : List_Id; + Decls : List_Id := No_List; Prim : Entity_Id; Prim_Als : Entity_Id; Prim_Elmt : Elmt_Id; diff --git a/gcc/ada/exp_dist.adb b/gcc/ada/exp_dist.adb index 5af01bc..70f07fc 100644 --- a/gcc/ada/exp_dist.adb +++ b/gcc/ada/exp_dist.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2016, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2017, 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- -- @@ -1364,10 +1364,10 @@ package body Exp_Dist is RPC_Receiver : Entity_Id; RPC_Receiver_Statements : List_Id; RPC_Receiver_Case_Alternatives : constant List_Id := New_List; - RPC_Receiver_Elsif_Parts : List_Id; - RPC_Receiver_Request : Entity_Id; - RPC_Receiver_Subp_Id : Entity_Id; - RPC_Receiver_Subp_Index : Entity_Id; + RPC_Receiver_Elsif_Parts : List_Id := No_List; + RPC_Receiver_Request : Entity_Id := Empty; + RPC_Receiver_Subp_Id : Entity_Id := Empty; + RPC_Receiver_Subp_Index : Entity_Id := Empty; Subp_Str : String_Id; @@ -9434,7 +9434,7 @@ package body Exp_Dist is Stms : List_Id; Expr_Formal : Entity_Id; - Cstr_Formal : Entity_Id; + Cstr_Formal : Entity_Id := Empty; -- initialize to prevent warning Any : Entity_Id; Result_TC : Node_Id; diff --git a/gcc/ada/exp_prag.adb b/gcc/ada/exp_prag.adb index 36225a9..7ed1136 100644 --- a/gcc/ada/exp_prag.adb +++ b/gcc/ada/exp_prag.adb @@ -1000,7 +1000,7 @@ package body Exp_Prag is Flag : Entity_Id; Flag_Decl : Node_Id; If_Stmt : Node_Id; - Msg_Str : Entity_Id; + Msg_Str : Entity_Id := Empty; Multiple_PCs : Boolean; Old_Evals : Node_Id := Empty; Others_Decl : Node_Id; diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb index 45a71aa..a4fd1f4 100644 --- a/gcc/ada/sem_ch6.adb +++ b/gcc/ada/sem_ch6.adb @@ -3110,6 +3110,18 @@ package body Sem_Ch6 is end if; end; end if; + + -- Freezing an access type does not freeze the designated + -- type, but freezing conversions between access to interfaces + -- requires that the interface types themselves be frozen, so + -- that dispatch table entities are properly created. + -- Unclear whether a more general rule is needed ??? + + elsif Nkind (Node) = N_Type_Conversion + and then Is_Access_Type (Etype (Node)) + and then Is_Interface (Designated_Type (Etype (Node))) + then + Freeze_Before (N, Designated_Type (Etype (Node))); end if; return OK; diff --git a/gcc/ada/sem_ch7.adb b/gcc/ada/sem_ch7.adb index 266395a..0b415d7 100644 --- a/gcc/ada/sem_ch7.adb +++ b/gcc/ada/sem_ch7.adb @@ -1711,11 +1711,14 @@ package body Sem_Ch7 is Check_One_Tagged_Type_Or_Extension_At_Most; - -- If switch set, output information on why body required + -- Output relevant information as to why the package requires a body. + -- Do not consider generated packages as this exposes internal symbols + -- and leads to confusing messages. if List_Body_Required_Info and then In_Extended_Main_Source_Unit (Id) and then Unit_Requires_Body (Id) + and then Comes_From_Source (Id) then Unit_Requires_Body_Info (Id); end if; @@ -3143,4 +3146,5 @@ package body Sem_Ch7 is Next_Entity (E); end loop; end Unit_Requires_Body_Info; + end Sem_Ch7; diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb index 091a800..97f6cb6 100644 --- a/gcc/ada/sem_res.adb +++ b/gcc/ada/sem_res.adb @@ -11870,6 +11870,12 @@ package body Sem_Res is E : Node_Or_Entity_Id); -- If Report_Errs, then calls Errout.Error_Msg_NE with its arguments + function In_Instance_Code return Boolean; + -- Return True if expression is within an instance but is not in one of + -- the actuals of the instantiation. Type conversions within an instance + -- are not rechecked because type visbility may lead to spurious errors, + -- but conversions in an actual for a formal object must be checked. + function Valid_Tagged_Conversion (Target_Type : Entity_Id; Opnd_Type : Entity_Id) return Boolean; @@ -11899,7 +11905,7 @@ package body Sem_Res is -- Valid_Conversion still ensures the proper compatibility of -- target and operand types. - and then not In_Instance + and then not In_Instance_Code then Conversion_Error_N (Msg, Operand); end if; @@ -11933,6 +11939,43 @@ package body Sem_Res is end if; end Conversion_Error_NE; + ---------------------- + -- In_Instance_Code -- + ---------------------- + + function In_Instance_Code return Boolean is + Par : Node_Id; + begin + if not In_Instance then + return False; + + else + Par := Parent (N); + while Present (Par) loop + + -- The expression is part of an actual object if it appears + -- in the generated object declaration in the instance. + + if Nkind (Par) = N_Object_Declaration + and then Present (Corresponding_Generic_Association (Par)) + then + return False; + else + exit when Nkind (Par) + in N_Statement_Other_Than_Procedure_Call + or else Nkind (Par) in N_Subprogram_Call + or else Nkind (Par) in N_Declaration; + end if; + + Par := Parent (Par); + end loop; + + -- Otherwise the expression appears within the instantiated unit. + + return True; + end if; + end In_Instance_Code; + ---------------------------- -- Valid_Array_Conversion -- ---------------------------- @@ -12271,7 +12314,7 @@ package body Sem_Res is -- but in fact the test is required for source code as well, since -- this situation can arise in source code. - elsif In_Instance or else In_Inlined_Body then + elsif In_Instance_Code or else In_Inlined_Body then return True; -- Otherwise we need the conversion check diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb index 92b3307..41f6f16 100644 --- a/gcc/ada/sem_util.adb +++ b/gcc/ada/sem_util.adb @@ -12353,7 +12353,7 @@ package body Sem_Util is return False; -- One of the packages is at a deeper level than the other. Note that - -- both may still come from differen hierarchies. + -- both may still come from different hierarchies. -- (root) P_2 -- / \ : @@ -12388,7 +12388,7 @@ package body Sem_Util is -- P_1 -- : - -- X became P_1 P_2 or vica versa + -- X became P_1 P_2 or vice versa -- : -- P_2 diff --git a/gcc/ada/warnsw.ads b/gcc/ada/warnsw.ads index 4afb8b1..53332a7 100644 --- a/gcc/ada/warnsw.ads +++ b/gcc/ada/warnsw.ads @@ -150,9 +150,9 @@ package Warnsw is procedure Set_GNAT_Mode_Warnings; -- This is called in -gnatg mode to set the warnings for gnat mode. It is -- also used to set the proper warning statuses for -gnatw.g. Note that - -- this set of warnings is disjoint from -gnatwa, it enables warnings that - -- are not included in -gnatwa, and it disables warnings that are included - -- in -gnatwa (such as Warn_On_Implementation_Units, which we clearly want - -- to be False for units built with -gnatg). + -- this set of warnings is neither a subset nor a superset of -gnatwa, it + -- enables warnings that are not included in -gnatwa and disables warnings + -- that are included in -gnatwa (such as Warn_On_Implementation_Units, that + -- we clearly want to be False for units built with -gnatg). end Warnsw; |