OSDN Git Service

2009-04-08 Robert Dewar <dewar@adacore.com>
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 8 Apr 2009 13:54:32 +0000 (13:54 +0000)
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 8 Apr 2009 13:54:32 +0000 (13:54 +0000)
* gnat_rm.texi: Add documentation for pragma Thread_Local_Storage

* sem_ch3.adb: Minor comment updates

2009-04-08  Ed Schonberg  <schonberg@adacore.com>

* inline.adb (Back_End_Cannot_Inline): restrict warning to subprograms
that come from source.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@145732 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ada/ChangeLog
gcc/ada/gnat_rm.texi
gcc/ada/inline.adb
gcc/ada/sem_ch3.adb

index c73aa0a..b6d0aca 100644 (file)
@@ -1,3 +1,14 @@
+2009-04-08  Robert Dewar  <dewar@adacore.com>
+
+       * gnat_rm.texi: Add documentation for pragma Thread_Local_Storage
+
+       * sem_ch3.adb: Minor comment updates
+
+2009-04-08  Ed Schonberg  <schonberg@adacore.com>
+
+       * inline.adb (Back_End_Cannot_Inline): restrict warning to subprograms
+       that come from source.
+
 2009-04-08  Tristan Gingold  <gingold@adacore.com>
 
        * gcc-interface/utils.c, gcc-interface/decl.c, gcc-interface/gigi.h:
index 4d50a50..f72a0d1 100644 (file)
@@ -194,6 +194,7 @@ Implementation Defined Pragmas
 * Pragma Task_Info::
 * Pragma Task_Name::
 * Pragma Task_Storage::
+* Pragma Thread_Local_Storage::
 * Pragma Time_Slice::
 * Pragma Title::
 * Pragma Unchecked_Union::
@@ -683,8 +684,7 @@ compiler system.
 @noindent
 Ada defines a set of pragmas that can be used to supply additional
 information to the compiler.  These language defined pragmas are
-implemented in GNAT and work as described in the Ada Reference
-Manual.
+implemented in GNAT and work as described in the Ada Reference Manual.
 
 In addition, Ada allows implementations to define additional pragmas
 whose meaning is defined by the implementation.  GNAT provides a number
@@ -797,6 +797,7 @@ consideration, the use of these pragmas should be minimized.
 * Pragma Task_Info::
 * Pragma Task_Name::
 * Pragma Task_Storage::
+* Pragma Thread_Local_Storage::
 * Pragma Time_Slice::
 * Pragma Title::
 * Pragma Unchecked_Union::
@@ -4656,6 +4657,35 @@ created, depending on the target.  This pragma can appear anywhere a
 @code{Storage_Size} attribute definition clause is allowed for a task
 type.
 
+@node Pragma Thread_Local_Storage
+@unnumberedsec Pragma Thread_Local_Storage
+@findex Thread_Local_Storage
+@cindex Task specific storage
+@cindex TLS (Thread Local Storage)
+Syntax:
+
+@smallexample @c ada
+pragma Thread_Local_Storage ([Entity =>] LOCAL_NAME);
+@end smallexample
+
+@noindent
+This pragma specifies that the specified entity, which must be
+a variable declared in a library level package, is to be marked as
+"Thread Local Storage" (@code{TLS}). On systems supporting this (which
+include Solaris, GNU/Linux and VxWorks 6), this causes each thread
+(and hence each Ada task) to see a distinct copy of the variable.
+
+The variable may not have default initialization, and if there is
+an explicit initialization, it must be either @code{null} for an
+access variable, or a static expression for a scalar variable.
+This provides a low level mechanism similar to that provided by
+the @code{Ada.Task_Attributes} package, but much more efficient
+and is also useful in writing interface code that will interact
+with foreign threads.
+
+If this pragma is used on a system where @code{TLS} is not supported,
+then an error message will be generated and the program will be rejected.
+
 @node Pragma Time_Slice
 @unnumberedsec Pragma Time_Slice
 @findex Time_Slice
index 7cda5d5..4a9b1f6 100644 (file)
@@ -403,6 +403,7 @@ package body Inline is
               or else Nkind (N) = N_Function_Call
             then
                if Is_Entity_Name (Name (N))
+                 and then Comes_From_Source (Entity (Name (N)))
                  and then
                     Nkind (Unit_Declaration_Node (Entity (Name (N))))
                       = N_Subprogram_Body
index 97fbb81..106acec 100644 (file)
@@ -140,7 +140,7 @@ package body Sem_Ch3 is
       Derived_Type : Entity_Id);
    --  Subsidiary procedure to Build_Derived_Type. For a derived enumeration
    --  type, we must create a new list of literals. Types derived from
-   --  Character and Wide_Character are special-cased.
+   --  Character and [Wide_]Wide_Character are special-cased.
 
    procedure Build_Derived_Numeric_Type
      (N            : Node_Id;
@@ -4962,7 +4962,7 @@ package body Sem_Ch3 is
       Rang_Expr     : Node_Id;
 
    begin
-      --  Since types Standard.Character and Standard.Wide_Character do
+      --  Since types Standard.Character and Standard.[Wide_]Wide_Character do
       --  not have explicit literals lists we need to process types derived
       --  from them specially. This is handled by Derived_Standard_Character.
       --  If the parent type is a generic type, there are no literals either,