[multiple changes]

2012-01-23  Robert Dewar  <dewar@adacore.com>

	* a-calend.adb: Minor reformatting.

2012-01-23  Ed Schonberg  <schonberg@adacore.com>

	* exp_ch9.adb, sem_ch9.adb: Handle array of access to synchronized
	interface in requeue statement.

2012-01-23  Cyrille Comar  <comar@adacore.com>

	* projects.texi: Remove references to main units and replace
	with references to main programs to be coherent with the
	documentation.

From-SVN: r183412
This commit is contained in:
Arnaud Charlet 2012-01-23 09:47:47 +01:00
parent 7647cd4b72
commit ce20f35b8f
5 changed files with 102 additions and 58 deletions

View File

@ -1,3 +1,18 @@
2012-01-23 Robert Dewar <dewar@adacore.com>
* a-calend.adb: Minor reformatting.
2012-01-23 Ed Schonberg <schonberg@adacore.com>
* exp_ch9.adb, sem_ch9.adb: Handle array of access to synchronized
interface in requeue statement.
2012-01-23 Cyrille Comar <comar@adacore.com>
* projects.texi: Remove references to main units and replace
with references to main programs to be coherent with the
documentation.
2012-01-23 Robert Dewar <dewar@adacore.com> 2012-01-23 Robert Dewar <dewar@adacore.com>
* s-utf_32.adb: Minor reformatting. * s-utf_32.adb: Minor reformatting.

View File

