[multiple changes]

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.

From-SVN: r178573
This commit is contained in:
Arnaud Charlet 2011-09-06 11:15:15 +02:00
parent 886b5a18d5
commit 77aa62e72f
11 changed files with 149 additions and 118 deletions

View File

@ -1,3 +1,26 @@
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.

View File

@ -4031,12 +4031,20 @@ package body Exp_Ch6 is
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
@ -4201,14 +4209,19 @@ package body Exp_Ch6 is
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;
@ -4372,6 +4385,12 @@ package body Exp_Ch6 is
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
@ -4388,7 +4407,9 @@ package body Exp_Ch6 is
-- 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,

View File

@ -2131,7 +2131,19 @@ meant to solve a few specific use cases that cannot be solved directly
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
@ -2184,7 +2196,10 @@ aggregate project, you will need to add "p.gpr" in the list of project
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
@ -2223,7 +2238,10 @@ with Annex E.
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
@ -2278,7 +2296,10 @@ project MyProject is
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
@ -2294,7 +2315,10 @@ can be compiled in parallel (through the usual -j switch) and this can
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
@ -2492,7 +2516,10 @@ P, which in particular might impact the list of source files in P.
@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
@ -2628,7 +2655,15 @@ project files (so possibly built with different compiler options) and
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:
@ -2674,7 +2709,10 @@ With the above aggregate library Builder package, the @code{-fPIC}
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

View File

@ -6,7 +6,7 @@
-- --
-- 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- --
@ -111,9 +111,4 @@ package System.Linux is
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;

View File

@ -6,7 +6,7 @@
-- --
-- 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- --
@ -103,26 +103,4 @@ package System.Linux is
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;

View File

@ -6,7 +6,7 @@
-- --
-- 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- --
@ -100,19 +100,4 @@ package System.Linux is
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;

View File

@ -6,7 +6,7 @@
-- --
-- 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- --
@ -109,11 +109,4 @@ package System.Linux is
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;

View File

@ -6,7 +6,7 @@
-- --
-- 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- --
@ -101,19 +101,4 @@ package System.Linux is
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;

View File

@ -163,6 +163,10 @@ pragma Style_Checks ("M32766");
# include <_types.h>
#endif
#ifdef __linux__
# include <pthread.h>
#endif
#ifdef NATIVE
#include <stdio.h>
@ -1351,42 +1355,50 @@ CND(WSAEDISCON, "Disconnected")
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

View File

@ -41,6 +41,7 @@
with Ada.Unchecked_Conversion;
with Interfaces.C;
with System.Linux;
with System.OS_Constants;
package System.OS_Interface is
pragma Preelaborate;
@ -557,35 +558,31 @@ private
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;
pragma Convention (C, pthread_attr_t);
type pthread_condattr_t is record
dummy : int;
end record;
pragma Convention (C, pthread_condattr_t);
type pthread_mutexattr_t is record
mutexkind : int;
end record;
pragma Convention (C, pthread_mutexattr_t);
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_cond_t is array (0 .. 47) of unsigned_char;
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
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
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
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 (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;

View File

@ -6,7 +6,7 @@
-- --
-- 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- --
@ -153,6 +153,10 @@ package body System.Soft_Links.Tasking is
-- 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);
@ -212,7 +216,7 @@ package body System.Soft_Links.Tasking is
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);