+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
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;
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;
-- --
-- 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- --
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;
------------------
-- --
-- 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- --
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;
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;
Cond_Id : Entity_Id;
Entry_Body : Node_Id;
Func_Body : Node_Id;
+ pragma Warnings (Off, Func_Body);
-- Start of processing for Expand_Entry_Barrier
declare
Elmt : Elmt_Id;
Op : Entity_Id;
+ pragma Warnings (Off, Op);
begin
Elmt := First_Elmt (Primitive_Operations (Etype (Conc_Typ)));
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
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;
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));
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;
-- --
-- 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- --
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;
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;
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;
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;
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;
Next_Entity (E);
end loop;
end Unit_Requires_Body_Info;
+
end Sem_Ch7;
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;
-- 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;
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 --
----------------------------
-- 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
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
-- / \ :
-- P_1
-- :
- -- X became P_1 P_2 or vica versa
+ -- X became P_1 P_2 or vice versa
-- :
-- P_2
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;