From 51f37021cc1c713c1c42031d08904076467802b0 Mon Sep 17 00:00:00 2001 From: charlet Date: Tue, 30 Aug 2011 13:53:38 +0000 Subject: [PATCH] 2011-08-30 Thomas Quinot * s-oscons-tmplt.c, g-socket.ads: Adjust maximum allowed value for field tv_sec in struct timeval. 2011-08-30 Yannick Moy * exp_ch9.adb, exp_disp.adb, sem_ch9.adb, sem_res.adb: Protect several blocks of code doing full expansion, previously only guarded by Expander_Active, by anding the test that ALFA_Mode is not set 2011-08-30 Ed Schonberg * sem_ch6.adb (Analyze_Return_Type): If the return type is incomplete, add the function to the list of private dependents, for subsequent legality check on Taft amendment types. * sem_ch12.adb (Analyze_Formal_Incomplete_Type): Initialize Private_Dependents, as for other incomplete types. * sem_util.adb (Wrong_Type): Avoid cascaded errors when a Taft-amendment type is used as the return type of a function. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@178307 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ada/ChangeLog | 21 +++++++++++++++++++++ gcc/ada/exp_ch9.adb | 14 ++++++-------- gcc/ada/exp_disp.adb | 1 + gcc/ada/g-socket.ads | 4 ++-- gcc/ada/s-oscons-tmplt.c | 22 +++++++++++++++++++++- gcc/ada/sem_ch12.adb | 1 + gcc/ada/sem_ch6.adb | 11 +++++++++++ gcc/ada/sem_ch9.adb | 2 ++ gcc/ada/sem_res.adb | 5 +++++ gcc/ada/sem_util.adb | 16 ++++++++++++++++ 10 files changed, 86 insertions(+), 11 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 91367c8d9e2..0ef75da9cae 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,24 @@ +2011-08-30 Thomas Quinot + + * s-oscons-tmplt.c, g-socket.ads: Adjust maximum allowed value for + field tv_sec in struct timeval. + +2011-08-30 Yannick Moy + + * exp_ch9.adb, exp_disp.adb, sem_ch9.adb, sem_res.adb: Protect several + blocks of code doing full expansion, previously only guarded by + Expander_Active, by anding the test that ALFA_Mode is not set + +2011-08-30 Ed Schonberg + + * sem_ch6.adb (Analyze_Return_Type): If the return type is incomplete, + add the function to the list of private dependents, for subsequent + legality check on Taft amendment types. + * sem_ch12.adb (Analyze_Formal_Incomplete_Type): Initialize + Private_Dependents, as for other incomplete types. + * sem_util.adb (Wrong_Type): Avoid cascaded errors when a + Taft-amendment type is used as the return type of a function. + 2011-08-30 Javier Miranda * sem_ch3.adb (Check_Abstract_Overriding): Code cleanup: replace code diff --git a/gcc/ada/exp_ch9.adb b/gcc/ada/exp_ch9.adb index b30254df350..9e5951af7f4 100644 --- a/gcc/ada/exp_ch9.adb +++ b/gcc/ada/exp_ch9.adb @@ -4906,13 +4906,9 @@ package body Exp_Ch9 is Ldecl2 : Node_Id; begin - -- In formal verification mode, do not expand tasking constructs - - if ALFA_Mode then - return; - end if; - - if Expander_Active then + if Expander_Active + and then not ALFA_Mode + then -- If we have no handled statement sequence, we may need to build -- a dummy sequence consisting of a null statement. This can be @@ -11599,7 +11595,9 @@ package body Exp_Ch9 is Error_Msg_CRT ("protected body", N); return; - elsif Expander_Active then + elsif Expander_Active + and then not ALFA_Mode + then -- Associate discriminals with the first subprogram or entry body to -- be expanded. diff --git a/gcc/ada/exp_disp.adb b/gcc/ada/exp_disp.adb index b77bb0b89ac..b4f4970c457 100644 --- a/gcc/ada/exp_disp.adb +++ b/gcc/ada/exp_disp.adb @@ -702,6 +702,7 @@ package body Exp_Disp is -- of this restriction. if not Expander_Active + or else ALFA_Mode or else Restriction_Active (No_Dispatching_Calls) then return; diff --git a/gcc/ada/g-socket.ads b/gcc/ada/g-socket.ads index 69b6aefb5bc..c218b924ab0 100644 --- a/gcc/ada/g-socket.ads +++ b/gcc/ada/g-socket.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 2001-2010, AdaCore -- +-- Copyright (C) 2001-2011, AdaCore -- -- -- -- 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- -- @@ -432,7 +432,7 @@ package GNAT.Sockets is Immediate : constant Duration := 0.0; - Timeval_Forever : constant := 2.0 ** (SOSC.SIZEOF_tv_sec * 8 - 1) - 1.0; + Timeval_Forever : constant := 1.0 * SOSC.MAX_tv_sec; Forever : constant Duration := Duration'Min (Duration'Last, Timeval_Forever); diff --git a/gcc/ada/s-oscons-tmplt.c b/gcc/ada/s-oscons-tmplt.c index 4b5b138a963..fe3b90d1854 100644 --- a/gcc/ada/s-oscons-tmplt.c +++ b/gcc/ada/s-oscons-tmplt.c @@ -7,7 +7,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 2000-2009, Free Software Foundation, Inc. -- +-- Copyright (C) 2000-2011, 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- -- @@ -1219,6 +1219,26 @@ CND(IP_PKTINFO, "Get datagram info") CND(SIZEOF_tv_sec, "tv_sec") #define SIZEOF_tv_usec (sizeof tv.tv_usec) CND(SIZEOF_tv_usec, "tv_usec") +/* + + -- Maximum allowed value for tv_sec +*/ + +/** + ** On Solaris and IRIX, field tv_sec in struct timeval has an undocumented + ** hard-wired limit of 100 million. + ** On IA64 HP-UX the limit is 2**31 - 1. + **/ +#if defined (sun) || (defined (__mips) && defined (__sgi)) +# define MAX_tv_sec "100_000_000" + +#elif defined (__hpux__) +# define MAX_tv_sec "16#7fffffff#" + +#else +# define MAX_tv_sec "2 ** (SIZEOF_tv_sec * 8 - 1) - 1" +#endif +CNS(MAX_tv_sec, "") } /* diff --git a/gcc/ada/sem_ch12.adb b/gcc/ada/sem_ch12.adb index fbc9aa906fe..39ba9b95c11 100644 --- a/gcc/ada/sem_ch12.adb +++ b/gcc/ada/sem_ch12.adb @@ -2381,6 +2381,7 @@ package body Sem_Ch12 is Enter_Name (T); Set_Ekind (T, E_Incomplete_Type); Set_Etype (T, T); + Set_Private_Dependents (T, New_Elmt_List); if Tagged_Present (Def) then Set_Is_Tagged_Type (T); diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb index 174a7dfd009..a5d6a1afab8 100644 --- a/gcc/ada/sem_ch6.adb +++ b/gcc/ada/sem_ch6.adb @@ -1596,6 +1596,17 @@ package body Sem_Ch6 is Designator, Typ); end if; + -- The type must be completed in the current package. This + -- is checked at the end of the package declaraton, when + -- Taft amemdment types are identified. + + if Ekind (Scope (Current_Scope)) = E_Package + and then + In_Private_Part (Scope (Current_Scope)) + then + Append_Elmt (Designator, Private_Dependents (Typ)); + end if; + else Error_Msg_NE ("invalid use of incomplete type&", Designator, Typ); diff --git a/gcc/ada/sem_ch9.adb b/gcc/ada/sem_ch9.adb index f5530a9349b..e26707603e4 100644 --- a/gcc/ada/sem_ch9.adb +++ b/gcc/ada/sem_ch9.adb @@ -1280,6 +1280,7 @@ package body Sem_Ch9 is if Serious_Errors_Detected = 0 and then Expander_Active + and then not ALFA_Mode then Expand_N_Protected_Type_Declaration (N); Process_Full_View (N, T, Def_Id); @@ -2083,6 +2084,7 @@ package body Sem_Ch9 is if Serious_Errors_Detected = 0 and then Expander_Active + and then not ALFA_Mode then Expand_N_Task_Type_Declaration (N); Process_Full_View (N, T, Def_Id); diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb index 80f31a544ac..c3d9ec96a17 100644 --- a/gcc/ada/sem_res.adb +++ b/gcc/ada/sem_res.adb @@ -3443,6 +3443,7 @@ package body Sem_Res is and then Is_Limited_Record (Etype (F)) and then not Is_Constrained (Etype (F)) and then Expander_Active + and then not ALFA_Mode and then (Is_Controlled (Etype (F)) or else Has_Task (Etype (F))) then Establish_Transient_Scope (A, False); @@ -3458,6 +3459,7 @@ package body Sem_Res is elsif Nkind (A) = N_Op_Concat and then Nkind (N) = N_Procedure_Call_Statement and then Expander_Active + and then not ALFA_Mode and then not (Is_Intrinsic_Subprogram (Nam) and then Chars (Nam) = Name_Asm) @@ -3521,6 +3523,7 @@ package body Sem_Res is if (Is_Controlled (DDT) or else Has_Task (DDT)) and then Expander_Active + and then not ALFA_Mode then Establish_Transient_Scope (A, False); end if; @@ -5492,6 +5495,7 @@ package body Sem_Res is null; elsif Expander_Active + and then not ALFA_Mode and then Is_Type (Etype (Nam)) and then Requires_Transient_Scope (Etype (Nam)) and then @@ -6613,6 +6617,7 @@ package body Sem_Res is -- case we must trigger the transient scope mechanism. elsif Expander_Active + and then not ALFA_Mode and then Requires_Transient_Scope (Etype (Nam)) then Establish_Transient_Scope (N, Sec_Stack => True); diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb index ffca0d24e75..5306ec6bbd2 100644 --- a/gcc/ada/sem_util.adb +++ b/gcc/ada/sem_util.adb @@ -13096,6 +13096,22 @@ package body Sem_Util is then return; + -- If one of the types is a Taft-Amendment type and the other it its + -- completion, it must be an illegal use of a TAT in the spec, for + -- which an error was already emitted. Avoid cascaded errors. + + elsif Is_Incomplete_Type (Expec_Type) + and then Has_Completion_In_Body (Expec_Type) + and then Full_View (Expec_Type) = Etype (Expr) + then + return; + + elsif Is_Incomplete_Type (Etype (Expr)) + and then Has_Completion_In_Body (Etype (Expr)) + and then Full_View (Etype (Expr)) = Expec_Type + then + return; + -- In an instance, there is an ongoing problem with completion of -- type derived from private types. Their structure is what Gigi -- expects, but the Etype is the parent type rather than the -- 2.11.0