+2011-09-06 Vincent Celier <celier@adacore.com>
+
+ * projects.texi: Add menus and @node lines.
+
+2011-09-06 Ed Schonberg <schonberg@adacore.com>
+
+ * exp_ch6.adb (Expand_Inlined_Call): Handle properly the case
+ where the return type is an unconstrained array and the context
+ is an assignment. Optimize the case when the target of the
+ assignment is a selected component.
+
+2011-09-06 Arnaud Charlet <charlet@adacore.com>
+
+ * s-solita.adb: Update comments.
+
+2011-09-06 Pascal Obry <obry@adacore.com>
+
+ * s-linux.ads, s-linux-alpha.ads, s-linux-hppa.ads, s-linux-mipsel.ads,
+ s-linux-sparc.ads: Remove hard coded and now wrong definitions.
+ * s-oscons-tmplt.c: Add support for generating pthread related
+ types size on GNU/Linux as done for Darwin.
+ * s-osinte-linux.ads: Use s-oscons to define the pthread types.
+
2011-09-06 Robert Dewar <dewar@adacore.com>
* exp_ch6.adb: Fix minor typo.
Insert_After (Parent (Entity (N)), Blk);
+ -- If the context is an assignment, and the left-hand side is
+ -- free of side-effects, the replacement is also safe.
+ -- Can this be generalized further???
+
elsif Nkind (Parent (N)) = N_Assignment_Statement
and then
(Is_Entity_Name (Name (Parent (N)))
or else
(Nkind (Name (Parent (N))) = N_Explicit_Dereference
- and then Is_Entity_Name (Prefix (Name (Parent (N))))))
+ and then Is_Entity_Name (Prefix (Name (Parent (N)))))
+
+ or else
+ (Nkind (Name (Parent (N))) = N_Selected_Component
+ and then Is_Entity_Name (Prefix (Name (Parent (N))))))
then
-- Replace assignment with the block
Set_Declarations (Blk, New_List);
end if;
- -- For the unconstrained case, capture the name of the local
- -- variable that holds the result. This must be the first declaration
+ -- For the unconstrained case, capture the name of the local variable
+ -- that holds the result. This must be the first declaration
-- in the block, because its bounds cannot depend on local variables.
-- Otherwise there is no way to declare the result outside of the
-- block. Needless to say, in general the bounds will depend on the
-- actuals in the call.
+ -- If the context is an assignment statement, as is the case for the
+ -- expansion of an extended return, the left-hand side provides bounds
+ -- even if the return type is unconstrained.
- if Is_Unc then
+ if Is_Unc
+ and then Nkind (Parent (N)) /= N_Assignment_Statement
+ then
Targ1 := Defining_Identifier (First (Declarations (Blk)));
end if;
then
Targ := Name (Parent (N));
+ elsif Nkind (Parent (N)) = N_Assignment_Statement
+ and then Nkind (Name (Parent (N))) = N_Selected_Component
+ and then Is_Entity_Name (Prefix (Name (Parent (N))))
+ then
+ Targ := New_Copy_Tree (Name (Parent (N)));
+
elsif Nkind (Parent (N)) = N_Object_Declaration
and then Is_Limited_Type (Etype (Subp))
then
-- eventually be possible to remove that temporary and use the
-- result variable directly.
- if Is_Unc then
+ if Is_Unc
+ and then Nkind (Parent (N)) /= N_Assignment_Statement
+ then
Decl :=
Make_Object_Declaration (Loc,
Defining_Identifier => Temp,
using standard projects. This section will go over a few of these use
cases to try and explain what you can use aggregate projects for.
+@menu
+* Building all main units from a single project tree::
+* Building a set of projects with a single command::
+* Define a build environment::
+* Performance improvements in builder::
+* Syntax of aggregate projects::
+* package Builder in aggregate projects::
+@end menu
+
+@c -----------------------------------------------------------
+@node Building all main units from a single project tree
@subsection Building all main units from a single project tree
+@c -----------------------------------------------------------
Most often, an application is organized into modules and submodules,
which are very conveniently represented as a project tree or graph
files for the aggregate project, or the main unit will not be built when
building the aggregate project.
+@c ---------------------------------------------------------
+@node Building a set of projects with a single command
@subsection Building a set of projects with a single command
+@c ---------------------------------------------------------
One other case is when you have multiple applications and libraries
that are build independently from each other (but they can be build in
Aggregate projects can be used to build multiple partitions
@end smallexample
+@c ---------------------------------------------
+@node Define a build environment
@subsection Define a build environment
+@c ---------------------------------------------
The environment variables at the time you launch gprbuild or gprbuild
will influence the view these tools have of the project (PATH to find
end MyProject;
@end smallexample
+@c --------------------------------------------
+@node Performance improvements in builder
@subsection Performance improvements in builder
+@c --------------------------------------------
The loading of aggregate projects is optimized in gprbuild and
gnatmake, so that all files are searched for only once on the disk
be done while maximizing the use of CPUs (compared to launching
multiple gprbuild and gnatmake commands in parallel).
+@c -------------------------------------
+@node Syntax of aggregate projects
@subsection Syntax of aggregate projects
+@c -------------------------------------
An aggregate project follows the general syntax of project files. The
recommended extension is still @file{.gpr}. However, a special
@end table
+@c ----------------------------------------------
+@node package Builder in aggregate projects
@subsection package Builder in aggregate projects
+@c ----------------------------------------------
As we mentioned before, only the package Builder can be specified in
an aggregate project. In this package, only the following attributes
yet create a single library (static or relocatable) out of the
corresponding object files.
+@menu
+* Building aggregate library projects::
+* Syntax of aggregate library projects::
+@end menu
+
+@c ---------------------------------------------
+@node Building aggregate library projects
@subsection Building aggregate library projects
+@c ---------------------------------------------
For example, we can define an aggregate project Agg that groups A, B
and C:
option will be passed to the compiler when building any source code
from projects @file{a.gpr}, @file{b.gpr} and @file{c.gpr}.
+@c ---------------------------------------------
+@node Syntax of aggregate library projects
@subsection Syntax of aggregate library projects
+@c ---------------------------------------------
An aggregate library project follows the general syntax of project
files. The recommended extension is still @file{.gpr}. However, a special
-- --
-- S p e c --
-- --
--- Copyright (C) 2009, Free Software Foundation, Inc. --
+-- Copyright (C) 2009-2011, 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- --
SA_SIGINFO : constant := 16#40#;
SA_ONSTACK : constant := 16#01#;
- type pthread_mutex_t is record
- dum0, dum1, dum2, dum3, dum4 : Interfaces.C.unsigned_long;
- end record;
- pragma Convention (C, pthread_mutex_t);
-
end System.Linux;
-- --
-- S p e c --
-- --
--- Copyright (C) 2008-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 2008-2011, 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- --
SA_SIGINFO : constant := 16#10#;
SA_ONSTACK : constant := 16#01#;
- type lock_array is array (1 .. 4) of Integer;
- type atomic_lock_t is record
- lock : lock_array;
- end record;
- pragma Convention (C, atomic_lock_t);
- for atomic_lock_t'Alignment use 16;
-
- type struct_pthread_fast_lock is record
- spinlock : atomic_lock_t;
- status : Long_Integer;
- end record;
- pragma Convention (C, struct_pthread_fast_lock);
-
- type pthread_mutex_t is record
- m_reserved : Integer;
- m_count : Integer;
- m_owner : System.Address;
- m_kind : Integer;
- m_lock : struct_pthread_fast_lock;
- end record;
- pragma Convention (C, pthread_mutex_t);
-
end System.Linux;
-- --
-- S p e c --
-- --
--- Copyright (C) 2009, Free Software Foundation, Inc. --
+-- Copyright (C) 2009-2011, 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- --
SA_SIGINFO : constant := 16#04#;
SA_ONSTACK : constant := 16#08000000#;
- type struct_pthread_fast_lock is record
- status : Long_Integer;
- spinlock : Integer;
- end record;
- pragma Convention (C, struct_pthread_fast_lock);
-
- type pthread_mutex_t is record
- m_reserved : Integer;
- m_count : Integer;
- m_owner : System.Address;
- m_kind : Integer;
- m_lock : struct_pthread_fast_lock;
- end record;
- pragma Convention (C, pthread_mutex_t);
-
end System.Linux;
-- --
-- S p e c --
-- --
--- Copyright (C) 2009, Free Software Foundation, Inc. --
+-- Copyright (C) 2009-2011, 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- --
SA_SIGINFO : constant := 16#200#;
SA_ONSTACK : constant := 16#001#;
- type pthread_mutex_t is record
- L1, L2, L3, L4 : Interfaces.C.long;
- I1, I2 : Interfaces.C.int;
- end record;
- pragma Convention (C, pthread_mutex_t);
- -- 24 bytes for 32-bit and 40 bytes for 64-bit, aligned like 'long'
-
end System.Linux;
-- --
-- S p e c --
-- --
--- Copyright (C) 2008-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 2008-2011, 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- --
SA_SIGINFO : constant := 16#04#;
SA_ONSTACK : constant := 16#08000000#;
- type struct_pthread_fast_lock is record
- status : Long_Integer;
- spinlock : Integer;
- end record;
- pragma Convention (C, struct_pthread_fast_lock);
-
- type pthread_mutex_t is record
- m_reserved : Integer;
- m_count : Integer;
- m_owner : System.Address;
- m_kind : Integer;
- m_lock : struct_pthread_fast_lock;
- end record;
- pragma Convention (C, pthread_mutex_t);
-
end System.Linux;
# include <_types.h>
#endif
+#ifdef __linux__
+# include <pthread.h>
+#endif
+
#ifdef NATIVE
#include <stdio.h>
putchar ('\n');
#endif
-#if defined (__APPLE__) || defined (DUMMY)
+#if defined (__APPLE__) || defined (__linux__) || defined (DUMMY)
/*
- -------------------------------
- -- Darwin-specific constants --
- -------------------------------
-
- -- These constants may be used only within the Darwin version of the GNAT
- -- runtime library.
+ -- Sizes of pthread data types
*/
-#define PTHREAD_SIZE __PTHREAD_SIZE__
+#if defined (__APPLE__) || defined (DUMMY)
+#define PTHREAD_SIZE __PTHREAD_SIZE__
+#define PTHREAD_ATTR_SIZE __PTHREAD_ATTR_SIZE__
+#define PTHREAD_MUTEXATTR_SIZE __PTHREAD_MUTEXATTR_SIZE__
+#define PTHREAD_MUTEX_SIZE __PTHREAD_MUTEX_SIZE__
+#define PTHREAD_CONDATTR_SIZE __PTHREAD_CONDATTR_SIZE__
+#define PTHREAD_COND_SIZE __PTHREAD_COND_SIZE__
+#define PTHREAD_RWLOCKATTR_SIZE __PTHREAD_RWLOCKATTR_SIZE__
+#define PTHREAD_RWLOCK_SIZE __PTHREAD_RWLOCK_SIZE__
+#define PTHREAD_ONCE_SIZE __PTHREAD_ONCE_SIZE__
+#else
+#define PTHREAD_SIZE (sizeof (pthread_t))
+#define PTHREAD_ATTR_SIZE __SIZEOF_PTHREAD_ATTR_T
+#define PTHREAD_MUTEXATTR_SIZE __SIZEOF_PTHREAD_MUTEXATTR_T
+#define PTHREAD_MUTEX_SIZE __SIZEOF_PTHREAD_MUTEX_T
+#define PTHREAD_CONDATTR_SIZE __SIZEOF_PTHREAD_CONDATTR_T
+#define PTHREAD_COND_SIZE __SIZEOF_PTHREAD_COND_T
+#define PTHREAD_RWLOCKATTR_SIZE __SIZEOF_PTHREAD_RWLOCKATTR_T
+#define PTHREAD_RWLOCK_SIZE __SIZEOF_PTHREAD_RWLOCK_T
+#define PTHREAD_ONCE_SIZE (sizeof (pthread_once_t))
+#endif
+
CND(PTHREAD_SIZE, "Pad in pthread_t")
-#define PTHREAD_ATTR_SIZE __PTHREAD_ATTR_SIZE__
CND(PTHREAD_ATTR_SIZE, "Pad in pthread_attr_t")
-#define PTHREAD_MUTEXATTR_SIZE __PTHREAD_MUTEXATTR_SIZE__
CND(PTHREAD_MUTEXATTR_SIZE, "Pad in pthread_mutexattr_t")
-#define PTHREAD_MUTEX_SIZE __PTHREAD_MUTEX_SIZE__
CND(PTHREAD_MUTEX_SIZE, "Pad in pthread_mutex_t")
-#define PTHREAD_CONDATTR_SIZE __PTHREAD_CONDATTR_SIZE__
CND(PTHREAD_CONDATTR_SIZE, "Pad in pthread_condattr_t")
-#define PTHREAD_COND_SIZE __PTHREAD_COND_SIZE__
CND(PTHREAD_COND_SIZE, "Pad in pthread_cond_t")
-#define PTHREAD_RWLOCKATTR_SIZE __PTHREAD_RWLOCKATTR_SIZE__
CND(PTHREAD_RWLOCKATTR_SIZE, "Pad in pthread_rwlockattr_t")
-#define PTHREAD_RWLOCK_SIZE __PTHREAD_RWLOCK_SIZE__
CND(PTHREAD_RWLOCK_SIZE, "Pad in pthread_rwlock_t")
-#define PTHREAD_ONCE_SIZE __PTHREAD_ONCE_SIZE__
CND(PTHREAD_ONCE_SIZE, "Pad in pthread_once_t")
#endif
with Ada.Unchecked_Conversion;
with Interfaces.C;
with System.Linux;
+with System.OS_Constants;
package System.OS_Interface is
pragma Preelaborate;
end record;
pragma Convention (C, timespec);
- type pthread_attr_t is record
- detachstate : int;
- schedpolicy : int;
- schedparam : struct_sched_param;
- inheritsched : int;
- scope : int;
- guardsize : size_t;
- stackaddr_set : int;
- stackaddr : System.Address;
- stacksize : size_t;
- end record;
+ type unsigned_long_long_t is mod 2 ** 64;
+ -- Local type only used to get it's 'Alignment below
+
+ type pthread_attr_t is
+ array (1 .. OS_Constants.PTHREAD_ATTR_SIZE) of unsigned_char;
pragma Convention (C, pthread_attr_t);
+ for pthread_attr_t'Alignment use Interfaces.C.unsigned_long'Alignment;
- type pthread_condattr_t is record
- dummy : int;
- end record;
+ type pthread_condattr_t is
+ array (1 .. OS_Constants.PTHREAD_CONDATTR_SIZE) of unsigned_char;
pragma Convention (C, pthread_condattr_t);
+ for pthread_condattr_t'Alignment use Interfaces.C.int'Alignment;
- type pthread_mutexattr_t is record
- mutexkind : int;
- end record;
+ type pthread_mutexattr_t is
+ array (1 .. OS_Constants.PTHREAD_MUTEXATTR_SIZE) of unsigned_char;
pragma Convention (C, pthread_mutexattr_t);
+ for pthread_mutexattr_t'Alignment use Interfaces.C.int'Alignment;
- type pthread_mutex_t is new System.Linux.pthread_mutex_t;
-
- type unsigned_long_long_t is mod 2 ** 64;
- -- Local type only used to get it's 'Alignment below
+ type pthread_mutex_t is
+ array (1 .. OS_Constants.PTHREAD_MUTEX_SIZE) of unsigned_char;
+ pragma Convention (C, pthread_mutex_t);
+ for pthread_mutex_t'Alignment use Interfaces.C.unsigned_long'Alignment;
- type pthread_cond_t is array (0 .. 47) of unsigned_char;
+ type pthread_cond_t is
+ array (1 .. OS_Constants.PTHREAD_COND_SIZE) of unsigned_char;
pragma Convention (C, pthread_cond_t);
for pthread_cond_t'Alignment use unsigned_long_long_t'Alignment;
-- --
-- B o d y --
-- --
--- Copyright (C) 2004-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 2004-2011, 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- --
-- We can only be here because we are terminating the environment task.
-- Task termination for the rest of the tasks is handled in the
-- Task_Wrapper.
+ -- We do not want to enable this check and e.g. call System.OS_Lib.Abort
+ -- here because some restricted run-times may not have system.os_lib
+ -- (e.g. JVM), and calling abort may do more harm than good to the
+ -- main application.
pragma Assert (Self_Id = STPO.Environment_Task);
SSL.Task_Termination_Handler := Task_Termination_Handler_T'Access;
-- No need to create a new Secondary Stack, since we will use the
- -- default one created in s-secsta.adb
+ -- default one created in s-secsta.adb.
SSL.Set_Sec_Stack_Addr (SSL.Get_Sec_Stack_Addr_NT);
SSL.Set_Jmpbuf_Address (SSL.Get_Jmpbuf_Address_NT);