From 4b03d946237dd6a6953dd1337043cd9eb8e7fbcb Mon Sep 17 00:00:00 2001 From: Arnaud Charlet Date: Fri, 18 Jul 2014 13:04:34 +0200 Subject: [PATCH] [multiple changes] 2014-07-18 Robert Dewar * exp_ch7.adb: Minor reformatting. 2014-07-18 Claire Dross * sem_aux.ads (Get_Binary_Nkind): New function that returns the Node_Kind value of an entity defining a binary operator. (Get_Unary_Nkind): New function that returns the Node_Kind value of an entity defining a unary operator. 2014-07-18 Pascal Obry * sysdep.c: comment update. * adaint.c (__gnat_fputwc): Use wchar_t on a limited set of platforms where it is known to be supported. 2014-07-18 Thomas Quinot * sem_dist.adb (Process_Remote_AST_Declaration): Need to set Fat_Type's Ekind in order to be able to use its Corresponding_Remote_Type attribute. From-SVN: r212815 --- gcc/ada/ChangeLog | 23 +++++++++++++++ gcc/ada/adaint.c | 14 ++++++--- gcc/ada/exp_ch7.adb | 6 ++-- gcc/ada/sem_aux.adb | 67 +++++++++++++++++++++++++++++++++++++++++++- gcc/ada/sem_aux.ads | 15 ++++++++++ gcc/ada/sem_dist.adb | 9 +++++- gcc/ada/sysdep.c | 4 +-- 7 files changed, 127 insertions(+), 11 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index ac04798710c..722aa7eeb71 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,26 @@ +2014-07-18 Robert Dewar + + * exp_ch7.adb: Minor reformatting. + +2014-07-18 Claire Dross + + * sem_aux.ads (Get_Binary_Nkind): New function that returns + the Node_Kind value of an entity defining a binary operator. + (Get_Unary_Nkind): New function that returns the Node_Kind value + of an entity defining a unary operator. + +2014-07-18 Pascal Obry + + * sysdep.c: comment update. + * adaint.c (__gnat_fputwc): Use wchar_t on a limited set of + platforms where it is known to be supported. + +2014-07-18 Thomas Quinot + + * sem_dist.adb (Process_Remote_AST_Declaration): Need + to set Fat_Type's Ekind in order to be able to use its + Corresponding_Remote_Type attribute. + 2014-07-18 Hristian Kirtchev * einfo.adb Last_Aggregate_Assignment is now Node 30. diff --git a/gcc/ada/adaint.c b/gcc/ada/adaint.c index 84c67f58fea..81b2d147521 100644 --- a/gcc/ada/adaint.c +++ b/gcc/ada/adaint.c @@ -229,9 +229,6 @@ extern unsigned int LIB$CALLG_64 (unsigned long long argument_list [], #else #include -#if ! defined (__vxworks) -#include -#endif #endif #if defined (_WIN32) @@ -854,10 +851,19 @@ __gnat_rmdir (char *path) #endif } +#if defined (_WIN32) || defined (linux) || defined (sun) \ + || defined (__FreeBSD__) +#define HAS_TARGET_WCHAR_T +#endif + +#ifdef HAS_TARGET_WCHAR_T +#include +#endif + int __gnat_fputwc(int c, FILE *stream) { -#if ! defined (__vxworks) +#ifdef HAS_TARGET_WCHAR_T return fputwc ((wchar_t)c, stream); #else return fputc (c, stream); diff --git a/gcc/ada/exp_ch7.adb b/gcc/ada/exp_ch7.adb index c6bec4b1fa8..748279b60b6 100644 --- a/gcc/ada/exp_ch7.adb +++ b/gcc/ada/exp_ch7.adb @@ -2610,7 +2610,7 @@ package body Exp_Ch7 is Label_Construct => Label)); -- Create the associated jump with this object, generate: - -- + -- when => -- goto L; @@ -2623,7 +2623,7 @@ package body Exp_Ch7 is Name => New_Occurrence_Of (Entity (Label_Id), Loc))))); -- Insert the jump destination, generate: - -- + -- <>> Append_To (Finalizer_Stmts, Label); @@ -2742,7 +2742,7 @@ package body Exp_Ch7 is -- Free (Ptr_Typ (Temp)); -- end; -- end if; - -- + -- The generated code effectively detaches the temporary from the -- caller finalization master and deallocates the object. This is -- disabled on .NET/JVM because pools are not supported. diff --git a/gcc/ada/sem_aux.adb b/gcc/ada/sem_aux.adb index 3f9522152b6..0344637dccc 100644 --- a/gcc/ada/sem_aux.adb +++ b/gcc/ada/sem_aux.adb @@ -32,7 +32,6 @@ with Atree; use Atree; with Einfo; use Einfo; -with Sinfo; use Sinfo; with Snames; use Snames; with Stand; use Stand; with Uintp; use Uintp; @@ -435,6 +434,52 @@ package body Sem_Aux is return Empty; end First_Tag_Component; + --------------------- + -- Get_Binary_Nkind -- + --------------------- + + function Get_Binary_Nkind (Op : Entity_Id) return Node_Kind is + Name : constant String := Get_Name_String (Chars (Op)); + begin + if Name = "Oadd" then + return N_Op_Add; + elsif Name = "Oconcat" then + return N_Op_Concat; + elsif Name = "Oexpon" then + return N_Op_Expon; + elsif Name = "Osubtract" then + return N_Op_Subtract; + elsif Name = "Omod" then + return N_Op_Mod; + elsif Name = "Omultiply" then + return N_Op_Multiply; + elsif Name = "Odivide" then + return N_Op_Divide; + elsif Name = "Orem" then + return N_Op_Rem; + elsif Name = "Oand" then + return N_Op_And; + elsif Name = "Oeq" then + return N_Op_Eq; + elsif Name = "Oge" then + return N_Op_Ge; + elsif Name = "Ogt" then + return N_Op_Gt; + elsif Name = "Ole" then + return N_Op_Le; + elsif Name = "Olt" then + return N_Op_Lt; + elsif Name = "One" then + return N_Op_Ne; + elsif Name = "Oxor" then + return N_Op_Or; + elsif Name = "Oor" then + return N_Op_Xor; + else + raise Program_Error; + end if; + end Get_Binary_Nkind; + ------------------ -- Get_Rep_Item -- ------------------ @@ -602,6 +647,26 @@ package body Sem_Aux is return Empty; end Get_Rep_Pragma; + --------------------- + -- Get_Unary_Nkind -- + --------------------- + + function Get_Unary_Nkind (Op : Entity_Id) return Node_Kind is + Name : constant String := Get_Name_String (Chars (Op)); + begin + if Name = "Oabs" then + return N_Op_Abs; + elsif Name = "Osubtract" then + return N_Op_Minus; + elsif Name = "Onot" then + return N_Op_Not; + elsif Name = "Oadd" then + return N_Op_Plus; + else + raise Program_Error; + end if; + end Get_Unary_Nkind; + --------------------------------- -- Has_External_Tag_Rep_Clause -- --------------------------------- diff --git a/gcc/ada/sem_aux.ads b/gcc/ada/sem_aux.ads index 1fb9068213d..4eaf1bfb3ce 100644 --- a/gcc/ada/sem_aux.ads +++ b/gcc/ada/sem_aux.ads @@ -42,6 +42,7 @@ with Alloc; use Alloc; with Namet; use Namet; with Table; with Types; use Types; +with Sinfo; use Sinfo; package Sem_Aux is @@ -384,4 +385,18 @@ package Sem_Aux is -- Given an entity for a package or generic package, return corresponding -- package specification. Simplifies handling of child units, and better -- than the old idiom: Specification (Unit_Declaration_Node (Pack_Id)). + + function Get_Binary_Nkind (Op : Entity_Id) return Node_Kind; + -- Op must be an entity with an Ekind of E_Operator. + -- This function returns the Nkind value that would + -- be used to construct a binary operator node referencing + -- this entity. It is an error to call this function + -- if Ekind (Op) /= E_Operator. + + function Get_Unary_Nkind (Op : Entity_Id) return Node_Kind; + -- Op must be an entity with an Ekind of E_Operator. + -- This function returns the Nkind value that would + -- be used to construct a unary operator node referencing + -- this entity. It is an error to call this function + -- if Ekind (Op) /= E_Operator. end Sem_Aux; diff --git a/gcc/ada/sem_dist.adb b/gcc/ada/sem_dist.adb index f3d3e33ff77..5bb273bab2a 100644 --- a/gcc/ada/sem_dist.adb +++ b/gcc/ada/sem_dist.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2012, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2014, 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- -- @@ -647,7 +647,14 @@ package body Sem_Dist is New_Occurrence_Of (RACW_Type, Loc))))))); Set_Equivalent_Type (User_Type, Fat_Type); + + -- Set Fat_Type's Etype early so that we can use its + -- Corresponding_Remote_Type attribute, whose presence indicates that + -- this is the record type used to implement a RAS. + + Set_Ekind (Fat_Type, E_Record_Type); Set_Corresponding_Remote_Type (Fat_Type, User_Type); + Insert_After_And_Analyze (Subpkg_Body, Fat_Type_Decl); -- The reason we suppress the initialization procedure is that we know diff --git a/gcc/ada/sysdep.c b/gcc/ada/sysdep.c index e2187e74720..207ef60919e 100644 --- a/gcc/ada/sysdep.c +++ b/gcc/ada/sysdep.c @@ -105,11 +105,11 @@ extern struct tm *localtime_r(const time_t *, struct tm *); end-of-file. The other target dependent declarations here are for the three functions - __gnat_set_binary_mode, __gnat_set_text_mode and __gnat_set_wide_text_mode: + __gnat_set_binary_mode, __gnat_set_text_mode and __gnat_set_mode: void __gnat_set_binary_mode (int handle); void __gnat_set_text_mode (int handle); - void __gnat_set_wide_text_mode (int handle); + void __gnat_set_mode (int handle, int mode); These functions have no effect in Unix (or similar systems where there is no distinction between binary and text files), but in DOS (and similar