diff options
author | Arnaud Charlet <charlet@gcc.gnu.org> | 2011-11-21 14:23:52 +0100 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2011-11-21 14:23:52 +0100 |
commit | d2d4b3556d4f8b7c32de809f023ac876cd8cae82 (patch) | |
tree | 9b0dcdac8dae1e481bd247ca6ee57115b2baef80 /gcc/ada/sem_ch6.adb | |
parent | 08ef33f5eb7a65662d296670845600ed57fb6015 (diff) | |
download | gcc-d2d4b3556d4f8b7c32de809f023ac876cd8cae82.zip gcc-d2d4b3556d4f8b7c32de809f023ac876cd8cae82.tar.gz gcc-d2d4b3556d4f8b7c32de809f023ac876cd8cae82.tar.bz2 |
[multiple changes]
2011-11-21 Tristan Gingold <gingold@adacore.com>
* env.c: Remove unused declaration.
2011-11-21 Pascal Obry <obry@adacore.com>
* s-os_lib.ads: Minor style fix.
2011-11-21 Pascal Obry <obry@adacore.com>
* adaint.c (__gnat_dup2): When fd are stdout, stdin or stderr and
identical, do nothing on Windows XP.
2011-11-21 Yannick Moy <moy@adacore.com>
* sem_ch3.adb (Constrain_Index, Process_Range_Expr_In_Decl):
Use Full_Expander_Active instead of Expander_Active to control
the forced evaluation of expressions for the sake of generating
checks.
2011-11-21 Thomas Quinot <quinot@adacore.com>
* init.c: On FreeBSD, stack checking failures may raise SIGBUS.
2011-11-21 Tristan Gingold <gingold@adacore.com>
* sysdep.c (mode_read_text, mode_write_text, mode_append_text,
mode_read_binary, mode_write_binary, mode_append_binary,
mode_read_text_plus, mode_write_text_plus, mode_append_text_plus,
mode_read_binary_plus, mode_write_binary_plus,
mode_append_binary_plus): Remove unused declarations.
2011-11-21 Yannick Moy <moy@adacore.com>
* gnat_rm.texi: Minor rewording.
2011-11-21 Hristian Kirtchev <kirtchev@adacore.com>
* exp_imgv.adb (Expand_Width_Attribute): Emit
an error message rather than a warning when pragma Discard_Names
prevents the computation of 'Width. Do not emit an error through
the use of RE_Null.
2011-11-21 Javier Miranda <miranda@adacore.com>
* exp_ch6.adb (Make_Build_In_Place_Call_In_Allocator): Add
implicit type conversion when the type of the allocator is an
interface. Done to force generation of displacement of the "this"
pointer when required.
2011-11-21 Ed Schonberg <schonberg@adacore.com>
* sinfo.ads, sinfo.adb: Corresponding_Spec applies to expression
functions, and is set when the expression is a completion of a
previous declaration.
* sem_ch6.adb (Analyze_Expression_Function): To determine properly
whether an expression function completes a previous declaration,
use Find_Corresponding_Spec, as when analyzing a subprogram body.
2011-11-21 Steve Baird <baird@adacore.com>
* sem_util.adb (Deepest_Type_Access_Level): Improve comment.
(Type_Access_Level): Improve comment.
From-SVN: r181575
Diffstat (limited to 'gcc/ada/sem_ch6.adb')
-rw-r--r-- | gcc/ada/sem_ch6.adb | 35 |
1 files changed, 27 insertions, 8 deletions
diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb index 56c1074..25ee63e 100644 --- a/gcc/ada/sem_ch6.adb +++ b/gcc/ada/sem_ch6.adb @@ -268,16 +268,22 @@ package body Sem_Ch6 is procedure Analyze_Expression_Function (N : Node_Id) is Loc : constant Source_Ptr := Sloc (N); LocX : constant Source_Ptr := Sloc (Expression (N)); - Def_Id : constant Entity_Id := Defining_Entity (Specification (N)); Expr : constant Node_Id := Expression (N); - New_Body : Node_Id; - New_Decl : Node_Id; + Spec : constant Node_Id := Specification (N); + + Def_Id : Entity_Id; + pragma Unreferenced (Def_Id); - Prev : constant Entity_Id := Current_Entity_In_Scope (Def_Id); + Prev : Entity_Id; -- If the expression is a completion, Prev is the entity whose - -- declaration is completed. + -- declaration is completed. Def_Id is needed to analyze the spec. + + New_Body : Node_Id; + New_Decl : Node_Id; + New_Spec : Node_Id; begin + -- This is one of the occasions on which we transform the tree during -- semantic analysis. If this is a completion, transform the expression -- function into an equivalent subprogram body, and analyze it. @@ -286,10 +292,22 @@ package body Sem_Ch6 is -- determine whether this is possible. Inline_Processing_Required := True; + New_Spec := Copy_Separate_Tree (Spec); + Prev := Current_Entity_In_Scope (Defining_Entity (Spec)); + + -- If there are previous overloadable entities with the same name, + -- check whether any of them is completed by the expression function. + + if Present (Prev) + and then Is_Overloadable (Prev) + then + Def_Id := Analyze_Subprogram_Specification (Spec); + Prev := Find_Corresponding_Spec (N); + end if; New_Body := Make_Subprogram_Body (Loc, - Specification => Copy_Separate_Tree (Specification (N)), + Specification => New_Spec, Declarations => Empty_List, Handled_Statement_Sequence => Make_Handled_Sequence_Of_Statements (LocX, @@ -307,6 +325,7 @@ package body Sem_Ch6 is Insert_After (N, New_Body); Rewrite (N, Make_Null_Statement (Loc)); + Set_Has_Completion (Prev, False); Analyze (N); Analyze (New_Body); Set_Is_Inlined (Prev); @@ -314,6 +333,7 @@ package body Sem_Ch6 is elsif Present (Prev) and then Comes_From_Source (Prev) then + Set_Has_Completion (Prev, False); Rewrite (N, New_Body); Analyze (N); @@ -333,8 +353,7 @@ package body Sem_Ch6 is else New_Decl := - Make_Subprogram_Declaration (Loc, - Specification => Specification (N)); + Make_Subprogram_Declaration (Loc, Specification => Spec); Rewrite (N, New_Decl); Analyze (N); |