From 8e63eb25031818b8b7ae9f5c14e074a69b087eb5 Mon Sep 17 00:00:00 2001 From: charlet Date: Tue, 6 Sep 2011 09:15:15 +0000 Subject: 2011-09-06 Vincent Celier * projects.texi: Add menus and @node lines. 2011-09-06 Ed Schonberg * 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 * s-solita.adb: Update comments. 2011-09-06 Pascal Obry * 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@178573 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ada/ChangeLog | 23 +++++++++++++++++++++++ gcc/ada/exp_ch6.adb | 31 ++++++++++++++++++++++++++----- gcc/ada/projects.texi | 38 ++++++++++++++++++++++++++++++++++++++ gcc/ada/s-linux-alpha.ads | 7 +------ gcc/ada/s-linux-hppa.ads | 24 +----------------------- gcc/ada/s-linux-mipsel.ads | 17 +---------------- gcc/ada/s-linux-sparc.ads | 9 +-------- gcc/ada/s-linux.ads | 17 +---------------- gcc/ada/s-oscons-tmplt.c | 44 ++++++++++++++++++++++++++++---------------- gcc/ada/s-osinte-linux.ads | 41 +++++++++++++++++++---------------------- gcc/ada/s-solita.adb | 8 ++++++-- 11 files changed, 145 insertions(+), 114 deletions(-) (limited to 'gcc') diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 455ecc11740..36fd824ec04 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,26 @@ +2011-09-06 Vincent Celier + + * projects.texi: Add menus and @node lines. + +2011-09-06 Ed Schonberg + + * 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 + + * s-solita.adb: Update comments. + +2011-09-06 Pascal Obry + + * 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 * exp_ch6.adb: Fix minor typo. diff --git a/gcc/ada/exp_ch6.adb b/gcc/ada/exp_ch6.adb index 23558e0a787..c9749ff1a62 100644 --- a/gcc/ada/exp_ch6.adb +++ b/gcc/ada/exp_ch6.adb @@ -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, diff --git a/gcc/ada/projects.texi b/gcc/ada/projects.texi index fbaa3453727..d6130411409 100644 --- a/gcc/ada/projects.texi +++ b/gcc/ada/projects.texi @@ -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 diff --git a/gcc/ada/s-linux-alpha.ads b/gcc/ada/s-linux-alpha.ads index cdc716c727d..d31a10c4e2e 100644 --- a/gcc/ada/s-linux-alpha.ads +++ b/gcc/ada/s-linux-alpha.ads @@ -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; diff --git a/gcc/ada/s-linux-hppa.ads b/gcc/ada/s-linux-hppa.ads index 6176376cbeb..d25dcebdb33 100644 --- a/gcc/ada/s-linux-hppa.ads +++ b/gcc/ada/s-linux-hppa.ads @@ -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; diff --git a/gcc/ada/s-linux-mipsel.ads b/gcc/ada/s-linux-mipsel.ads index c0911d8d16a..f1b119d0f11 100644 --- a/gcc/ada/s-linux-mipsel.ads +++ b/gcc/ada/s-linux-mipsel.ads @@ -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; diff --git a/gcc/ada/s-linux-sparc.ads b/gcc/ada/s-linux-sparc.ads index 206eb86a072..756d69d8f30 100644 --- a/gcc/ada/s-linux-sparc.ads +++ b/gcc/ada/s-linux-sparc.ads @@ -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; diff --git a/gcc/ada/s-linux.ads b/gcc/ada/s-linux.ads index 29918d7d4ca..c8a7ad1744e 100644 --- a/gcc/ada/s-linux.ads +++ b/gcc/ada/s-linux.ads @@ -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; diff --git a/gcc/ada/s-oscons-tmplt.c b/gcc/ada/s-oscons-tmplt.c index fe3b90d1854..168301d0535 100644 --- a/gcc/ada/s-oscons-tmplt.c +++ b/gcc/ada/s-oscons-tmplt.c @@ -163,6 +163,10 @@ pragma Style_Checks ("M32766"); # include <_types.h> #endif +#ifdef __linux__ +# include +#endif + #ifdef NATIVE #include @@ -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 diff --git a/gcc/ada/s-osinte-linux.ads b/gcc/ada/s-osinte-linux.ads index 18a314bbc97..3f83db84a05 100644 --- a/gcc/ada/s-osinte-linux.ads +++ b/gcc/ada/s-osinte-linux.ads @@ -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; + 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; diff --git a/gcc/ada/s-solita.adb b/gcc/ada/s-solita.adb index aa3c5a8e25e..666a6d5c521 100644 --- a/gcc/ada/s-solita.adb +++ b/gcc/ada/s-solita.adb @@ -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); -- cgit v1.2.1