This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Ada] pragma Thread_Local_Storage first stage of implementation


This patch implements the front end changes for the new pragma
Thread_Local_Storage. The flag Has_Pragma_Thread_Local_Storage
is set in corresponding entities, and appropriate error checks
for bad initialization are added.

The following should compile clean:

package tls_ok is
   type R is access Integer;
   RV : R := null;
   pragma Thread_Local_Storage (RV);
   MV : Integer;
   pragma Thread_Local_Storage (Entity => MV);
   MMV : Float := 1.25;
   pragma Thread_Local_Storage (MMV);
end tls_ok;

and -gnatdt generates a log file containing the following
three references from a grep:

      |  Has_Pragma_Thread_Local_Storage = True
      |  Has_Pragma_Thread_Local_Storage = True
      |  Has_Pragma_Thread_Local_Storage = True

The following has errors diagnosed as shown

Compiling: tls_nok.ads

     1. package tls_nok is
     2.    type R is access Integer;
     3.    RV : R;
           |
        >>> Thread_Local_Storage variable "RV" is improperly initialized
        >>> only allowed initialization is explicit "null" or static expression

     4.    pragma Thread_Local_Storage (RV);
     5.    MV : constant Integer := 3;
     6.    pragma Thread_Local_Storage (Entity => MV);
                                                  |
        >>> local variable name required

     7.    FC : Float := 1.25;
     8.    MMV : Float := FC;
           |
        >>> Thread_Local_Storage variable "MMV" is improperly initialized
        >>> only allowed initialization is explicit "null" or static expression

     9.    pragma Thread_Local_Storage (MMV);
    10. end tls_nok;

Tested on x86_64-pc-linux-gnu, committed on trunk

2009-04-08  Robert Dewar  <dewar@adacore.com>

	* snames.h, einfo.adb, einfo.ads, sem_prag.adb, snames.adb,
	snames.ads, freeze.adb, par-prag.adb: Add implementation of
	pragma Thread_Local_Storage, setting new flag
	Has_Pragma_Thread_Local_Storage in corresponding entities.

Attachment: difs
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]