From 39ce7604727100ff8abd1e5513a303b6df499b7a Mon Sep 17 00:00:00 2001 From: Arnaud Charlet Date: Wed, 2 Jan 2013 10:34:50 +0100 Subject: [multiple changes] 2013-01-02 Thomas Quinot * exp_prag.adb: Minor reformatting. 2013-01-02 Ed Schonberg * sem_ch12.adb (Get_Associated_Node): If the node is an identifier that denotes an unconstrained array in an object declaration, it is rewritten as the name of an anonymous subtype whose bounds are given by the initial expression in the declaration. When checking whether that identifier is global reference, use the original node, not the local generated subtype. 2013-01-02 Olivier Hainque * tracebak.c: Revert previous change, incomplete. 2013-01-02 Ed Schonberg * sem_ch13.adb (Analyze_Aspect_Specifications): If the aspect appears on a subprogram body that acts as a spec, place the corresponding pragma in the declarations of the body, so that e.g. pre/postcondition checks can be generated appropriately. 2013-01-02 Robert Dewar * sem_ch3.adb: Minor reformatting and code reorganization. From-SVN: r194781 --- gcc/ada/ChangeLog | 28 ++++++++++++++++++++++++++++ gcc/ada/exp_prag.adb | 4 ++-- gcc/ada/sem_ch12.adb | 11 +++++++++++ gcc/ada/sem_ch13.adb | 11 +++++++++++ gcc/ada/sem_ch3.adb | 21 +++++++++++++-------- gcc/ada/tracebak.c | 21 +++------------------ 6 files changed, 68 insertions(+), 28 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 66c03a0..7d79a90 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,31 @@ +2013-01-02 Thomas Quinot + + * exp_prag.adb: Minor reformatting. + +2013-01-02 Ed Schonberg + + * sem_ch12.adb (Get_Associated_Node): If the node is an + identifier that denotes an unconstrained array in an object + declaration, it is rewritten as the name of an anonymous + subtype whose bounds are given by the initial expression in the + declaration. When checking whether that identifier is global + reference, use the original node, not the local generated subtype. + +2013-01-02 Olivier Hainque + + * tracebak.c: Revert previous change, incomplete. + +2013-01-02 Ed Schonberg + + * sem_ch13.adb (Analyze_Aspect_Specifications): If the aspect + appears on a subprogram body that acts as a spec, place the + corresponding pragma in the declarations of the body, so that + e.g. pre/postcondition checks can be generated appropriately. + +2013-01-02 Robert Dewar + + * sem_ch3.adb: Minor reformatting and code reorganization. + 2013-01-02 Vincent Celier * switch-m.adb (Normalize_Compiler_Switches): Record the diff --git a/gcc/ada/exp_prag.adb b/gcc/ada/exp_prag.adb index d34322d..9ff1318 100644 --- a/gcc/ada/exp_prag.adb +++ b/gcc/ada/exp_prag.adb @@ -274,8 +274,8 @@ package body Exp_Prag is -------------------------- procedure Expand_Pragma_Check (N : Node_Id) is - Cond : constant Node_Id := Arg2 (N); - Nam : constant Name_Id := Chars (Arg1 (N)); + Cond : constant Node_Id := Arg2 (N); + Nam : constant Name_Id := Chars (Arg1 (N)); Msg : Node_Id; Loc : constant Source_Ptr := Sloc (First_Node (Cond)); diff --git a/gcc/ada/sem_ch12.adb b/gcc/ada/sem_ch12.adb index 10718c4..b90a7af 100644 --- a/gcc/ada/sem_ch12.adb +++ b/gcc/ada/sem_ch12.adb @@ -4929,6 +4929,17 @@ package body Sem_Ch12 is Assoc := Associated_Node (Assoc); end if; + -- An additional special case: an unconstrained type in an object + -- declaration may have been rewritten as a local subtype constrained + -- by the expression in the declaration. We need to recover the + -- original entity which may be global. + + if Present (Original_Node (Assoc)) + and then Nkind (Parent (N)) = N_Object_Declaration + then + Assoc := Original_Node (Assoc); + end if; + return Assoc; end if; end Get_Associated_Node; diff --git a/gcc/ada/sem_ch13.adb b/gcc/ada/sem_ch13.adb index 38be20c..a959e51 100644 --- a/gcc/ada/sem_ch13.adb +++ b/gcc/ada/sem_ch13.adb @@ -1606,6 +1606,17 @@ package body Sem_Ch13 is if Nkind (Parent (N)) = N_Compilation_Unit then Add_Global_Declaration (Aitem); + + -- If it is a subprogram body, add pragmas to list of + -- declarations in body. + + elsif Nkind (N) = N_Subprogram_Body then + if No (Declarations (N)) then + Set_Declarations (N, New_List); + end if; + + Append (Aitem, Declarations (N)); + else Insert_After (N, Aitem); end if; diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb index 451873a..2308234 100644 --- a/gcc/ada/sem_ch3.adb +++ b/gcc/ada/sem_ch3.adb @@ -13633,7 +13633,7 @@ package body Sem_Ch3 is Alias_Subp : Entity_Id; Act_List : Elist_Id; - Act_Elmt : Elmt_Id := No_Elmt; + Act_Elmt : Elmt_Id; Act_Subp : Entity_Id := Empty; Elmt : Elmt_Id; Need_Search : Boolean := False; @@ -13656,6 +13656,9 @@ package body Sem_Ch3 is if Present (Generic_Actual) then Act_List := Collect_Primitive_Operations (Generic_Actual); Act_Elmt := First_Elmt (Act_List); + else + Act_List := No_Elist; + Act_Elmt := No_Elmt; end if; -- Derive primitives inherited from the parent. Note that if the generic @@ -13850,15 +13853,17 @@ package body Sem_Ch3 is pragma Assert (Is_Generic_Unit (Scope (Find_Dispatching_Type (Alias_Subp))) - or else - Instantiation_Depth - (Sloc (Find_Dispatching_Type (Alias_Subp))) > 0); + or else + Instantiation_Depth + (Sloc (Find_Dispatching_Type (Alias_Subp))) > 0); declare Iface_Prim_Loc : constant Source_Ptr := Original_Location (Sloc (Alias_Subp)); - Elmt : Elmt_Id; - Prim : Entity_Id; + + Elmt : Elmt_Id; + Prim : Entity_Id; + begin Elmt := First_Elmt (Primitive_Operations (Generic_Actual)); @@ -13868,8 +13873,8 @@ package body Sem_Ch3 is if Present (Interface_Alias (Prim)) and then Original_Location - (Sloc (Interface_Alias (Prim))) - = Iface_Prim_Loc + (Sloc (Interface_Alias (Prim))) = + Iface_Prim_Loc then Act_Subp := Alias (Prim); exit Search; diff --git a/gcc/ada/tracebak.c b/gcc/ada/tracebak.c index 01b9654..2c8335d 100644 --- a/gcc/ada/tracebak.c +++ b/gcc/ada/tracebak.c @@ -287,10 +287,9 @@ __gnat_backtrace (void **array, #error Unhandled darwin architecture. #endif -/*---------------------- PPC AIX/PPC Lynx 178/Older Darwin ------------------*/ +/*------------------------ PPC AIX/Older Darwin -------------------------*/ #elif ((defined (_POWER) && defined (_AIX)) || \ - (defined (__powerpc__) && defined (__Lynx__) && !defined(__ELF__)) || \ - (defined (__ppc__) && defined (__APPLE__))) +(defined (__ppc__) && defined (__APPLE__))) #define USE_GENERIC_UNWINDER @@ -308,23 +307,9 @@ struct layout should to feature a null backchain, AIX might expose a null return address instead. */ -/* Then LynxOS-178 features yet another variation, with return_address - == &__start, which we only add conditionally as this symbol is not - necessarily present elsewhere. Beware that &bla returns the - address of a descriptor when "bla" is a function. Getting the code - address requires an extra dereference. */ - -#if defined (__Lynx__) -extern void __start(); -#define EXTRA_STOP_CONDITION(CURRENT) ((CURRENT)->return_address == *(void**)&__start) -#else -#define EXTRA_STOP_CONDITION(CURRENT) (0) -#endif - #define STOP_FRAME(CURRENT, TOP_STACK) \ (((void *) (CURRENT) < (TOP_STACK)) \ - || (CURRENT)->return_address == NULL \ - || EXTRA_STOP_CONDITION(CURRENT)) + || (CURRENT)->return_address == NULL) /* The PPC ABI has an interesting specificity: the return address saved by a function is located in it's caller's frame, and the save operation only -- cgit v1.1