sem_prag.adb (Process_Convention): A dispatching call cannot have a stdcall calling...
authorPascal Obry <obry@adacore.com>
Mon, 21 Nov 2011 11:38:35 +0000 (11:38 +0000)
committerArnaud Charlet <charlet@gcc.gnu.org>
Mon, 21 Nov 2011 11:38:35 +0000 (12:38 +0100)
2011-11-21  Pascal Obry  <obry@adacore.com>

* sem_prag.adb (Process_Convention): A dispatching call cannot
have a stdcall calling convention.

2011-11-21  Pascal Obry  <obry@adacore.com>

* s-taprop-linux.adb (Initialize_Lock): Do not allocate a
mutex attribute as not needed.
(Initialize_TCB): Likewise.
(Initialize): Likewise.

From-SVN: r181564

gcc/ada/ChangeLog
gcc/ada/s-taprop-linux.adb
gcc/ada/sem_prag.adb

index a9c682b99728250fbf8a8444fccb0fa2d1aec61e..c0efe1b004390345177aa93c225797a70cf3cbb1 100644 (file)
@@ -1,3 +1,15 @@
+2011-11-21  Pascal Obry  <obry@adacore.com>
+
+       * sem_prag.adb (Process_Convention): A dispatching call cannot
+       have a stdcall calling convention.
+
+2011-11-21  Pascal Obry  <obry@adacore.com>
+
+       * s-taprop-linux.adb (Initialize_Lock): Do not allocate a
+       mutex attribute as not needed.
+       (Initialize_TCB): Likewise.
+       (Initialize): Likewise.
+
 2011-11-21  Robert Dewar  <dewar@adacore.com>
 
        * sem_ch6.adb (Is_Public_Subprogram_For): New procedure
index c63d5531b622466fffc13a86518964b559e74b9a..70f2d143545142d38f377aae0bb8582f5f3b5d44 100644 (file)
@@ -291,14 +291,10 @@ package body System.Task_Primitives.Operations is
 
       else
          declare
-            Mutex_Attr : aliased pthread_mutexattr_t;
-            Result     : Interfaces.C.int;
+            Result : Interfaces.C.int;
 
          begin
-            Result := pthread_mutexattr_init (Mutex_Attr'Access);
-            pragma Assert (Result = 0);
-
-            Result := pthread_mutex_init (L.WO'Access, Mutex_Attr'Access);
+            Result := pthread_mutex_init (L.WO'Access, null);
 
             pragma Assert (Result = 0 or else Result = ENOMEM);
 
@@ -315,14 +311,10 @@ package body System.Task_Primitives.Operations is
    is
       pragma Unreferenced (Level);
 
-      Mutex_Attr : aliased pthread_mutexattr_t;
-      Result     : Interfaces.C.int;
+      Result : Interfaces.C.int;
 
    begin
-      Result := pthread_mutexattr_init (Mutex_Attr'Access);
-      pragma Assert (Result = 0);
-
-      Result := pthread_mutex_init (L, Mutex_Attr'Access);
+      Result := pthread_mutex_init (L, null);
 
       pragma Assert (Result = 0 or else Result = ENOMEM);
 
@@ -817,9 +809,8 @@ package body System.Task_Primitives.Operations is
    --------------------
 
    procedure Initialize_TCB (Self_ID : Task_Id; Succeeded : out Boolean) is
-      Mutex_Attr : aliased pthread_mutexattr_t;
-      Cond_Attr  : aliased pthread_condattr_t;
-      Result     : Interfaces.C.int;
+      Cond_Attr : aliased pthread_condattr_t;
+      Result    : Interfaces.C.int;
 
    begin
       --  Give the task a unique serial number
@@ -831,11 +822,8 @@ package body System.Task_Primitives.Operations is
       Self_ID.Common.LL.Thread := Null_Thread_Id;
 
       if not Single_Lock then
-         Result := pthread_mutexattr_init (Mutex_Attr'Access);
-         pragma Assert (Result = 0);
-
          Result :=
-           pthread_mutex_init (Self_ID.Common.LL.L'Access, Mutex_Attr'Access);
+           pthread_mutex_init (Self_ID.Common.LL.L'Access, null);
          pragma Assert (Result = 0 or else Result = ENOMEM);
 
          if Result /= 0 then
@@ -1081,9 +1069,8 @@ package body System.Task_Primitives.Operations is
    ----------------
 
    procedure Initialize (S : in out Suspension_Object) is
-      Mutex_Attr : aliased pthread_mutexattr_t;
-      Cond_Attr  : aliased pthread_condattr_t;
-      Result     : Interfaces.C.int;
+      Cond_Attr : aliased pthread_condattr_t;
+      Result    : Interfaces.C.int;
 
    begin
       --  Initialize internal state (always to False (RM D.10(6)))
@@ -1093,10 +1080,7 @@ package body System.Task_Primitives.Operations is
 
       --  Initialize internal mutex
 
-      Result := pthread_mutexattr_init (Mutex_Attr'Access);
-      pragma Assert (Result = 0);
-
-      Result := pthread_mutex_init (S.L'Access, Mutex_Attr'Access);
+      Result := pthread_mutex_init (S.L'Access, null);
 
       pragma Assert (Result = 0 or else Result = ENOMEM);
 
index 148c6dee6593b539943930b5cb8903cde7e31ce4..9ba21291b856098ea1a4a63fbf92e146c8251a68 100644 (file)
@@ -3527,8 +3527,9 @@ package body Sem_Prag is
          --  For Stdcall, a subprogram, variable or subprogram type is required
 
          if C = Convention_Stdcall
-           and then not Is_Subprogram (E)
-           and then not Is_Generic_Subprogram (E)
+           and then
+             ((not Is_Subprogram (E) and then not Is_Generic_Subprogram (E))
+                or else Is_Dispatching_Operation (E))
            and then Ekind (E) /= E_Variable
            and then not
              (Is_Access_Type (E)