aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2011-11-21 11:40:32 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2011-11-21 11:40:32 +0000
commit71e2a248ebee32870f49d4e7d9fb6d39f395f283 (patch)
tree472c0a6c566ce139de8f0a3714aec19afce4a8bc
parent18a02da27833f2e2b4150ad67377daae106602ad (diff)
2011-11-21 Pascal Obry <obry@adacore.com>
* s-taprop-linux.adb (Initialize_Lock): Do not allocate a cond attribute as not needed. 2011-11-21 Robert Dewar <dewar@adacore.com> * sem_prag.adb: Minor reformatting. 2011-11-21 Pascal Obry <obry@adacore.com> * gnat_rm.texi: Document restriction for stdcall convention on dispatching calls. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@181565 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ada/ChangeLog14
-rw-r--r--gcc/ada/gnat_rm.texi3
-rw-r--r--gcc/ada/s-taprop-linux.adb8
-rw-r--r--gcc/ada/sem_prag.adb14
4 files changed, 31 insertions, 8 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index c0efe1b0043..4ba28bdbdef 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,5 +1,19 @@
2011-11-21 Pascal Obry <obry@adacore.com>
+ * s-taprop-linux.adb (Initialize_Lock): Do not allocate a cond
+ attribute as not needed.
+
+2011-11-21 Robert Dewar <dewar@adacore.com>
+
+ * sem_prag.adb: Minor reformatting.
+
+2011-11-21 Pascal Obry <obry@adacore.com>
+
+ * gnat_rm.texi: Document restriction for stdcall convention on
+ dispatching calls.
+
+2011-11-21 Pascal Obry <obry@adacore.com>
+
* sem_prag.adb (Process_Convention): A dispatching call cannot
have a stdcall calling convention.
diff --git a/gcc/ada/gnat_rm.texi b/gcc/ada/gnat_rm.texi
index 2d342c347bc..00e0543e3d8 100644
--- a/gcc/ada/gnat_rm.texi
+++ b/gcc/ada/gnat_rm.texi
@@ -9633,7 +9633,8 @@ separate section on Intrinsic Subprograms.
@item Stdcall
Stdcall (used for Windows implementations only). This convention correspond
to the WINAPI (previously called Pascal convention) C/C++ convention under
-Windows. A function with this convention cleans the stack before exit.
+Windows. A routine with this convention cleans the stack before
+exit. This pragma cannot be applied to a dispatching call.
@item DLL
Synonym for Stdcall
@item Win32
diff --git a/gcc/ada/s-taprop-linux.adb b/gcc/ada/s-taprop-linux.adb
index 70f2d143545..6773aaa1a54 100644
--- a/gcc/ada/s-taprop-linux.adb
+++ b/gcc/ada/s-taprop-linux.adb
@@ -1069,8 +1069,7 @@ package body System.Task_Primitives.Operations is
----------------
procedure Initialize (S : in out Suspension_Object) is
- Cond_Attr : aliased pthread_condattr_t;
- Result : Interfaces.C.int;
+ Result : Interfaces.C.int;
begin
-- Initialize internal state (always to False (RM D.10(6)))
@@ -1090,10 +1089,7 @@ package body System.Task_Primitives.Operations is
-- Initialize internal condition variable
- Result := pthread_condattr_init (Cond_Attr'Access);
- pragma Assert (Result = 0);
-
- Result := pthread_cond_init (S.CV'Access, Cond_Attr'Access);
+ Result := pthread_cond_init (S.CV'Access, null);
pragma Assert (Result = 0 or else Result = ENOMEM);
diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb
index 9ba21291b85..5211d88815d 100644
--- a/gcc/ada/sem_prag.adb
+++ b/gcc/ada/sem_prag.adb
@@ -3524,13 +3524,25 @@ package body Sem_Prag is
("second argument of pragma% must be a subprogram", Arg2);
end if;
- -- For Stdcall, a subprogram, variable or subprogram type is required
+ -- Stdcall case
if C = Convention_Stdcall
+
+ -- Subprogram is allowed, but not a generic subprogram, and not a
+ -- dispatching operation. A dispatching subprogram cannot be used
+ -- to interface to the Win32 API, so in fact this check does not
+ -- impose any effective restriction.
+
and then
((not Is_Subprogram (E) and then not Is_Generic_Subprogram (E))
or else Is_Dispatching_Operation (E))
+
+ -- A variable is OK
+
and then Ekind (E) /= E_Variable
+
+ -- An access to subprogram is also allowed
+
and then not
(Is_Access_Type (E)
and then Ekind (Designated_Type (E)) = E_Subprogram_Type)