Commit a92230c5 by Arnaud Charlet

[multiple changes]

2014-10-17  Robert Dewar  <dewar@adacore.com>

	* sem_util.adb: Minor reformatting.

2014-10-17  Ed Schonberg  <schonberg@adacore.com>

	* sem_ch12.adb (Build_Function_Wrapper): Build wrappers for
	actuals that are defaulted subprograms of the formal subprogram
	declaration.

2014-10-17  Robert Dewar  <dewar@adacore.com>

	* exp_ch4.adb (Expand_N_Op_Eq): Make sure we deal with the
	implementation base type.
	* sinfo.ads: Add a note for N_Op_Eq and N_Op_Ne that record
	operands are always expanded out into component comparisons.

2014-10-17  Robert Dewar  <dewar@adacore.com>

	* s-vallli.adb: Minor comment correction.
	* s-valuti.ads: Minor comment reformatting.

2014-10-17  Robert Dewar  <dewar@adacore.com>

	* gnat_rm.texi: Document System.Atomic_Counters.
	* impunit.adb: Add System.Atomic_Counters (s-atocou.ads) to the
	list of user- accessible units added as children of System.
	* s-atocou.ads: Update comment.

2014-10-17  Arnaud Charlet  <charlet@adacore.com>

	* s-expmod.ads: Add comments.