@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 1992-2009, Free Software Foundation, Inc. -- -- Copyright (C) 1992-2012, Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
@ -132,12 +132,10 @@ package body Ada.Calendar is
pragma Import (C, Flag, "__gl_leap_seconds_support"); pragma Import (C, Flag, "__gl_leap_seconds_support");
-- This imported value is used to determine whether the compilation had -- This imported value is used to determine whether the compilation had
-- binder flag "-y" present which enables leap seconds. A value of zero -- binder flag "-y" present which enables leap seconds. A value of zero
-- signifies no leap seconds support while a value of one enables the -- signifies no leap seconds support while a value of one enables support.
-- support.
Leap_Support : constant Boolean := Flag = 1; Leap_Support : constant Boolean := (Flag = 1);
-- The above flag controls the usage of leap seconds in all Ada.Calendar -- Flag to controls the usage of leap seconds in all Ada.Calendar routines
-- routines.
Leap_Seconds_Count : constant Natural := 24; Leap_Seconds_Count : constant Natural := 24;
@ -172,8 +170,8 @@ package body Ada.Calendar is
Start_Of_Time : constant Time_Rep := Start_Of_Time : constant Time_Rep :=
Ada_Low - Time_Rep (3) * Nanos_In_Day; Ada_Low - Time_Rep (3) * Nanos_In_Day;
-- The Unix lower time bound expressed as nanoseconds since the -- The Unix lower time bound expressed as nanoseconds since the start of
-- start of Ada time in UTC. -- Ada time in UTC.
Unix_Min : constant Time_Rep := Unix_Min : constant Time_Rep :=
Ada_Low + Time_Rep (17 * 366 + 52 * 365) * Nanos_In_Day; Ada_Low + Time_Rep (17 * 366 + 52 * 365) * Nanos_In_Day;
@ -187,7 +185,8 @@ package body Ada.Calendar is
(0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334); (0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334);
-- The following table contains the hard time values of all existing leap -- The following table contains the hard time values of all existing leap
-- seconds. The values are produced by the utility program xleaps.adb. -- seconds. The values are produced by the utility program xleaps.adb. This
-- must be updated when additional leap second times are defined.
Leap_Second_Times : constant array (1 .. Leap_Seconds_Count) of Time_Rep := Leap_Second_Times : constant array (1 .. Leap_Seconds_Count) of Time_Rep :=
(-5601484800000000000, (-5601484800000000000,
@ -251,10 +250,9 @@ package body Ada.Calendar is
function "-" (Left : Time; Right : Time) return Duration is function "-" (Left : Time; Right : Time) return Duration is
pragma Unsuppress (Overflow_Check); pragma Unsuppress (Overflow_Check);
-- The bounds of type Duration expressed as time representations
Dur_Low : constant Time_Rep := Duration_To_Time_Rep (Duration'First); Dur_Low : constant Time_Rep := Duration_To_Time_Rep (Duration'First);
Dur_High : constant Time_Rep := Duration_To_Time_Rep (Duration'Last); Dur_High : constant Time_Rep := Duration_To_Time_Rep (Duration'Last);
-- The bounds of type Duration expressed as time representations
Res_N : Time_Rep; Res_N : Time_Rep;
@ -266,13 +264,12 @@ package body Ada.Calendar is
-- the generation of bogus values by the Unchecked_Conversion, we apply -- the generation of bogus values by the Unchecked_Conversion, we apply
-- the following check. -- the following check.
if Res_N < Dur_Low if Res_N < Dur_Low or else Res_N > Dur_High then
or else Res_N > Dur_High
then
raise Time_Error; raise Time_Error;
end if; end if;
return Time_Rep_To_Duration (Res_N); return Time_Rep_To_Duration (Res_N);
exception exception
when Constraint_Error => when Constraint_Error =>
raise Time_Error; raise Time_Error;
@ -344,8 +341,7 @@ package body Ada.Calendar is
-- by adding the number of nanoseconds between the two origins. -- by adding the number of nanoseconds between the two origins.
Res_N : Time_Rep := Res_N : Time_Rep :=
Duration_To_Time_Rep (System.OS_Primitives.Clock) + Duration_To_Time_Rep (System.OS_Primitives.Clock) + Unix_Min;
Unix_Min;
begin begin
-- If the target supports leap seconds, determine the number of leap -- If the target supports leap seconds, determine the number of leap
@ -572,10 +568,10 @@ package body Ada.Calendar is
-- Validity checks -- Validity checks
if not Year'Valid if not Year'Valid or else
or else not Month'Valid not Month'Valid or else
or else not Day'Valid not Day'Valid or else
or else not Seconds'Valid not Seconds'Valid
then then
raise Time_Error; raise Time_Error;
end if; end if;
@ -603,10 +599,10 @@ package body Ada.Calendar is
begin begin
-- Validity checks -- Validity checks
if not Year'Valid if not Year'Valid or else
or else not Month'Valid not Month'Valid or else
or else not Day'Valid not Day'Valid or else
or else not Seconds'Valid not Seconds'Valid
then then
raise Time_Error; raise Time_Error;
end if; end if;
@ -815,12 +811,10 @@ package body Ada.Calendar is
-- Step 1: Validity checks of input values -- Step 1: Validity checks of input values
if not Year'Valid if not Year'Valid or else not Month'Valid or else not Day'Valid
or else not Month'Valid or else tm_hour not in 0 .. 24
or else not Day'Valid or else tm_min not in 0 .. 59
or else tm_hour not in 0 .. 24 or else tm_sec not in 0 .. 60
or else tm_min not in 0 .. 59
or else tm_sec not in 0 .. 60
or else tm_isdst not in -1 .. 1 or else tm_isdst not in -1 .. 1
then then
raise Time_Error; raise Time_Error;
@ -1032,7 +1026,6 @@ package body Ada.Calendar is
Date_N : constant Time_Rep := Time_Rep (Date); Date_N : constant Time_Rep := Time_Rep (Date);
Time_Zone : constant Long_Integer := Time_Zone : constant Long_Integer :=
Time_Zones_Operations.UTC_Time_Offset (Date); Time_Zones_Operations.UTC_Time_Offset (Date);
Ada_Low_N : Time_Rep; Ada_Low_N : Time_Rep;
Day_Count : Long_Integer; Day_Count : Long_Integer;
Day_Dur : Time_Dur; Day_Dur : Time_Dur;
@ -1133,7 +1126,7 @@ package body Ada.Calendar is
Date_N := Date_N - Time_Rep (Elapsed_Leaps) * Nano; Date_N := Date_N - Time_Rep (Elapsed_Leaps) * Nano;
-- Step 2: Time zone processing. This action converts the input date -- Step 2: Time zone processing. This action converts the input date
-- from GMT to the requested time zone. -- from GMT to the requested time zone. Applies from Ada 2005 on.
if Is_Ada_05 then if Is_Ada_05 then
if Time_Zone /= 0 then if Time_Zone /= 0 then
@ -1289,6 +1282,7 @@ package body Ada.Calendar is
-- the input date. -- the input date.
Count := (Year - Year_Number'First) / 4; Count := (Year - Year_Number'First) / 4;
for Four_Year_Segments in 1 .. Count loop for Four_Year_Segments in 1 .. Count loop
Res_N := Res_N + Nanos_In_Four_Years; Res_N := Res_N + Nanos_In_Four_Years;
end loop; end loop;
@ -1388,9 +1382,7 @@ package body Ada.Calendar is
-- An Ada 2005 caller requesting an explicit leap second or an -- An Ada 2005 caller requesting an explicit leap second or an
-- Ada 95 caller accounting for an invisible leap second. -- Ada 95 caller accounting for an invisible leap second.
if Leap_Sec if Leap_Sec or else Res_N >= Next_Leap_N then
or else Res_N >= Next_Leap_N
then
Res_N := Res_N + Time_Rep (1) * Nano; Res_N := Res_N + Time_Rep (1) * Nano;
end if; end if;

View File

@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 1992-2011, Free Software Foundation, Inc. -- -- Copyright (C) 1992-2012, Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
@ -9090,10 +9090,26 @@ package body Exp_Ch9 is
-- Generate: -- Generate:
-- _Disp_Requeue (<Params>); -- _Disp_Requeue (<Params>);
return -- Find entity for Disp_Requeue operation, which belongs to
Make_Procedure_Call_Statement (Loc, -- the type and may not be directly visible.
Name => Make_Identifier (Loc, Name_uDisp_Requeue),
Parameter_Associations => Params); declare
Elmt : Elmt_Id;
Op : Entity_Id;
begin
Elmt := First_Elmt (Primitive_Operations (Etype (Conc_Typ)));
while Present (Elmt) loop
Op := Node (Elmt);
exit when Chars (Op) = Name_uDisp_Requeue;
Next_Elmt (Elmt);
end loop;
return
Make_Procedure_Call_Statement (Loc,
Name => New_Occurrence_Of (Op, Loc),
Parameter_Associations => Params);
end;
end Build_Dispatching_Requeue; end Build_Dispatching_Requeue;
-------------------------------------- --------------------------------------
@ -9366,6 +9382,16 @@ package body Exp_Ch9 is
Extract_Entry (N, Concval, Ename, Index); Extract_Entry (N, Concval, Ename, Index);
Conc_Typ := Etype (Concval); Conc_Typ := Etype (Concval);
-- If the prefix is an access to class-wide type, dereference to get
-- object and entry type.
if Is_Access_Type (Conc_Typ) then
Conc_Typ := Designated_Type (Conc_Typ);
Rewrite (Concval,
Make_Explicit_Dereference (Loc, Relocate_Node (Concval)));
Analyze_And_Resolve (Concval, Conc_Typ);
end if;
-- Examine the scope stack in order to find nearest enclosing protected -- Examine the scope stack in order to find nearest enclosing protected
-- or task type. This will constitute our invocation source. -- or task type. This will constitute our invocation source.

View File

@ -1,7 +1,7 @@
@set gprconfig GPRconfig @set gprconfig GPRconfig
@c ------ projects.texi @c ------ projects.texi
@c Copyright (C) 2002-2011, Free Software Foundation, Inc. @c Copyright (C) 2002-2012, Free Software Foundation, Inc.
@c This file is shared between the GNAT user's guide and gprbuild. It is not @c This file is shared between the GNAT user's guide and gprbuild. It is not
@c compilable on its own, you should instead compile the other two manuals. @c compilable on its own, you should instead compile the other two manuals.
@c For that reason, there is no toplevel @menu @c For that reason, there is no toplevel @menu
@ -2160,7 +2160,7 @@ 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. cases to try and explain what you can use aggregate projects for.
@menu @menu
* Building all main units from a single project tree:: * Building all main programs from a single project tree::
* Building a set of projects with a single command:: * Building a set of projects with a single command::
* Define a build environment:: * Define a build environment::
* Performance improvements in builder:: * Performance improvements in builder::
@ -2169,8 +2169,8 @@ cases to try and explain what you can use aggregate projects for.
@end menu @end menu
@c ----------------------------------------------------------- @c -----------------------------------------------------------
@node Building all main units from a single project tree @node Building all main programs from a single project tree
@subsection Building all main units from a single project tree @subsection Building all main programs from a single project tree
@c ----------------------------------------------------------- @c -----------------------------------------------------------
Most often, an application is organized into modules and submodules, Most often, an application is organized into modules and submodules,
@ -2189,7 +2189,7 @@ a syntax similar to
gprbuild -PA.gpr gprbuild -PA.gpr
@end smallexample @end smallexample
this will only rebuild the main units of project A, not those of the this will only rebuild the main programs of project A, not those of the
imported projects B and C. Therefore you have to spawn several imported projects B and C. Therefore you have to spawn several
gnatmake commands, one per project, to build all executables. gnatmake commands, one per project, to build all executables.
This is a little inconvenient, but more importantly is inefficient This is a little inconvenient, but more importantly is inefficient
@ -2206,7 +2206,7 @@ and C. Then, when you build with
gprbuild -PAgg.gpr gprbuild -PAgg.gpr
@end smallexample @end smallexample
this will build all main units from A, B and C. this will build all mains from A, B and C.
@smallexample @c projectfile @smallexample @c projectfile
aggregate project Agg is aggregate project Agg is
@ -2214,14 +2214,14 @@ this will build all main units from A, B and C.
end Agg; end Agg;
@end smallexample @end smallexample
If B or C do not define any main unit (through their Main If B or C do not define any main program (through their Main
attribute), all their sources are build. When you do not group them attribute), all their sources are build. When you do not group them
in the aggregate project, only those sources that are needed by A in the aggregate project, only those sources that are needed by A
will be build. will be build.
If you add a main unit to a project P not already explicitly referenced in the If you add a main to a project P not already explicitly referenced in the
aggregate project, you will need to add "p.gpr" in the list of project 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 files for the aggregate project, or the main will not be built when
building the aggregate project. building the aggregate project.
@c --------------------------------------------------------- @c ---------------------------------------------------------
@ -2402,7 +2402,7 @@ grouping standard projects, you can have both the root of a project tree
within the tree. within the tree.
Basically, the idea is to specify all those projects that have Basically, the idea is to specify all those projects that have
main units you want to build and link, or libraries you want to main programs you want to build and link, or libraries you want to
build. You can even specify projects that do not use the Main build. You can even specify projects that do not use the Main
attribute nor the @code{Library_*} attributes, and the result will be to attribute nor the @code{Library_*} attributes, and the result will be to
build all their source files (not just the ones needed by other build all their source files (not just the ones needed by other
@ -2665,7 +2665,7 @@ Projects can locally add to those by using the
For projects that are build through the aggregate, the package Builder For projects that are build through the aggregate, the package Builder
is ignored, except for the Executable attribute which specifies the is ignored, except for the Executable attribute which specifies the
name of the executables resulting from the link of the main units, and name of the executables resulting from the link of the main programs, and
for the Executable_Suffix. for the Executable_Suffix.
@c --------------------------------------------- @c ---------------------------------------------
@ -4125,7 +4125,7 @@ with one or several main subprograms, by specifying their source files on the
command line. command line.
@smallexample @smallexample
gnatmake ^-P^/PROJECT_FILE=^prj main1 main2 main3 gnatmake ^-P^/PROJECT_FILE=^prj main1.adb main2.adb main3.adb
@end smallexample @end smallexample
@noindent @noindent
@ -4161,7 +4161,7 @@ Example:
@smallexample @c projectfile @smallexample @c projectfile
@group @group
project Prj is project Prj is
for Main use ("main1", "main2", "main3"); for Main use ("main1.adb", "main2.adb", "main3.adb");
end Prj; end Prj;
@end group @end group
@end smallexample @end smallexample
@ -4169,7 +4169,7 @@ Example:
@noindent @noindent
With this project file, @code{"gnatmake ^-Pprj^/PROJECT_FILE=PRJ^"} With this project file, @code{"gnatmake ^-Pprj^/PROJECT_FILE=PRJ^"}
is equivalent to is equivalent to
@code{"gnatmake ^-Pprj^/PROJECT_FILE=PRJ^ main1 main2 main3"}. @code{"gnatmake ^-Pprj^/PROJECT_FILE=PRJ^ main1.adb main2.adb main3.adb"}.
When the project attribute @code{Main} is not specified, or is specified When the project attribute @code{Main} is not specified, or is specified
as an empty string list, or when the switch @option{-u} is used on the command as an empty string list, or when the switch @option{-u} is used on the command

View File

@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 1992-2011, Free Software Foundation, Inc. -- -- Copyright (C) 1992-2012, Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
@ -1393,6 +1393,7 @@ package body Sem_Ch9 is
Target_Obj : Node_Id := Empty; Target_Obj : Node_Id := Empty;
Req_Scope : Entity_Id; Req_Scope : Entity_Id;
Outer_Ent : Entity_Id; Outer_Ent : Entity_Id;
Synch_Type : Entity_Id;
begin begin
Tasking_Used := True; Tasking_Used := True;
@ -1548,13 +1549,23 @@ package body Sem_Ch9 is
-- Ada 2012 (AI05-0030): Potential dispatching requeue statement. The -- Ada 2012 (AI05-0030): Potential dispatching requeue statement. The
-- target type must be a concurrent interface class-wide type and the -- target type must be a concurrent interface class-wide type and the
-- target must be a procedure, flagged by pragma Implemented. -- target must be a procedure, flagged by pragma Implemented. The
-- target may be an access to class-wide type, in which case it must
-- be dereferenced.
if Present (Target_Obj) then
Synch_Type := Etype (Target_Obj);
if Is_Access_Type (Synch_Type) then
Synch_Type := Designated_Type (Synch_Type);
end if;
end if;
Is_Disp_Req := Is_Disp_Req :=
Ada_Version >= Ada_2012 Ada_Version >= Ada_2012
and then Present (Target_Obj) and then Present (Target_Obj)
and then Is_Class_Wide_Type (Etype (Target_Obj)) and then Is_Class_Wide_Type (Synch_Type)
and then Is_Concurrent_Interface (Etype (Target_Obj)) and then Is_Concurrent_Interface (Synch_Type)
and then Ekind (Entry_Id) = E_Procedure and then Ekind (Entry_Id) = E_Procedure
and then Has_Rep_Pragma (Entry_Id, Name_Implemented); and then Has_Rep_Pragma (Entry_Id, Name_Implemented);