From: Arnaud Charlet Date: Wed, 6 Sep 2017 09:22:50 +0000 (+0200) Subject: [multiple changes] X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=c7a494c99b4a421f6b80af834adb0d4c703d47a5;p=gcc.git [multiple changes] 2017-09-06 Ed Schonberg * sem_res.adb (Resolve_Entry_Call): Check whether a protected operation is subject to a pragma Eliminate. 2017-09-06 Ed Schonberg * sem_elim.ads, exp_ch4.adb: Minor reformatting. 2017-09-06 Eric Botcazou * fe.h (Eliminate_Error_Msg): Remove. From-SVN: r251755 --- diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index e1c754503c8..f6f19dc3b90 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,17 @@ +2017-09-06 Ed Schonberg + + * sem_res.adb (Resolve_Entry_Call): Check whether a protected + operation is subject to a pragma Eliminate. + +2017-09-06 Ed Schonberg + + * sem_elim.ads, exp_ch4.adb: Minor reformatting. + +2017-09-06 Eric Botcazou + + * fe.h (Eliminate_Error_Msg): Remove. + + 2017-09-05 Richard Sandiford * gcc-interface/utils.c (make_packable_type): Update call to diff --git a/gcc/ada/exp_ch4.adb b/gcc/ada/exp_ch4.adb index cc797a01a61..fb572751684 100644 --- a/gcc/ada/exp_ch4.adb +++ b/gcc/ada/exp_ch4.adb @@ -128,10 +128,10 @@ package body Exp_Ch4 is -- Common expansion processing for Boolean operators (And, Or, Xor) for the -- case of array type arguments. - procedure Expand_Non_Binary_Modular_Op (N : Node_Id); - -- Generating C code convert non-binary modular arithmetic operations into - -- code that relies on the frontend expansion of operator Mod. No expansion - -- is performed if N is not a non-binary modular operand. + procedure Expand_Nonbinary_Modular_Op (N : Node_Id); + -- When generating C code, convert nonbinary modular arithmetic operations + -- into code that relies on the front-end expansion of operator Mod. No + -- expansion is performed if N is not a nonbinary modular operand. procedure Expand_Short_Circuit_Operator (N : Node_Id); -- Common expansion processing for short-circuit boolean operators @@ -3962,23 +3962,23 @@ package body Exp_Ch4 is end if; end Expand_Membership_Minimize_Eliminate_Overflow; - ---------------------------------- - -- Expand_Non_Binary_Modular_Op -- - ---------------------------------- + --------------------------------- + -- Expand_Nonbinary_Modular_Op -- + --------------------------------- - procedure Expand_Non_Binary_Modular_Op (N : Node_Id) is + procedure Expand_Nonbinary_Modular_Op (N : Node_Id) is Loc : constant Source_Ptr := Sloc (N); Typ : constant Entity_Id := Etype (N); procedure Expand_Modular_Addition; - -- Expand the modular addition handling the special case of adding a + -- Expand the modular addition, handling the special case of adding a -- constant. procedure Expand_Modular_Op; -- Compute the general rule: (lhs OP rhs) mod Modulus procedure Expand_Modular_Subtraction; - -- Expand the modular addition handling the special case of subtracting + -- Expand the modular addition, handling the special case of subtracting -- a constant. ----------------------------- @@ -4048,10 +4048,9 @@ package body Exp_Ch4 is Mod_Expr : constant Node_Id := New_Op_Node (N_Op_Mod, Loc); begin - -- Convert non-binary modular type operands into integer or integer - -- values. Thus we avoid never-ending loops expanding them, and we - -- also ensure that the backend never receives non-binary modular - -- type expressions. + -- Convert nonbinary modular type operands into integer values. Thus + -- we avoid never-ending loops expanding them, and we also ensure + -- the back end never receives nonbinary modular type expressions. if Nkind_In (Nkind (N), N_Op_And, N_Op_Or) then Set_Left_Opnd (Op_Expr, @@ -4138,10 +4137,10 @@ package body Exp_Ch4 is end if; end Expand_Modular_Subtraction; - -- Start of processing for Expand_Non_Binary_Modular_Op + -- Start of processing for Expand_Nonbinary_Modular_Op begin - -- No action needed if we are not generating C code for a non-binary + -- No action needed if we are not generating C code for a nonbinary -- modular operand. if not Modify_Tree_For_C @@ -4171,7 +4170,7 @@ package body Exp_Ch4 is end case; Analyze_And_Resolve (N, Typ); - end Expand_Non_Binary_Modular_Op; + end Expand_Nonbinary_Modular_Op; ------------------------ -- Expand_N_Allocator -- @@ -6112,7 +6111,7 @@ package body Exp_Ch4 is if Is_Tagged_Type (Typ) then -- No expansion will be performed for VM targets, as the VM - -- back-ends will handle the membership tests directly. + -- back ends will handle the membership tests directly. if Tagged_Type_Expansion then Tagged_Membership (N, SCIL_Node, New_N); @@ -6370,7 +6369,7 @@ package body Exp_Ch4 is Right_Opnd => Make_Null (Loc)))); -- No expansion will be performed for VM targets, as - -- the VM back-ends will handle the membership tests + -- the VM back ends will handle the membership tests -- directly. if Tagged_Type_Expansion then @@ -6736,7 +6735,7 @@ package body Exp_Ch4 is -- is an access to protected subprogram, or a subtype thereof. We represent -- such access values as a record, and so we must replace the occurrence of -- null by the equivalent record (with a null address and a null pointer in - -- it), so that the backend creates the proper value. + -- it), so that the back end creates the proper value. procedure Expand_N_Null (N : Node_Id) is Loc : constant Source_Ptr := Sloc (N); @@ -6856,11 +6855,11 @@ package body Exp_Ch4 is Check_Float_Op_Overflow (N); - -- Generating C code convert non-binary modular additions into code that - -- relies on the frontend expansion of operator Mod. + -- When generating C code, convert nonbinary modular additions into code + -- that relies on the front-end expansion of operator Mod. if Modify_Tree_For_C then - Expand_Non_Binary_Modular_Op (N); + Expand_Nonbinary_Modular_Op (N); end if; end Expand_N_Op_Add; @@ -6887,11 +6886,11 @@ package body Exp_Ch4 is Expand_Intrinsic_Call (N, Entity (N)); end if; - -- Generating C code convert non-binary modular operators into code that - -- relies on the frontend expansion of operator Mod. + -- When generating C code, convert nonbinary modular operators into code + -- that relies on the front-end expansion of operator Mod. if Modify_Tree_For_C then - Expand_Non_Binary_Modular_Op (N); + Expand_Nonbinary_Modular_Op (N); end if; end Expand_N_Op_And; @@ -7134,11 +7133,11 @@ package body Exp_Ch4 is Check_Float_Op_Overflow (N); - -- Generating C code convert non-binary modular divisions into code that - -- relies on the frontend expansion of operator Mod. + -- When generating C code, convert nonbinary modular divisions into code + -- that relies on the front-end expansion of operator Mod. if Modify_Tree_For_C then - Expand_Non_Binary_Modular_Op (N); + Expand_Nonbinary_Modular_Op (N); end if; end Expand_N_Op_Divide; @@ -7844,7 +7843,7 @@ package body Exp_Ch4 is -- Otherwise expand the component by component equality. Note that -- we never use block-bit comparisons for records, because of the - -- problems with gaps. The backend will often be able to recombine + -- problems with gaps. The back end will often be able to recombine -- the separate comparisons that we generate here. else @@ -8643,11 +8642,11 @@ package body Exp_Ch4 is Analyze_And_Resolve (N, Typ); end if; - -- Generating C code convert non-binary modular minus into code that - -- relies on the frontend expansion of operator Mod. + -- When generating C code, convert nonbinary modular minus into code + -- that relies on the front-end expansion of operator Mod. if Modify_Tree_For_C then - Expand_Non_Binary_Modular_Op (N); + Expand_Nonbinary_Modular_Op (N); end if; end Expand_N_Op_Minus; @@ -9126,11 +9125,11 @@ package body Exp_Ch4 is Check_Float_Op_Overflow (N); - -- Generating C code convert non-binary modular multiplications into - -- code that relies on the frontend expansion of operator Mod. + -- When generating C code, convert nonbinary modular multiplications + -- into code that relies on the front-end expansion of operator Mod. if Modify_Tree_For_C then - Expand_Non_Binary_Modular_Op (N); + Expand_Nonbinary_Modular_Op (N); end if; end Expand_N_Op_Multiply; @@ -9443,11 +9442,11 @@ package body Exp_Ch4 is Expand_Intrinsic_Call (N, Entity (N)); end if; - -- Generating C code convert non-binary modular operators into code that - -- relies on the frontend expansion of operator Mod. + -- When generating C code, convert nonbinary modular operators into code + -- that relies on the front-end expansion of operator Mod. if Modify_Tree_For_C then - Expand_Non_Binary_Modular_Op (N); + Expand_Nonbinary_Modular_Op (N); end if; end Expand_N_Op_Or; @@ -9882,11 +9881,11 @@ package body Exp_Ch4 is Check_Float_Op_Overflow (N); - -- Generating C code convert non-binary modular subtractions into code - -- that relies on the frontend expansion of operator Mod. + -- When generating C code, convert nonbinary modular subtractions into + -- code that relies on the front-end expansion of operator Mod. if Modify_Tree_For_C then - Expand_Non_Binary_Modular_Op (N); + Expand_Nonbinary_Modular_Op (N); end if; end Expand_N_Op_Subtract; @@ -10441,7 +10440,7 @@ package body Exp_Ch4 is procedure Make_Temporary_For_Slice; -- Create a named variable for the value of the slice, in cases where - -- the back-end cannot handle it properly, e.g. when packed types or + -- the back end cannot handle it properly, e.g. when packed types or -- unaligned slices are involved. ------------------------- @@ -11808,7 +11807,7 @@ package body Exp_Ch4 is -- and then ... -- and then Lhs.Cmpn = Rhs.Cmpn - -- The expression is folded by the back-end for adjacent fields. This + -- The expression is folded by the back end for adjacent fields. This -- function is called for tagged record in only one occasion: for imple- -- menting predefined primitive equality (see Predefined_Primitives_Bodies) -- otherwise the primitive "=" is used directly. diff --git a/gcc/ada/fe.h b/gcc/ada/fe.h index 48727c64851..0ab37720a8d 100644 --- a/gcc/ada/fe.h +++ b/gcc/ada/fe.h @@ -242,12 +242,6 @@ extern Entity_Id First_Subtype (Entity_Id); extern Boolean Is_By_Reference_Type (Entity_Id); extern Boolean Is_Derived_Type (Entity_Id); -/* sem_elim: */ - -#define Eliminate_Error_Msg sem_elim__eliminate_error_msg - -extern void Eliminate_Error_Msg (Node_Id, Entity_Id); - /* sem_eval: */ #define Compile_Time_Known_Value sem_eval__compile_time_known_value diff --git a/gcc/ada/sem_elim.ads b/gcc/ada/sem_elim.ads index 9bb1596336d..35aadf97b80 100644 --- a/gcc/ada/sem_elim.ads +++ b/gcc/ada/sem_elim.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 1997-2008, Free Software Foundation, Inc. -- +-- Copyright (C) 1997-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- -- @@ -60,9 +60,9 @@ package Sem_Elim is -- error will be posted on N. procedure Eliminate_Error_Msg (N : Node_Id; E : Entity_Id); - -- Called by the front-end and back-end on encountering a reference to an - -- eliminated subprogram. N is the node for the reference (such as occurs - -- in a call or attribute), and E is the entity of the subprogram that has - -- been eliminated. + -- Called by the front-end on encountering a reference to an eliminated + -- subprogram. N is the node for the reference (such as occurs in a call, + -- a protected call or an attribute), and E is the entity of the + -- subprogram that has been eliminated. end Sem_Elim; diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb index cbafcd6582d..79e21e83e1d 100644 --- a/gcc/ada/sem_res.adb +++ b/gcc/ada/sem_res.adb @@ -7519,10 +7519,15 @@ package body Sem_Res is if Nkind (Entry_Name) = N_Selected_Component then - -- Simple entry call + -- Simple entry or protected operation call Nam := Entity (Selector_Name (Entry_Name)); Obj := Prefix (Entry_Name); + + if Is_Subprogram (Nam) then + Check_For_Eliminated_Subprogram (Entry_Name, Nam); + end if; + Was_Over := Is_Overloaded (Selector_Name (Entry_Name)); else pragma Assert (Nkind (Entry_Name) = N_Indexed_Component);