From-SVN: r216371
parent 38d0d6c8
2014-10-17 Robert Dewar <dewar@adacore.com>
* sem_util.adb: Minor reformatting.
2014-10-17 Ed Schonberg <schonberg@adacore.com>
* sem_ch12.adb (Build_Function_Wrapper): Build wrappers for
actuals that are defaulted subprograms of the formal subprogram
declaration.
2014-10-17 Robert Dewar <dewar@adacore.com>
* exp_ch4.adb (Expand_N_Op_Eq): Make sure we deal with the
implementation base type.
* sinfo.ads: Add a note for N_Op_Eq and N_Op_Ne that record
operands are always expanded out into component comparisons.
2014-10-17 Robert Dewar <dewar@adacore.com>
* s-vallli.adb: Minor comment correction.
* s-valuti.ads: Minor comment reformatting.
2014-10-17 Robert Dewar <dewar@adacore.com>
* gnat_rm.texi: Document System.Atomic_Counters.
* impunit.adb: Add System.Atomic_Counters (s-atocou.ads) to the
list of user- accessible units added as children of System.
* s-atocou.ads: Update comment.
2014-10-17 Arnaud Charlet <charlet@adacore.com>
* s-expmod.ads: Add comments.
2014-10-17 Hristian Kirtchev <kirtchev@adacore.com>
* sem_ch3.adb (Build_Derived_Record_Type): Remove the propagation
......
......@@ -7152,7 +7152,10 @@ package body Exp_Ch4 is
return;
end if;
Typl := Base_Type (Typl);
-- Now get the implementation base type (note that plain Base_Type here
-- might lead us back to the private type, which is not what we want!)
Typl := Implementation_Base_Type (Typl);
-- Equality between variant records results in a call to a routine
-- that has conditional tests of the discriminant value(s), and hence
......
......@@ -661,6 +661,7 @@ The GNAT Library
* Interfaces.VxWorks.IO (i-vxwoio.ads)::
* System.Address_Image (s-addima.ads)::
* System.Assertions (s-assert.ads)::
* System.Atomic_Counters (s-atocou.ads)::
* System.Memory (s-memory.ads)::
* System.Multiprocessors (s-multip.ads)::
* System.Multiprocessors.Dispatching_Domains (s-mudido.ads)::
......@@ -19074,6 +19075,7 @@ of GNAT, and will generate a warning message.
* Interfaces.VxWorks.IO (i-vxwoio.ads)::
* System.Address_Image (s-addima.ads)::
* System.Assertions (s-assert.ads)::
* System.Atomic_Counters (s-atocou.ads)::
* System.Memory (s-memory.ads)::
* System.Multiprocessors (s-multip.ads)::
* System.Multiprocessors.Dispatching_Domains (s-mudido.ads)::
......@@ -20585,6 +20587,18 @@ This package provides the declaration of the exception raised
by an run-time assertion failure, as well as the routine that
is used internally to raise this assertion.
@node System.Atomic_Counters (s-atocou.ads)
@section @code{System.Atomic_Counters} (@file{s-atocou.ads})
@cindex @code{System.Atomic_Counters} (@file{s-atocou.ads})
@noindent
This package provides the declaration of an atomic counter type,
together with efficient routines (using hardware
synchronization primitives) for incrementing, decrementing,
and testing of these counters. This package is implemented
on most targets, including all Alpha, ia64, PowerPC, SPARC V9,
x86, and x86_64 platforms.
@node System.Memory (s-memory.ads)
@section @code{System.Memory} (@file{s-memory.ads})
@cindex @code{System.Memory} (@file{s-memory.ads})
......
......@@ -367,6 +367,7 @@ package body Impunit is
--------------------------------------
("s-addima", F), -- System.Address_Image
("s-atocou", F), -- System.Atomic_Counters
("s-assert", F), -- System.Assertions
("s-diflio", F), -- System.Dim.Float_IO
("s-diinio", F), -- System.Dim.Integer_IO
......
......@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
-- Copyright (C) 2011-2013, Free Software Foundation, Inc. --
-- Copyright (C) 2011-2014, 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- --
......@@ -37,8 +37,6 @@
-- - all x86 platforms
-- - all x86_64 platforms
-- Why isn't this package available to application programs???
package System.Atomic_Counters is
pragma Preelaborate;
......@@ -59,20 +57,19 @@ package System.Atomic_Counters is
function Decrement (Item : in out Atomic_Counter) return Boolean;
pragma Inline_Always (Decrement);
-- Decrements value of atomic counter, returns True when value reach zero.
-- Decrements value of atomic counter, returns True when value reach zero
function Is_One (Item : Atomic_Counter) return Boolean;
pragma Inline_Always (Is_One);
-- Returns True when value of the atomic counter is one.
-- Returns True when value of the atomic counter is one
procedure Initialize (Item : out Atomic_Counter);
pragma Inline_Always (Initialize);
-- Initialize counter by setting its value to one. This subprogram is
-- intended to be used in special cases when counter object can't be
-- intended to be used in special cases when the counter object cannot be
-- initialized in standard way.
private
type Unsigned_32 is mod 2 ** 32;
type Atomic_Counter is limited record
......
......@@ -32,15 +32,25 @@
-- This function performs exponentiation of a modular type with non-binary
-- modulus values. Arithmetic is done in Long_Long_Unsigned, with explicit
-- accounting for the modulus value which is passed as the second argument.
-- Note that 1 is a binary modulus (2**0), so the compiler should not (and
-- will not) call this function with Modulus equal to 1).
with System.Unsigned_Types;
package System.Exp_Mod is
pragma Pure;
use type System.Unsigned_Types.Unsigned;
subtype Power_Of_2 is System.Unsigned_Types.Unsigned with
Dynamic_Predicate =>
Power_Of_2 /= 0 and then (Power_Of_2 and (Power_Of_2 - 1)) = 0;
function Exp_Modular
(Left : System.Unsigned_Types.Unsigned;
Modulus : System.Unsigned_Types.Unsigned;
Right : Natural) return System.Unsigned_Types.Unsigned;
Right : Natural) return System.Unsigned_Types.Unsigned
with
Pre => Modulus /= 0 and then Modulus not in Power_Of_2,
Post => Exp_Modular'Result = Left ** Right mod Modulus;
end System.Exp_Mod;
......@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
-- Copyright (C) 1992-2012, Free Software Foundation, Inc. --
-- Copyright (C) 1992-2014, 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- --
......@@ -51,7 +51,7 @@ package body System.Val_LLI is
-- Set to True if minus sign is present, otherwise to False
Start : Positive;
-- Saves location of first non-blank (not used in this case)
-- Saves location of first non-blank
begin
Scan_Sign (Str, Ptr, Max, Minus, Start);
......
......@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
-- Copyright (C) 1992-2012, Free Software Foundation, Inc. --
-- Copyright (C) 1992-2014, 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- --
......@@ -43,9 +43,9 @@ package System.Val_Util is
F, L : out Integer);
-- This procedure scans the string S setting F to be the index of the first
-- non-blank character of S and L to be the index of the last non-blank
-- character of S. Any lower case characters present in S will be folded
-- to their upper case equivalent except for character literals. If S
-- consists of entirely blanks then Constraint_Error is raised.
-- character of S. Any lower case characters present in S will be folded to
-- their upper case equivalent except for character literals. If S consists
-- of entirely blanks then Constraint_Error is raised.
--
-- Note: if S is the null string, F is set to S'First, L to S'Last
......@@ -60,25 +60,25 @@ package System.Val_Util is
-- last character in the string). Scan_Sign first scans out any initial
-- blanks, raising Constraint_Error if the field is all blank. It then
-- checks for and skips an initial plus or minus, requiring a non-blank
-- character to follow (Constraint_Error is raised if plus or minus
-- appears at the end of the string or with a following blank). Minus is
-- set True if a minus sign was skipped, and False otherwise. On exit
-- Ptr.all points to the character after the sign, or to the first
-- non-blank character if no sign is present. Start is set to the point
-- to the first non-blank character (sign or digit after it).
-- character to follow (Constraint_Error is raised if plus or minus appears
-- at the end of the string or with a following blank). Minus is set True
-- if a minus sign was skipped, and False otherwise. On exit Ptr.all points
-- to the character after the sign, or to the first non-blank character
-- if no sign is present. Start is set to the point to the first non-blank
-- character (sign or digit after it).
--
-- Note: if Str is null, i.e. if Max is less than Ptr, then this is a
-- special case of an all-blank string, and Ptr is unchanged, and hence
-- is greater than Max as required in this case. Constraint_Error is
-- also raised in this case.
-- is greater than Max as required in this case. Constraint_Error is also
-- raised in this case.
procedure Scan_Plus_Sign
(Str : String;
Ptr : not null access Integer;
Max : Integer;
Start : out Positive);
-- Same as Scan_Sign, but allows only plus, not minus.
-- This is used for modular types.
-- Same as Scan_Sign, but allows only plus, not minus. This is used for
-- modular types.
function Scan_Exponent
(Str : String;
......
......@@ -1056,7 +1056,12 @@ package body Sem_Ch12 is
Actuals := New_List;
Profile := New_List;
if Present (Actual) then
F := First_Formal (Entity (Actual));
else
F := First_Formal (Formal);
end if;
N_Parms := 0;
while Present (F) loop
......@@ -1066,7 +1071,9 @@ package body Sem_Ch12 is
New_F := Make_Temporary
(Loc, Character'Val (Character'Pos ('A') + N_Parms));
-- If a formal has a class-wide type, rewrite as the corresponding
if No (Actual) then
-- If formal has a class-wide type rewrite as the corresponding
-- attribute, because the class-wide type is not retrievable by
-- visbility.
......@@ -1076,6 +1083,14 @@ package body Sem_Ch12 is
Attribute_Name => Name_Class,
Prefix =>
Make_Identifier (Loc, Chars (Etype (Etype (F)))));
else
Parm_Type :=
Make_Identifier (Loc, Chars (Etype (Etype (F))));
end if;
-- If actual is present, use the type of its own formal
else
Parm_Type := New_Occurrence_Of (Etype (F), Loc);
end if;
......@@ -1766,8 +1781,7 @@ package body Sem_Ch12 is
else
if GNATprove_Mode
and then
Present
and then Present
(Containing_Package_With_Ext_Axioms
(Defining_Entity (Analyzed_Formal)))
and then Ekind (Defining_Entity (Analyzed_Formal)) =
......
......@@ -4246,6 +4246,11 @@ package Sinfo is
-- point operands if the Treat_Fixed_As_Integer flag is set and will
-- thus treat these nodes in identical manner, ignoring small values.
-- Note on equality/inequality tests for records. In the expanded tree,
-- record comparisons are always expanded to be a series of component
-- comparisons, so the back end will never see an equality or inequality
-- operation with operands of a record type.
-- Note on overflow handling: When the overflow checking mode is set to
-- MINIMIZED or ELIMINATED, nodes for signed arithmetic operations may
-- be modified to use a larger type for the operands and result. In
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment