Commit c199ccf7 by Arnaud Charlet

[multiple changes]

2011-08-30  Gary Dismukes  <dismukes@adacore.com>

	* sem_res.adb (Valid_Conversion): Revise test for implicit anonymous
	access conversions to check that the conversion is a rewritten node,
	rather than just having Comes_From_Source set to False, which wasn't
	sufficient.

2011-08-30  Robert Dewar  <dewar@adacore.com>

	* exp_ch9.adb, sem_ch9.adb, sem_ch6.adb, exp_disp.adb,
	g-socket.ads: Minor reformatting.

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

	* sem_util.adb: Minor reformatting.

2011-08-30  Tristan Gingold  <gingold@adacore.com>

	* raise-gcc.c: Never catch exception if _UA_FORCE_UNWIND flag is set,
	to be compliant with the ABI.

From-SVN: r178310
parent dff99e1a
2011-08-30 Gary Dismukes <dismukes@adacore.com>
* sem_res.adb (Valid_Conversion): Revise test for implicit anonymous
access conversions to check that the conversion is a rewritten node,
rather than just having Comes_From_Source set to False, which wasn't
sufficient.
2011-08-30 Robert Dewar <dewar@adacore.com>
* exp_ch9.adb, sem_ch9.adb, sem_ch6.adb, exp_disp.adb,
g-socket.ads: Minor reformatting.
2011-08-30 Thomas Quinot <quinot@adacore.com>
* sem_util.adb: Minor reformatting.
2011-08-30 Tristan Gingold <gingold@adacore.com>
* raise-gcc.c: Never catch exception if _UA_FORCE_UNWIND flag is set,
to be compliant with the ABI.
2011-08-30 Hristian Kirtchev <kirtchev@adacore.com> 2011-08-30 Hristian Kirtchev <kirtchev@adacore.com>
* sem_ch12.adb (Check_Private_View): Exchange the private and full view * sem_ch12.adb (Check_Private_View): Exchange the private and full view
......
...@@ -2279,12 +2279,10 @@ package body Exp_Ch9 is ...@@ -2279,12 +2279,10 @@ package body Exp_Ch9 is
then then
First_Param := First_Param :=
Make_Parameter_Specification (Loc, Make_Parameter_Specification (Loc,
Defining_Identifier => Defining_Identifier => Make_Defining_Identifier (Loc, Name_uO),
Make_Defining_Identifier (Loc, In_Present => True,
Chars => Name_uO), Out_Present => False,
In_Present => True, Parameter_Type => New_Reference_To (Obj_Typ, Loc));
Out_Present => False,
Parameter_Type => New_Reference_To (Obj_Typ, Loc));
-- For entries and procedures of protected types the mode of -- For entries and procedures of protected types the mode of
-- the controlling argument must be in-out. -- the controlling argument must be in-out.
...@@ -4909,7 +4907,6 @@ package body Exp_Ch9 is ...@@ -4909,7 +4907,6 @@ package body Exp_Ch9 is
if Expander_Active if Expander_Active
and then not ALFA_Mode and then not ALFA_Mode
then then
-- If we have no handled statement sequence, we may need to build -- If we have no handled statement sequence, we may need to build
-- a dummy sequence consisting of a null statement. This can be -- a dummy sequence consisting of a null statement. This can be
-- skipped if the trivial accept optimization is permitted. -- skipped if the trivial accept optimization is permitted.
...@@ -4920,7 +4917,7 @@ package body Exp_Ch9 is ...@@ -4920,7 +4917,7 @@ package body Exp_Ch9 is
then then
Set_Handled_Statement_Sequence (N, Set_Handled_Statement_Sequence (N,
Make_Handled_Sequence_Of_Statements (Loc, Make_Handled_Sequence_Of_Statements (Loc,
New_List (Make_Null_Statement (Loc)))); Statements => New_List (Make_Null_Statement (Loc))));
end if; end if;
-- Create and declare two labels to be placed at the end of the -- Create and declare two labels to be placed at the end of the
...@@ -11598,7 +11595,6 @@ package body Exp_Ch9 is ...@@ -11598,7 +11595,6 @@ package body Exp_Ch9 is
elsif Expander_Active elsif Expander_Active
and then not ALFA_Mode and then not ALFA_Mode
then then
-- Associate discriminals with the first subprogram or entry body to -- Associate discriminals with the first subprogram or entry body to
-- be expanded. -- be expanded.
......
...@@ -695,14 +695,18 @@ package body Exp_Disp is ...@@ -695,14 +695,18 @@ package body Exp_Disp is
end if; end if;
-- Expand_Dispatching_Call is called directly from the semantics, -- Expand_Dispatching_Call is called directly from the semantics,
-- so we need a check to see whether expansion is active before -- so we only proceed if the expander is active.
-- proceeding. In addition, there is no need to expand the call
-- if we are compiling under restriction No_Dispatching_Calls;
-- the semantic analyzer has previously notified the violation
-- of this restriction.
if not Expander_Active if not Expander_Active
-- And this expansion is not required in special ALFA mode expansion
or else ALFA_Mode or else ALFA_Mode
-- And there is no need to expand the call if we are compiling under
-- restriction No_Dispatching_Calls; the semantic analyzer has
-- previously notified the violation of this restriction.
or else Restriction_Active (No_Dispatching_Calls) or else Restriction_Active (No_Dispatching_Calls)
then then
return; return;
......
...@@ -435,8 +435,9 @@ package GNAT.Sockets is ...@@ -435,8 +435,9 @@ package GNAT.Sockets is
Timeval_Forever : constant := 1.0 * SOSC.MAX_tv_sec; Timeval_Forever : constant := 1.0 * SOSC.MAX_tv_sec;
Forever : constant Duration := Forever : constant Duration :=
Duration'Min (Duration'Last, Timeval_Forever); Duration'Min (Duration'Last, Timeval_Forever);
subtype Timeval_Duration is Duration range Immediate .. Forever; subtype Timeval_Duration is Duration range Immediate .. Forever;
-- These needs commenting, in particular we should explain what these is
-- used for, and how the Timeval_Forever value is chosen (see r176463) ???
subtype Selector_Duration is Timeval_Duration; subtype Selector_Duration is Timeval_Duration;
-- Timeout value for selector operations -- Timeout value for selector operations
......
...@@ -217,7 +217,7 @@ db (int db_code, char * msg_format, ...) ...@@ -217,7 +217,7 @@ db (int db_code, char * msg_format, ...)
static void static void
db_phases (int phases) db_phases (int phases)
{ {
phase_descriptor *a = phase_descriptors; const phase_descriptor *a = phase_descriptors;
if (! (db_accepted_codes() & DB_PHASES)) if (! (db_accepted_codes() & DB_PHASES))
return; return;
...@@ -901,6 +901,7 @@ is_handled_by (_Unwind_Ptr choice, _GNAT_Exception * propagated_exception) ...@@ -901,6 +901,7 @@ is_handled_by (_Unwind_Ptr choice, _GNAT_Exception * propagated_exception)
static void static void
get_action_description_for (_Unwind_Context *uw_context, get_action_description_for (_Unwind_Context *uw_context,
_Unwind_Exception *uw_exception, _Unwind_Exception *uw_exception,
_Unwind_Action uw_phase,
region_descriptor *region, region_descriptor *region,
action_descriptor *action) action_descriptor *action)
{ {
...@@ -965,17 +966,22 @@ get_action_description_for (_Unwind_Context *uw_context, ...@@ -965,17 +966,22 @@ get_action_description_for (_Unwind_Context *uw_context,
/* Positive filters are for regular handlers. */ /* Positive filters are for regular handlers. */
else if (ar_filter > 0) else if (ar_filter > 0)
{ {
/* See if the filter we have is for an exception which matches /* Do not catch an exception if the _UA_FORCE_UNWIND flag is
the one we are propagating. */ passed (to follow the ABI). */
_Unwind_Ptr choice = get_ttype_entry_for (region, ar_filter); if (!(uw_phase & _UA_FORCE_UNWIND))
{
if (is_handled_by (choice, gnat_exception)) /* See if the filter we have is for an exception which
{ matches the one we are propagating. */
action->kind = handler; _Unwind_Ptr choice = get_ttype_entry_for (region, ar_filter);
action->ttype_filter = ar_filter;
action->ttype_entry = choice; if (is_handled_by (choice, gnat_exception))
return; {
} action->kind = handler;
action->ttype_filter = ar_filter;
action->ttype_entry = choice;
return;
}
}
} }
/* Negative filter values are for C++ exception specifications. /* Negative filter values are for C++ exception specifications.
...@@ -1128,7 +1134,8 @@ PERSONALITY_FUNCTION (version_arg_t version_arg, ...@@ -1128,7 +1134,8 @@ PERSONALITY_FUNCTION (version_arg_t version_arg,
/* Search the call-site and action-record tables for the action associated /* Search the call-site and action-record tables for the action associated
with this IP. */ with this IP. */
get_action_description_for (uw_context, uw_exception, &region, &action); get_action_description_for (uw_context, uw_exception, uw_phases,
&region, &action);
db_action_for (&action, uw_context); db_action_for (&action, uw_context);
/* Whatever the phase, if there is nothing relevant in this frame, /* Whatever the phase, if there is nothing relevant in this frame,
......
...@@ -1601,8 +1601,7 @@ package body Sem_Ch6 is ...@@ -1601,8 +1601,7 @@ package body Sem_Ch6 is
-- Taft amemdment types are identified. -- Taft amemdment types are identified.
if Ekind (Scope (Current_Scope)) = E_Package if Ekind (Scope (Current_Scope)) = E_Package
and then and then In_Private_Part (Scope (Current_Scope))
In_Private_Part (Scope (Current_Scope))
then then
Append_Elmt (Designator, Private_Dependents (Typ)); Append_Elmt (Designator, Private_Dependents (Typ));
end if; end if;
...@@ -4241,10 +4240,10 @@ package body Sem_Ch6 is ...@@ -4241,10 +4240,10 @@ package body Sem_Ch6 is
or else not Is_Primitive_Wrapper (New_Id) or else not Is_Primitive_Wrapper (New_Id)
then then
Conformance_Error ("\mode of & does not match!", New_Formal); Conformance_Error ("\mode of & does not match!", New_Formal);
else else
declare declare
T : constant Entity_Id := T : constant Entity_Id := Find_Dispatching_Type (New_Id);
Find_Dispatching_Type (New_Id);
begin begin
if Is_Protected_Type if Is_Protected_Type
(Corresponding_Concurrent_Type (T)) (Corresponding_Concurrent_Type (T))
...@@ -8129,9 +8128,9 @@ package body Sem_Ch6 is ...@@ -8129,9 +8128,9 @@ package body Sem_Ch6 is
and then Is_Protected_Type (Typ) and then Is_Protected_Type (Typ)
and then and then
(Is_Limited_Interface (Iface_Typ) (Is_Limited_Interface (Iface_Typ)
or else Is_Protected_Interface (Iface_Typ) or else Is_Protected_Interface (Iface_Typ)
or else Is_Synchronized_Interface (Iface_Typ) or else Is_Synchronized_Interface (Iface_Typ)
or else Is_Task_Interface (Iface_Typ)) or else Is_Task_Interface (Iface_Typ))
then then
Error_Msg_PT (Parent (Typ), Candidate); Error_Msg_PT (Parent (Typ), Candidate);
end if; end if;
......
...@@ -1275,11 +1275,18 @@ package body Sem_Ch9 is ...@@ -1275,11 +1275,18 @@ package body Sem_Ch9 is
end if; end if;
-- Create corresponding record now, because some private dependents -- Create corresponding record now, because some private dependents
-- may be subtypes of the partial view. Skip if errors are present, -- may be subtypes of the partial view.
-- to prevent cascaded messages.
-- Skip if errors are present, to prevent cascaded messages
if Serious_Errors_Detected = 0 if Serious_Errors_Detected = 0
-- Also skip if expander is not active
and then Expander_Active and then Expander_Active
-- Also skip if in ALFA mode, this expansion is not needed
and then not ALFA_Mode and then not ALFA_Mode
then then
Expand_N_Protected_Type_Declaration (N); Expand_N_Protected_Type_Declaration (N);
...@@ -2079,11 +2086,17 @@ package body Sem_Ch9 is ...@@ -2079,11 +2086,17 @@ package body Sem_Ch9 is
end if; end if;
-- Create corresponding record now, because some private dependents -- Create corresponding record now, because some private dependents
-- may be subtypes of the partial view. Skip if errors are present, -- may be subtypes of the partial view.
-- to prevent cascaded messages.
-- Skip if errors are present, to prevent cascaded messages
if Serious_Errors_Detected = 0 if Serious_Errors_Detected = 0
-- Also skip if expander is not active
and then Expander_Active and then Expander_Active
-- Or if in ALFA mode, this expansion is not needed
and then not ALFA_Mode and then not ALFA_Mode
then then
Expand_N_Task_Type_Declaration (N); Expand_N_Task_Type_Declaration (N);
......
...@@ -10648,10 +10648,16 @@ package body Sem_Res is ...@@ -10648,10 +10648,16 @@ package body Sem_Res is
-- conversions from an anonymous access type to a named general -- conversions from an anonymous access type to a named general
-- access type. Such conversions are not allowed in the case of -- access type. Such conversions are not allowed in the case of
-- access parameters and stand-alone objects of an anonymous -- access parameters and stand-alone objects of an anonymous
-- access type. -- access type. The implicit conversion case is recognized by
-- testing that Comes_From_Source is False and that it's been
-- rewritten. The Comes_From_Source test isn't sufficient because
-- nodes in inlined calls to predefined library routines can have
-- Comes_From_Source set to False. (Is there a better way to test
-- for implicit conversions???)
if Ada_Version >= Ada_2012 if Ada_Version >= Ada_2012
and then not Comes_From_Source (N) and then not Comes_From_Source (N)
and then N /= Original_Node (N)
and then Ekind (Target_Type) = E_General_Access_Type and then Ekind (Target_Type) = E_General_Access_Type
and then Ekind (Opnd_Type) = E_Anonymous_Access_Type and then Ekind (Opnd_Type) = E_Anonymous_Access_Type
then then
......
...@@ -8470,7 +8470,7 @@ package body Sem_Util is ...@@ -8470,7 +8470,7 @@ package body Sem_Util is
or else K = E_In_Out_Parameter or else K = E_In_Out_Parameter
or else K = E_Generic_In_Out_Parameter or else K = E_Generic_In_Out_Parameter
-- Current instance of type: -- Current instance of type
or else (Is_Type (E) and then In_Open_Scopes (E)) or else (Is_Type (E) and then In_Open_Scopes (E))
or else (Is_Incomplete_Or_Private_Type (E) or else (Is_Incomplete_Or_Private_Type (E)
...@@ -8714,8 +8714,8 @@ package body Sem_Util is ...@@ -8714,8 +8714,8 @@ package body Sem_Util is
Kill_Current_Values_For_Entity_Chain (First_Entity (S)); Kill_Current_Values_For_Entity_Chain (First_Entity (S));
-- If scope is a package, also clear current values of all -- If scope is a package, also clear current values of all private
-- private entities in the scope. -- entities in the scope.
if Is_Package_Or_Generic_Package (S) if Is_Package_Or_Generic_Package (S)
or else Is_Concurrent_Type (S) or else Is_Concurrent_Type (S)
...@@ -9016,7 +9016,7 @@ package body Sem_Util is ...@@ -9016,7 +9016,7 @@ package body Sem_Util is
-- is an lvalue, but the prefix is never an lvalue, since it is just -- is an lvalue, but the prefix is never an lvalue, since it is just
-- the scope where the name is found. -- the scope where the name is found.
when N_Expanded_Name => when N_Expanded_Name =>
if N = Prefix (P) then if N = Prefix (P) then
return May_Be_Lvalue (P); return May_Be_Lvalue (P);
else else
...@@ -9029,7 +9029,7 @@ package body Sem_Util is ...@@ -9029,7 +9029,7 @@ package body Sem_Util is
-- it is. Note however that A is not an lvalue if it is of an access -- it is. Note however that A is not an lvalue if it is of an access
-- type since this is an implicit dereference. -- type since this is an implicit dereference.
when N_Selected_Component => when N_Selected_Component =>
if N = Prefix (P) if N = Prefix (P)
and then Present (Etype (N)) and then Present (Etype (N))
and then Is_Access_Type (Etype (N)) and then Is_Access_Type (Etype (N))
...@@ -9044,7 +9044,7 @@ package body Sem_Util is ...@@ -9044,7 +9044,7 @@ package body Sem_Util is
-- or slice is an lvalue, except if it is an access type, where we -- or slice is an lvalue, except if it is an access type, where we
-- have an implicit dereference. -- have an implicit dereference.
when N_Indexed_Component | N_Slice => when N_Indexed_Component | N_Slice =>
if N /= Prefix (P) if N /= Prefix (P)
or else (Present (Etype (N)) and then Is_Access_Type (Etype (N))) or else (Present (Etype (N)) and then Is_Access_Type (Etype (N)))
then then
...@@ -9055,7 +9055,7 @@ package body Sem_Util is ...@@ -9055,7 +9055,7 @@ package body Sem_Util is
-- Prefix of a reference is an lvalue if the reference is an lvalue -- Prefix of a reference is an lvalue if the reference is an lvalue
when N_Reference => when N_Reference =>
return May_Be_Lvalue (P); return May_Be_Lvalue (P);
-- Prefix of explicit dereference is never an lvalue -- Prefix of explicit dereference is never an lvalue
...@@ -9072,14 +9072,12 @@ package body Sem_Util is ...@@ -9072,14 +9072,12 @@ package body Sem_Util is
N_Entry_Call_Statement | N_Entry_Call_Statement |
N_Accept_Statement N_Accept_Statement
=> =>
if Nkind (P) = N_Function_Call if Nkind (P) = N_Function_Call and then Ada_Version < Ada_2012 then
and then Ada_Version < Ada_2012
then
return False; return False;
end if; end if;
-- The following mechanism is clumsy and fragile. A single -- The following mechanism is clumsy and fragile. A single flag
-- flag set in Resolve_Actuals would be preferable ??? -- set in Resolve_Actuals would be preferable ???
declare declare
Proc : Entity_Id; Proc : Entity_Id;
...@@ -9093,8 +9091,8 @@ package body Sem_Util is ...@@ -9093,8 +9091,8 @@ package body Sem_Util is
return True; return True;
end if; end if;
-- If we are not a list member, something is strange, so -- If we are not a list member, something is strange, so be
-- be conservative and return True. -- conservative and return True.
if not Is_List_Member (N) then if not Is_List_Member (N) then
return True; return True;
...@@ -9106,8 +9104,8 @@ package body Sem_Util is ...@@ -9106,8 +9104,8 @@ package body Sem_Util is
Form := First_Formal (Proc); Form := First_Formal (Proc);
Act := N; Act := N;
loop loop
-- If no formal, something is weird, so be conservative -- If no formal, something is weird, so be conservative and
-- and return True. -- return True.
if No (Form) then if No (Form) then
return True; return True;
......
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