summaryrefslogtreecommitdiff
path: root/gcc/ada/sem_ch12.adb
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2014-06-11 12:22:57 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2014-06-11 12:22:57 +0000
commitd8b02cb47055f7d18048d8507b32f051cf94bfd5 (patch)
tree645544f68c75c182b632092acdfbe2feee66f73d /gcc/ada/sem_ch12.adb
parent8b4123567ec4b1f923dcc6453c0750f33ae37b71 (diff)
downloadgcc-d8b02cb47055f7d18048d8507b32f051cf94bfd5.tar.gz
2014-06-11 Yannick Moy <moy@adacore.com>
* einfo.ads: Minor typo in comment 2014-06-11 Ed Schonberg <schonberg@adacore.com> * sinfo.ads, sinfo.adb: New attribute Uninitialized_Variable, for formal private types and private type extensions, to indicate variable in a generic unit whose uninitialized use suggest that actual type should be fully initialized. Needs_Initialized_Actual: removed, functionaity replaced by the above. * lib-xref.adb (Generate_Reference): Generate a reference for variables of a formal type when the unit is not the main unit, to enable appropriate warnings in an instance. * sem_ch12.adb (Check_Ininialized_Type): Improve warning on use of variable in a generic unit that suggests that actual type should be full initialized. * sem_warn.adb; (May_Need_Initialized_Actual): Make into procedure and do not emot warning, which now only appears in an instance. 2014-06-11 Eric Botcazou <ebotcazou@adacore.com> * gnat_ugn.texi: Fix minor typo. 2014-06-11 Hristian Kirtchev <kirtchev@adacore.com> * sem_ch3.adb Add with and use clause for Sem_Ch10. (Analyze_Declarations): Code reformatting. Analyze the contract of a subprogram body stub at the end of the declarative region. * sem_ch6.adb (Analyze_Subprogram_Body_Contract): Spec_Id is now a variable. Do not process the body if its contract is not available. Account for subprogram body stubs when extracting the corresponding spec. * sem_ch6.ads (Analyze_Subprogram_Contract): Update the comment on usage. * sem_ch10.ads, sem_ch10.adb (Analyze_Subprogram_Body_Stub_Contract): New routine. * sem_prag.adb (Analyze_Depends_In_Decl_Part): Account for subprogram body stubs when extracting the corresponding spec. (Analyze_Global_In_Decl_List): Account for subprogram body stubs when extracting the corresponding spec. (Analyze_Refined_Depends_In_Decl_Part): Use Find_Related_Subprogram_Or_Body to retrieve the declaration of the related body. Spec_Is now a variable. Account for subprogram body stubs when extracting the corresponding spec. (Analyze_Refined_Global_In_Decl_Part): Use Find_Related_Subprogram_Or_Body to retrieve the declaration of the related body. Spec_Is now a variable. Account for subprogram body stubs when extracting the corresponding spec. (Collect_Subprogram_Inputs_Output): Account for subprogram body stubs when extracting the corresponding spec. 2014-06-11 Vincent Celier <celier@adacore.com> * gnatcmd.adb (Process_Link): Do not invoke gnatlink with -lgnarl or -lgnat. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@211454 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/sem_ch12.adb')
-rw-r--r--gcc/ada/sem_ch12.adb40
1 files changed, 26 insertions, 14 deletions
diff --git a/gcc/ada/sem_ch12.adb b/gcc/ada/sem_ch12.adb
index 2d7487667bc..acb267e7946 100644
--- a/gcc/ada/sem_ch12.adb
+++ b/gcc/ada/sem_ch12.adb
@@ -9951,27 +9951,36 @@ package body Sem_Ch12 is
-----------------------------
procedure Check_Initialized_Types is
- Decl : Node_Id;
- Formal : Entity_Id;
- Actual : Entity_Id;
+ Decl : Node_Id;
+ Formal : Entity_Id;
+ Actual : Entity_Id;
+ Uninit_Var : Entity_Id;
begin
Decl := First (Generic_Formal_Declarations (Gen_Decl));
while Present (Decl) loop
- if (Nkind (Decl) = N_Private_Extension_Declaration
- and then Needs_Initialized_Actual (Decl))
-
- or else (Nkind (Decl) = N_Formal_Type_Declaration
- and then Nkind (Formal_Type_Definition (Decl)) =
- N_Formal_Private_Type_Definition
- and then Needs_Initialized_Actual
- (Formal_Type_Definition (Decl)))
+ Uninit_Var := Empty;
+
+ if Nkind (Decl) = N_Private_Extension_Declaration then
+ Uninit_Var := Uninitialized_Variable (Decl);
+
+ elsif Nkind (Decl) = N_Formal_Type_Declaration
+ and then Nkind (Formal_Type_Definition (Decl))
+ = N_Formal_Private_Type_Definition
then
+ Uninit_Var := Uninitialized_Variable
+ (Formal_Type_Definition (Decl));
+ end if;
+
+ if Present (Uninit_Var) then
Formal := Defining_Identifier (Decl);
Actual := First_Entity (Act_Decl_Id);
-- For each formal there is a subtype declaration that renames
- -- the actual and has the same name as the formal.
+ -- the actual and has the same name as the formal. Locate the
+ -- formal for warning message about uninitialized variables
+ -- in the generic, for which the actual type should be a
+ -- fully initialized type.
while Present (Actual) loop
exit when Ekind (Actual) = E_Package
@@ -9982,9 +9991,12 @@ package body Sem_Ch12 is
and then not Is_Fully_Initialized_Type (Actual)
and then Warn_On_No_Value_Assigned
then
+ Error_Msg_Node_2 := Formal;
Error_Msg_NE
- ("from its use in generic unit, actual for& should "
- & "be fully initialized type??", Actual, Formal);
+ ("generic unit has uninitialzed variable& of "
+ & " formal private type &?v?", Actual, Uninit_Var);
+ Error_Msg_NE ("actual type for& should be "
+ & "fully initialized type?v?", Actual, Formal);
exit;
end if;