Commit 63be2a5a by Arnaud Charlet

[multiple changes]

2011-08-30  Thomas Quinot  <quinot@adacore.com>

	* s-oscons-tmplt.c, g-socket.ads: Adjust maximum allowed value for
	field tv_sec in struct timeval.

2011-08-30  Yannick Moy  <moy@adacore.com>

	* 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  <schonberg@adacore.com>

	* 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.

From-SVN: r178307
parent dd54644b
2011-08-30 Thomas Quinot <quinot@adacore.com>
* s-oscons-tmplt.c, g-socket.ads: Adjust maximum allowed value for
field tv_sec in struct timeval.
2011-08-30 Yannick Moy <moy@adacore.com>
* 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 <schonberg@adacore.com>
* 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 <miranda@adacore.com>
* sem_ch3.adb (Check_Abstract_Overriding): Code cleanup: replace code
......
......@@ -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.
......
......@@ -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;
......
......@@ -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);
......
......@@ -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, "")
}
/*
......
......@@ -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);
......
......@@ -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);
......
......@@ -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);
......
......@@ -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);
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment