+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
@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
----------------
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)))
-- 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);
("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)