+2013-10-13 Thomas Quinot <quinot@adacore.com>
+
+ * scos.ads: Minor documentation clarification.
+
+2013-10-13 Thomas Quinot <quinot@adacore.com>
+
+ * s-oscons-tmplt.c (CLOCK_RT_Ada): Set to CLOCK_MONOTONIC when
+ building on AIX 5.3 or later, and to CLOCK_REALTIME on older
+ versions of AIX.
+ * init.c (pthread_condattr_setclock): Remove now useless weak symbol.
+ * thread.c(__gnat_pthread_condattr_setup): Remove bogus AIX 5.2
+ compatibility shim.
+ * s-osinte-aix.ads(clock_id_t): Fix C mapping (this is a 64-bit
+ type).
+ (clock_gettime): Import from C runtime library.
+ * s-osinte-aix.adb (clock_gettime): Remove bogus emulation body,
+ this routine is provided by the system in current supported
+ versions of AIX.
+
+2013-10-13 Robert Dewar <dewar@adacore.com>
+
+ * sem_ch3.adb: Minor reformatting.
+
+2013-10-13 Ed Schonberg <schonberg@adacore.com>
+
+ * freeze.adb (Freeze_Entity): For a function whose return type
+ is incomplete, do not replace the type with the full view if the
+ type is a limited view. In that case the full view appears in a
+ different unit, and the back-end will retrieve it at the proper
+ elaboration point.
+
+2013-10-13 Yannick Moy <moy@adacore.com>
+
+ * exp_spark.adb (Expand_SPARK_Call): Do not introduce temporaries for
+ actuals.
+
2013-10-13 Ed Schonberg <schonberg@adacore.com>
* sem_ch3.adb: in Ada 2012 access_to_function types can have
with Atree; use Atree;
with Einfo; use Einfo;
with Exp_Ch4; use Exp_Ch4;
-with Exp_Ch6; use Exp_Ch6;
with Exp_Dbug; use Exp_Dbug;
with Exp_Util; use Exp_Util;
with Sem_Aux; use Sem_Aux;
procedure Expand_SPARK_Call (N : Node_Id);
-- This procedure contains common processing for function and procedure
- -- calls:
- -- * expansion of actuals to introduce necessary temporaries
- -- * replacement of renaming by subprogram renamed
+ -- calls: replacement of renaming by subprogram renamed
procedure Expand_SPARK_N_Object_Renaming_Declaration (N : Node_Id);
-- Perform name evaluation for a renamed object
procedure Expand_SPARK_Call (N : Node_Id) is
Call_Node : constant Node_Id := N;
Parent_Subp : Entity_Id;
- Subp : Entity_Id;
begin
-- Ignore if previous error
-- Call using access to subprogram with explicit dereference
if Nkind (Name (Call_Node)) = N_Explicit_Dereference then
- Subp := Etype (Name (Call_Node));
Parent_Subp := Empty;
-- Case of call to simple entry, where the Name is a selected component
-- whose prefix is the task, and whose selector name is the entry name
elsif Nkind (Name (Call_Node)) = N_Selected_Component then
- Subp := Entity (Selector_Name (Name (Call_Node)));
Parent_Subp := Empty;
-- Case of call to member of entry family, where Name is an indexed
-- task and entry family name, and the index being the entry index.
elsif Nkind (Name (Call_Node)) = N_Indexed_Component then
- Subp := Entity (Selector_Name (Prefix (Name (Call_Node))));
Parent_Subp := Empty;
-- Normal case
else
- Subp := Entity (Name (Call_Node));
- Parent_Subp := Alias (Subp);
+ Parent_Subp := Alias (Entity (Name (Call_Node)));
end if;
- -- Various expansion activities for actuals are carried out
-
- Expand_Actuals (N, Subp);
-
-- If the subprogram is a renaming, replace it in the call with the name
-- of the actual subprogram being called.
if Is_Incomplete_Type (F_Type)
and then Present (Full_View (F_Type))
+ and then not From_With_Type (F_Type)
then
F_Type := Full_View (F_Type);
Set_Etype (Formal, F_Type);
R_Type := Etype (E);
-- AI05-0151: the return type may have been incomplete
- -- at the point of declaration.
+ -- at the point of declaration. Replace it with the full
+ -- view, unless the current type is a limited view. In
+ -- that case the full view is in a different unit, and
+ -- gigi finds the non-limited view after the other unit
+ -- is elaborated.
if Ekind (R_Type) = E_Incomplete_Type
and then Present (Full_View (R_Type))
+ and then not From_With_Type (R_Type)
then
R_Type := Full_View (R_Type);
Set_Etype (E, R_Type);
#endif /* _AIXVERSION_430 */
-/* Version of AIX before 5.3 don't have pthread_condattr_setclock:
- * supply it as a weak symbol here so that if linking on a 5.3 or newer
- * machine, we get the real one.
- */
-
-#ifndef _AIXVERSION_530
-#pragma weak pthread_condattr_setclock
-int
-pthread_condattr_setclock (pthread_condattr_t *attr, clockid_t cl) {
- return 0;
-}
-#endif
-
static void
__gnat_error_handler (int sig,
siginfo_t *si ATTRIBUTE_UNUSED,
#endif
CND(CLOCK_THREAD_CPUTIME_ID, "Thread CPU clock")
-
-#if defined(__FreeBSD__) || defined(_AIX)
+#if defined(__FreeBSD__) || (defined(_AIX) && defined(_AIXVERSION_530))
/** On these platforms use system provided monotonic clock instead of
- ** the default CLOCK_REALTIME. Note: We then need to set up cond var
- ** attributes appropriately (see thread.c).
+ ** the default CLOCK_REALTIME. We then need to set up cond var attributes
+ ** appropriately (see thread.c).
+ **
+ ** Note that AIX 5.2 does not support CLOCK_MONOTONIC timestamps for
+ ** pthread_cond_timedwait (and does not have pthread_condattr_setclock),
+ ** hence the conditionalization on AIX version above). _AIXVERSION_530
+ ** is defined in AIX 5.3 and more recent versions.
**/
# define CLOCK_RT_Ada "CLOCK_MONOTONIC"
-- --
-- B o d y --
-- --
--- Copyright (C) 1997-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1997-2013, Free Software Foundation, Inc. --
-- --
-- GNARL is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
tv_nsec => long (Long_Long_Integer (F * 10#1#E9)));
end To_Timespec;
- -------------------
- -- clock_gettime --
- -------------------
-
- function clock_gettime
- (clock_id : clockid_t;
- tp : access timespec)
- return int
- is
- pragma Unreferenced (clock_id);
-
- -- Older AIX don't have clock_gettime, so use gettimeofday
-
- use Interfaces;
-
- type timeval is array (1 .. 2) of C.long;
-
- procedure timeval_to_duration
- (T : not null access timeval;
- sec : not null access C.long;
- usec : not null access C.long);
- pragma Import (C, timeval_to_duration, "__gnat_timeval_to_duration");
-
- Micro : constant := 10**6;
- sec : aliased C.long;
- usec : aliased C.long;
- TV : aliased timeval;
- Result : int;
-
- function gettimeofday
- (Tv : access timeval;
- Tz : System.Address := System.Null_Address) return int;
- pragma Import (C, gettimeofday, "gettimeofday");
-
- begin
- Result := gettimeofday (TV'Access, System.Null_Address);
- pragma Assert (Result = 0);
- timeval_to_duration (TV'Access, sec'Access, usec'Access);
- tp.all := To_Timespec (Duration (sec) + Duration (usec) / Micro);
- return Result;
- end clock_gettime;
-
-----------------
-- sched_yield --
-----------------
-- S p e c --
-- --
-- Copyright (C) 1991-1994, Florida State University --
--- Copyright (C) 1995-2011, Free Software Foundation, Inc. --
+-- Copyright (C) 1995-2013, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
with Ada.Unchecked_Conversion;
with Interfaces.C;
+with Interfaces.C.Extensions;
package System.OS_Interface is
pragma Preelaborate;
subtype int is Interfaces.C.int;
subtype short is Interfaces.C.short;
subtype long is Interfaces.C.long;
+ subtype long_long is Interfaces.C.Extensions.long_long;
subtype unsigned is Interfaces.C.unsigned;
subtype unsigned_short is Interfaces.C.unsigned_short;
subtype unsigned_long is Interfaces.C.unsigned_long;
type timespec is private;
- type clockid_t is new int;
+ type clockid_t is new long_long;
function clock_gettime
(clock_id : clockid_t;
tp : access timespec) return int;
+ pragma Import (C, clock_gettime, "clock_gettime");
function To_Duration (TS : timespec) return Duration;
pragma Inline (To_Duration);
-- --
-- S p e c --
-- --
--- Copyright (C) 2009-2012, Free Software Foundation, Inc. --
+-- Copyright (C) 2009-2013, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
Last : Boolean := False;
Pragma_Sloc : Source_Ptr := No_Location;
- -- For the statement SCO for a pragma, or for any expression SCO nested
- -- in a pragma Debug/Assert/PPC, location of PRAGMA token (used for
- -- control of SCO output, value not recorded in ALI file). For the
- -- decision SCO for an aspect, or for any expression SCO nested in an
- -- aspect, location of aspect identifier token (likewise).
+ -- For the decision SCO of a pragma, or for the decision SCO of any
+ -- expression nested in a pragma Debug/Assert/PPC, location of PRAGMA
+ -- token (used for control of SCO output, value not recorded in ALI
+ -- file). Similarly, for the decision SCO of an aspect, or for the
+ -- decision SCO of any expression nested in an aspect, location of
+ -- aspect identifier token.
Pragma_Aspect_Name : Name_Id := No_Name;
-- For the SCO for a pragma/aspect, gives the pragma/apsect name
-- type with constraints. In this case the entity has been introduced
-- in the private declaration.
- -- Finally this happens in some complex cases when validity checks are
+ -- Finally this happens in some complex cases when validity checks are
-- enabled, where the same subtype declaration may be analyzed twice.
-- This can happen if the subtype is created by the pre-analysis of
-- an attribute tht gives the range of a loop statement, and the loop
# include <pthread.h>
# include <time.h>
-#ifndef _AIXVERSION_530
-/* We use the same runtime library for AIX 5.2 and 5.3, but pthread_condattr_
- * setclock exists only on the latter, so for the former provide a dummy
- * implementation (declared below, weak symbol defined in init.c).
- *
- * Note: this means that under AIX 5.2 we'll be using CLOCK_MONOTONIC
- * timestamps from clock_gettime() as arguments to pthread_cond_timedwait,
- * which expects a CLOCK_REALTIME value, which is technically wrong, but
- * inocuous in practice on that particular platform since both clocks happen
- * to use close epochs.
- */
-
-extern int pthread_condattr_setclock (pthread_condattr_t *attr, clockid_t cl);
-#endif
-
int
__gnat_pthread_condattr_setup(pthread_condattr_t *attr) {
-/*
- * If using a clock other than CLOCK_REALTIME for the Ada Monotonic_Clock,
- * the corresponding clock id must be set for condition variables.
- */
return pthread_condattr_setclock (attr, CLOCK_RT_Ada);
}