+2012-01-06 Robert Dewar <dewar@adacore.com>
+
+ * a-wichha.ads, a-wichun.ads, a-zchhan.ads, a-zchuni.ads,
+ s-utf_32.ads: Add pragma Pure
+ * s-utf_32.adb: Suppress warnings on non-static constants (now
+ that this is Pure).
+
+2012-01-06 Bob Duff <duff@adacore.com>
+
+ * s-rpc.ads (Read, Write): Add overriding indicators.
+
+2012-01-06 Robert Dewar <dewar@adacore.com>
+
+ * gnat_rm.texi: Add documentation for conventions
+ Ada_Pass_By_Copy and Ada_Pass_By_Reference.
+
+2012-01-06 Gary Dismukes <dismukes@adacore.com>
+
+ * a-tienio.adb (Put): Add exception message on
+ raise statements. Remove unneeded blocks and object declarations.
+
+2012-01-06 Robert Dewar <dewar@adacore.com>
+
+ * sem_prag.adb: Minor reformatting.
+
+2012-01-06 Ed Schonberg <schonberg@adacore.com>
+
+ * sinfo.ads, sinfo.adb (Has_Prefixed_Call): New flag to indicate
+ that a selected component within a generic unit has been resolved
+ as a prefixed call with local references.
+ * sem_ch3.adb (Is_Visible_Component): In an instance body a selected
+ component is always visible.
+ * sem_ch4.adb (Analyze_Selected_Component): If the node is a
+ prefixed call in an instance, do not look for visible components
+ of the type.
+ * sem_ch12.adb (Reset_Entity): If a selected component has resolved
+ to a prefixed call, mark the node accordingly when prefix and
+ selector are local references.
+
2012-01-02 Eric Botcazou <ebotcazou@adacore.com>
* gnatvsn.ads (Current_Year): Bump to 2012.
-- checks suppressed, which includes instantiated generics.
if not Item'Valid then
- raise Constraint_Error;
+ raise Constraint_Error with "invalid enumeration value";
end if;
- declare
- Image : constant String := Enum'Image (Item);
- begin
- Aux.Put (File, Image, Width, Set);
- end;
+ Aux.Put (File, Enum'Image (Item), Width, Set);
end Put;
procedure Put
-- checks suppressed, which includes instantiated generics.
if not Item'Valid then
- raise Constraint_Error;
+ raise Constraint_Error with "invalid enumeration value";
end if;
- declare
- Image : constant String := Enum'Image (Item);
- begin
- Aux.Puts (To, Image, Set);
- end;
+ Aux.Puts (To, Enum'Image (Item), Set);
end Put;
end Ada.Text_IO.Enumeration_IO;
------------------------------------------------------------------------------
package Ada.Wide_Characters.Handling is
+ pragma Pure;
+ -- This package is clearly intended to be Pure, by analogy with the
+ -- base Ada.Characters.Handling package. The version in the RM does
+ -- not yet have this pragma, but that is a clear omission. This will
+ -- be fixed in a future version of AI05-0266-1.
function Is_Control (Item : Wide_Character) return Boolean;
pragma Inline (Is_Control);
-- --
-- S p e c --
-- --
--- Copyright (C) 2005-2010, Free Software Foundation, Inc. --
+-- Copyright (C) 2005-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- --
with System.UTF_32;
package Ada.Wide_Characters.Unicode is
+ pragma Pure;
-- The following type defines the categories from the unicode definitions.
-- The one addition we make is Fe, which represents the characters FFFE
------------------------------------------------------------------------------
package Ada.Wide_Wide_Characters.Handling is
+ pragma Pure;
+ -- This package is clearly intended to be Pure, by analogy with the
+ -- base Ada.Characters.Handling package. The version in the RM does
+ -- not yet have this pragma, but that is a clear omission. This will
+ -- be fixed in a future version of AI05-0266-1.
function Is_Control (Item : Wide_Wide_Character) return Boolean;
pragma Inline (Is_Control);
-- --
-- S p e c --
-- --
--- Copyright (C) 2005-2010, Free Software Foundation, Inc. --
+-- Copyright (C) 2005-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- --
with System.UTF_32;
package Ada.Wide_Wide_Characters.Unicode is
+ pragma Pure;
-- The following type defines the categories from the unicode definitions.
-- The one addition we make is Fe, which represents the characters FFFE
@table @code
@item Ada
Ada
+@item Ada_Pass_By_Copy
+Allowed for any types except by-reference types such as limited
+records. Compatible with convention Ada, but causes any parameters
+with this convention to be passed by copy.
+@item Ada_Pass_By_Reference
+Allowed for any types except by-copy types such as scalars.
+Compatible with convention Ada, but causes any parameters
+with this convention to be passed by reference.
@item Assembler
Assembly language
@item Asm
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2011, Free Software Foundation, Inc. --
-- --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT. The copyright notice above, and the license provisions that follow --
(Initial_Size : Ada.Streams.Stream_Element_Count) is new
Ada.Streams.Root_Stream_Type with private;
- procedure Read
+ overriding procedure Read
(Stream : in out Params_Stream_Type;
Item : out Ada.Streams.Stream_Element_Array;
Last : out Ada.Streams.Stream_Element_Offset);
- procedure Write
+ overriding procedure Write
(Stream : in out Params_Stream_Type;
Item : Ada.Streams.Stream_Element_Array);
-- --
-- B o d y --
-- --
--- Copyright (C) 2005-2011, Free Software Foundation, Inc. --
+-- Copyright (C) 2005-2012, 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- --
pragma Style_Checks (Off);
-- Allow long lines in this unit
+-- pragma Warnings (Off, "non-static constant in preelaborated unit");
+-- We need this to be pure, and the three constants in question are not a
+-- real problem, they are completely known at compile time. This pragma
+-- is commented out for now, because we still want to be able to bootstrap
+-- with old versions of the compiler that did not support this form. We
+-- have added additional pragma Warnings (Off/On) for now ???
+
package body System.UTF_32 is
----------------------
(16#F0000#, 16#FFFFD#), -- (Co) <Plane 15 Private Use, First> .. <Plane 15 Private Use, Last>
(16#100000#, 16#10FFFD#)); -- (Co) <Plane 16 Private Use, First> .. <Plane 16 Private Use, Last>
+ pragma Warnings (Off);
+ -- Temporary, until pragma at start can be activated ???
+
-- The following array is parallel to the Unicode_Ranges table above. For
-- each entry in the Unicode_Ranges table, there is a corresponding entry
-- in the following table indicating the corresponding unicode category.
40, -- DESERET CAPITAL LETTER LONG I .. DESERET CAPITAL LETTER EW
32); -- TAG LATIN CAPITAL LETTER A .. TAG LATIN CAPITAL LETTER Z
+ pragma Warnings (On);
+ -- Temporary until pragma Warnings at start can be activated ???
+
-- The following is a list of the 10646 names for CAPITAL LETTER entries
-- that have no matching SMALL LETTER entry and are thus not folded
-- --
-- S p e c --
-- --
--- Copyright (C) 2005-2010, Free Software Foundation, Inc. --
+-- Copyright (C) 2005-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- --
pragma Compiler_Unit;
package System.UTF_32 is
+ pragma Pure;
type UTF_32 is range 0 .. 16#7FFF_FFFF#;
-- So far, the only defined character codes are in 0 .. 16#01_FFFF#
Save_Entity_Descendants (N);
else
+ Set_Is_Prefixed_Call (Parent (N));
Set_Associated_Node (N, Empty);
Set_Etype (N, Empty);
end if;
-- In Ada 2005, X.F may be a call to a primitive operation,
-- rewritten as F (X). This rewriting will be done again in an
-- instance, so keep the original node. Global entities will be
- -- captured as for other constructs.
+ -- captured as for other constructs. Indicate that this must
+ -- resolve as a call, to prevent accidental overloading in the
+ -- instance, if both a component and a primitive operation appear
+ -- as candidates.
else
- null;
+ Set_Is_Prefixed_Call (Parent (N));
end if;
-- Entity is local. Reset in generic unit, so that node is resolved
then
return True;
- -- If we are in the body of an instantiation, the component is visible
- -- if the parent type is non-private, or in an enclosing scope. The
- -- scope stack is not present when analyzing an instance body, so we
- -- must inspect the chain of scopes explicitly.
+ -- In the body of an instantiation, no need to check for the visibility
+ -- of a component.
elsif In_Instance_Body then
- if not Is_Private_Type (Scope (C)) then
- return True;
-
- else
- declare
- S : Entity_Id;
-
- begin
- S := Current_Scope;
- while Present (S)
- and then S /= Standard_Standard
- loop
- if S = Type_Scope then
- return True;
- end if;
-
- S := Scope (S);
- end loop;
-
- return False;
- end;
- end if;
+ return True;
-- If the component has been declared in an ancestor which is currently
-- a private type, then it is not visible. The same applies if the
elsif Is_Record_Type (Prefix_Type) then
-- Find component with given name
+ -- In an instance, if the node is known as a prefixed call, do
+ -- not examine components whose visibility may be accidental.
- while Present (Comp) loop
+ while Present (Comp) and then not Is_Prefixed_Call (N) loop
if Chars (Comp) = Chars (Sel)
and then Is_Visible_Component (Comp)
then
-- the formal may be wrapped in a conversion if the
-- actual is a conversion. Retrieve the real entity name.
- if (In_Instance_Body or else In_Inlined_Body)
+ if (In_Instance_Body or In_Inlined_Body)
and then Nkind (E_Id) = N_Unchecked_Type_Conversion
then
E_Id := Expression (E_Id);
return Flag13 (N);
end Is_Power_Of_2_For_Shift;
+ function Is_Prefixed_Call
+ (N : Node_Id) return Boolean is
+ begin
+ pragma Assert (False
+ or else NT (N).Nkind = N_Selected_Component);
+ return Flag17 (N);
+ end Is_Prefixed_Call;
+
function Is_Protected_Subprogram_Body
(N : Node_Id) return Boolean is
begin
Set_Flag13 (N, Val);
end Set_Is_Power_Of_2_For_Shift;
+ procedure Set_Is_Prefixed_Call
+ (N : Node_Id; Val : Boolean := True) is
+ begin
+ pragma Assert (False
+ or else NT (N).Nkind = N_Selected_Component);
+ Set_Flag17 (N, Val);
+ end Set_Is_Prefixed_Call;
+
procedure Set_Is_Protected_Subprogram_Body
(N : Node_Id; Val : Boolean := True) is
begin
-- conditions holds, and the flag is set, then the division or
-- multiplication can be (and is) converted to a shift.
+ -- Is_Prefixed_Call (Flag17-Sem)
+ -- This flag is set in a selected component within a generic unit, if
+ -- it resolves to a prefixed call to a primitive operation. The flag
+ -- is used to prevent accidental overloadings in an instance, when a
+ -- primitive operation and a private record component may be homographs.
+
-- Is_Protected_Subprogram_Body (Flag7-Sem)
-- A flag set in a Subprogram_Body block to indicate that it is the
-- implementation of a protected subprogram. Such a body needs cleanup
-- Associated_Node (Node4-Sem)
-- Do_Discriminant_Check (Flag13-Sem)
-- Is_In_Discriminant_Check (Flag11-Sem)
+ -- Is_Prefixed_Call (Flag17-Sem)
-- Atomic_Sync_Required (Flag14-Sem)
-- plus fields for expression
function Is_Power_Of_2_For_Shift
(N : Node_Id) return Boolean; -- Flag13
+ function Is_Prefixed_Call
+ (N : Node_Id) return Boolean; -- Flag17
+
function Is_Protected_Subprogram_Body
(N : Node_Id) return Boolean; -- Flag7
procedure Set_Is_Power_Of_2_For_Shift
(N : Node_Id; Val : Boolean := True); -- Flag13
+ procedure Set_Is_Prefixed_Call
+ (N : Node_Id; Val : Boolean := True); -- Flag17
+
procedure Set_Is_Protected_Subprogram_Body
(N : Node_Id; Val : Boolean := True); -- Flag7
pragma Inline (Is_Null_Loop);
pragma Inline (Is_Overloaded);
pragma Inline (Is_Power_Of_2_For_Shift);
+ pragma Inline (Is_Prefixed_Call);
pragma Inline (Is_Protected_Subprogram_Body);
pragma Inline (Is_Static_Coextension);
pragma Inline (Is_Static_Expression);
pragma Inline (Set_Is_Null_Loop);
pragma Inline (Set_Is_Overloaded);
pragma Inline (Set_Is_Power_Of_2_For_Shift);
+ pragma Inline (Set_Is_Prefixed_Call);
pragma Inline (Set_Is_Protected_Subprogram_Body);
pragma Inline (Set_Has_Self_Reference);
pragma Inline (Set_Is_Static_Coextension);