From 79904ebc48b0103c5a11dcfb76ee7c37399a213a Mon Sep 17 00:00:00 2001 From: Arnaud Charlet Date: Fri, 10 Oct 2014 15:57:55 +0200 Subject: [PATCH] [multiple changes] 2014-10-10 Gary Dismukes * a-coinho-shared.adb: Minor typo fix. * prj-env.ads: Minor reformatting. 2014-10-10 Hristian Kirtchev * sem_res.adb (Resolve_String_Literal): Do not generate a string literal subtype for the default expression of a formal parameter in GNATprove mode. 2014-10-10 Yannick Moy * errout.adb (SPARK_Msg_N): Issue error unless SPARK_Mode is Off. 2014-10-10 Ed Schonberg * exp_ch5.adb (Expand_Formal_Container_Element_Loop): Analyze declaration for loop parameter before rest of loop, and set entity kind to prevent assignments to it in the user code. * sem_ch3.adb (Analyze_Object_Contract): No contracts apply to the loop parameter in an element iteration over o formal container. 2014-10-10 Robert Dewar * gnat_ugn.texi: Document use of user-level routines to handle e.g. col major arrays. 2014-10-10 Doug Rupp * s-osinte-android.adb: Fix misspelling. * gsocket.h: Tweak the Android quirks. 2014-10-10 Robert Dewar * errout.ads (SPARK_Msg_N): Fix spec to match change in body. From-SVN: r216083 --- gcc/ada/ChangeLog | 37 ++++++++++++++++++++++++++++++++++++ gcc/ada/a-coinho-shared.adb | 2 +- gcc/ada/errout.adb | 2 +- gcc/ada/errout.ads | 5 +++-- gcc/ada/exp_ch5.adb | 12 +++++++++++- gcc/ada/gnat_ugn.texi | 8 ++++++++ gcc/ada/gsocket.h | 10 +++++++--- gcc/ada/prj-env.ads | 10 +++++----- gcc/ada/s-osinte-android.adb | 2 +- gcc/ada/sem_ch3.adb | 6 ++++++ gcc/ada/sem_res.adb | 11 +++++++++++ 11 files changed, 91 insertions(+), 14 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index c7df2c19c7d..b62069f464b 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,40 @@ +2014-10-10 Gary Dismukes + + * a-coinho-shared.adb: Minor typo fix. + * prj-env.ads: Minor reformatting. + +2014-10-10 Hristian Kirtchev + + * sem_res.adb (Resolve_String_Literal): Do not + generate a string literal subtype for the default expression of + a formal parameter in GNATprove mode. + +2014-10-10 Yannick Moy + + * errout.adb (SPARK_Msg_N): Issue error unless SPARK_Mode is Off. + +2014-10-10 Ed Schonberg + + * exp_ch5.adb (Expand_Formal_Container_Element_Loop): Analyze + declaration for loop parameter before rest of loop, and set + entity kind to prevent assignments to it in the user code. + * sem_ch3.adb (Analyze_Object_Contract): No contracts apply to the + loop parameter in an element iteration over o formal container. + +2014-10-10 Robert Dewar + + * gnat_ugn.texi: Document use of user-level routines to handle + e.g. col major arrays. + +2014-10-10 Doug Rupp + + * s-osinte-android.adb: Fix misspelling. + * gsocket.h: Tweak the Android quirks. + +2014-10-10 Robert Dewar + + * errout.ads (SPARK_Msg_N): Fix spec to match change in body. + 2014-10-10 Robert Dewar * sem_ch13.adb: Minor code reorganization. diff --git a/gcc/ada/a-coinho-shared.adb b/gcc/ada/a-coinho-shared.adb index 94d4fe4249f..cf9d1ccaa23 100644 --- a/gcc/ada/a-coinho-shared.adb +++ b/gcc/ada/a-coinho-shared.adb @@ -26,7 +26,7 @@ ------------------------------------------------------------------------------ -- Note: special attention must be paid to the case of simultaneous access --- to internal shared objects and elements by difference tasks. The Reference +-- to internal shared objects and elements by different tasks. The Reference -- counter of internal shared object is the only component protected using -- atomic operations; other components and elements can be modified only when -- reference counter is equal to one (so there are no other references to this diff --git a/gcc/ada/errout.adb b/gcc/ada/errout.adb index 55b02eeaab9..78ca1fe2fc4 100644 --- a/gcc/ada/errout.adb +++ b/gcc/ada/errout.adb @@ -3138,7 +3138,7 @@ package body Errout is procedure SPARK_Msg_N (Msg : String; N : Node_Or_Entity_Id) is begin - if SPARK_Mode = On then + if SPARK_Mode /= Off then Error_Msg_N (Msg, N); end if; end SPARK_Msg_N; diff --git a/gcc/ada/errout.ads b/gcc/ada/errout.ads index eaed2aa4cba..92642daacd4 100644 --- a/gcc/ada/errout.ads +++ b/gcc/ada/errout.ads @@ -868,8 +868,8 @@ package Errout is procedure SPARK_Msg_N (Msg : String; N : Node_Or_Entity_Id); pragma Inline (SPARK_Msg_N); - -- Same as Error_Msg_N, but the error is reported only when SPARK_Mode is - -- "on". The routine is inlined because it acts as a simple wrapper. + -- Same as Error_Msg_N, but the error is suppressed if SPARK_Mode is Off. + -- The routine is inlined because it acts as a simple wrapper. procedure SPARK_Msg_NE (Msg : String; @@ -878,6 +878,7 @@ package Errout is pragma Inline (SPARK_Msg_NE); -- Same as Error_Msg_NE, but the error is reported only when SPARK_Mode is -- "on". The routine is inlined because it acts as a simple wrapper. + -- Is it right that this is so different from SPARK_Msg_N??? ------------------------------------ -- Utility Interface for Back End -- diff --git a/gcc/ada/exp_ch5.adb b/gcc/ada/exp_ch5.adb index b39145c7daa..b414d54ae76 100644 --- a/gcc/ada/exp_ch5.adb +++ b/gcc/ada/exp_ch5.adb @@ -2889,7 +2889,17 @@ package body Exp_Ch5 is Statements => New_List (New_Loop))); Rewrite (N, New_Loop); - Analyze (New_Loop); + + -- The loop parameter is declared by an object declaration, but within + -- the loop we must prevent user assignments to it, so we analyze the + -- declaration and reset the entity kind, before analyzing the rest of + -- the loop; + + Analyze (Elmt_Decl); + Set_Ekind (Defining_Identifier (Elmt_Decl), E_Loop_Parameter); + Set_Assignment_OK (Name (Elmt_Ref)); + + Analyze (N); end Expand_Formal_Container_Element_Loop; ----------------------------- diff --git a/gcc/ada/gnat_ugn.texi b/gcc/ada/gnat_ugn.texi index 913330d7370..e58a2a90a61 100644 --- a/gcc/ada/gnat_ugn.texi +++ b/gcc/ada/gnat_ugn.texi @@ -20865,6 +20865,14 @@ that denote descendant nodes and parent node, as well as varied semantic information. To study this example in more detail, you might want to look at the body of the PN procedure in the stated file. +Another useful application of this capability is to deal with situations of +complex data which are not handled suitably by GDB. For example, if you specify +Convention Fortran for a multi-dimensional array, GDB does not know that +the ordering of array elements has been switched and will not properly +address the array elements. In such a case, instead of trying to print the +elements directly from GDB, you can write a callable procedure that prints +the elements in the desired format. + @node Using the Next Command in a Function @section Using the Next Command in a Function diff --git a/gcc/ada/gsocket.h b/gcc/ada/gsocket.h index 2034137b2b6..4f9448b37b3 100644 --- a/gcc/ada/gsocket.h +++ b/gcc/ada/gsocket.h @@ -29,8 +29,7 @@ * * ****************************************************************************/ -#if defined(__nucleus__) || defined(VTHREADS) || defined(__ANDROID__) \ - || defined(__PikeOS__) +#if defined(__nucleus__) || defined(VTHREADS) || defined(__PikeOS__) /* Sockets not supported on these platforms. */ #undef HAVE_SOCKETS @@ -204,8 +203,13 @@ #include #endif +#ifdef __ANDROID__ +#include +#include +#endif + #if defined (_AIX) || defined (__FreeBSD__) || defined (__hpux__) || \ - defined (_WIN32) || defined (__APPLE__) + defined (_WIN32) || defined (__APPLE__) || defined (__ANDROID__) # define HAVE_THREAD_SAFE_GETxxxBYyyy 1 #elif defined (linux) || defined (__GLIBC__) || \ diff --git a/gcc/ada/prj-env.ads b/gcc/ada/prj-env.ads index 21239b43ee8..043723b6b6b 100644 --- a/gcc/ada/prj-env.ads +++ b/gcc/ada/prj-env.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 2001-2013, Free Software Foundation, Inc. -- +-- Copyright (C) 2001-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- -- @@ -243,10 +243,10 @@ package Prj.Env is function Get_Runtime_Path (Self : Project_Search_Path; Name : String) return String_Access; - -- Compute the full path for the project-based runtime name. It first - -- checks that name is not a simple name (must has a path separator in it), - -- and returns null in case of failure. This check might be removed in the - -- future. The name is simply searched on the project path. + -- Compute the full path for the project-based runtime name. It first + -- checks that Name is not a simple file name (must have a path separator + -- in it), and returns null in case of failure. This check might be removed + -- in the future. Name is simply searched on the project path. private package Projects_Paths is new GNAT.Dynamic_HTables.Simple_HTable diff --git a/gcc/ada/s-osinte-android.adb b/gcc/ada/s-osinte-android.adb index df5e19125ec..3b89e777a17 100644 --- a/gcc/ada/s-osinte-android.adb +++ b/gcc/ada/s-osinte-android.adb @@ -39,7 +39,7 @@ pragma Polling (Off); -- that are needed by children of System. with Interfaces.C; use Interfaces.C; -with Interfaces.C.Extentions; use Interfaces.C.Extentions; +with Interfaces.C.Extensions; use Interfaces.C.Extensions; package body System.OS_Interface is diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb index dd71672d39b..3448e515189 100644 --- a/gcc/ada/sem_ch3.adb +++ b/gcc/ada/sem_ch3.adb @@ -3062,6 +3062,12 @@ package body Sem_Ch3 is Error_Msg_N ("constant cannot be volatile", Obj_Id); end if; + -- The loop parameter in an element iterator over a formal container + -- is declared with an object declaration but no contracts apply. + + elsif Ekind (Obj_Id) = E_Loop_Parameter then + null; + else pragma Assert (Ekind (Obj_Id) = E_Variable); -- The following checks are only relevant when SPARK_Mode is on as diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb index b35ffbd8626..eacb977344f 100644 --- a/gcc/ada/sem_res.adb +++ b/gcc/ada/sem_res.adb @@ -9947,6 +9947,17 @@ package body Sem_Res is then Subtype_Id := Typ; + -- Do not generate a string literal subtype for the default expression + -- of a formal parameter in GNATprove mode. This is because the string + -- subtype is associated with the freezing actions of the subprogram, + -- however freezing is disabled in GNATprove mode and as a result the + -- subtype is unavailable. + + elsif GNATprove_Mode + and then Nkind (Parent (N)) = N_Parameter_Specification + then + Subtype_Id := Typ; + -- Otherwise we must create a string literal subtype. Note that the -- whole idea of string literal subtypes is simply to avoid the need -- for building a full fledged array subtype for each literal. -- 2.30.2