* a-textio.adb: Minor reformatting
2010-10-11 Robert Dewar <dewar@adacore.com>
* a-suesen.ads, a-suenst.ads,
a-suesen.adb, a-suenst.adb,
a-suewse.adb, a-suewst.adb,
a-suewse.ads, a-suewst.ads,
a-suezse.ads, a-suezst.ads,
a-suezse.adb, a-suezst.adb: New name for string encoding packages.
* impunit.adb: New names for string encoding units
* Makefile.rtl: New names for string encoding units
* rtsfind.ads: Minor code reorganization.
2010-10-11 Ed Schonberg <schonberg@adacore.com>
* exp_ch5.adb: Code clean up.
2010-10-11 Ed Schonberg <schonberg@adacore.com>
* sem_ch6.adb (Check_Limited_Return): Specialize warning on limited
returns when in a generic context.
(Analyze_Function_Return): ditto.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@165276
138bc75d-0d04-0410-961f-
82ee72b054a4
2010-10-11 Robert Dewar <dewar@adacore.com>
+ * a-textio.adb: Minor reformatting
+
+2010-10-11 Robert Dewar <dewar@adacore.com>
+
+ * a-suesen.ads, a-suenst.ads,
+ a-suesen.adb, a-suenst.adb,
+ a-suewse.adb, a-suewst.adb,
+ a-suewse.ads, a-suewst.ads,
+ a-suezse.ads, a-suezst.ads,
+ a-suezse.adb, a-suezst.adb: New name for string encoding packages.
+ * impunit.adb: New names for string encoding units
+ * Makefile.rtl: New names for string encoding units
+ * rtsfind.ads: Minor code reorganization.
+
+2010-10-11 Ed Schonberg <schonberg@adacore.com>
+
+ * exp_ch5.adb: Code clean up.
+
+2010-10-11 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_ch6.adb (Check_Limited_Return): Specialize warning on limited
+ returns when in a generic context.
+ (Analyze_Function_Return): ditto.
+
+2010-10-11 Robert Dewar <dewar@adacore.com>
+
* s-multip.ads: Fix header.
* sem_ch3.adb, s-multip.adb, a-tigeli.adb: Minor reformatting.
a-stzsup$(objext) \
a-stzunb$(objext) \
a-suenco$(objext) \
- a-suesen$(objext) \
- a-suewse$(objext) \
- a-suezse$(objext) \
+ a-suenst$(objext) \
+ a-suewst$(objext) \
+ a-suezst$(objext) \
a-suteio$(objext) \
a-swbwha$(objext) \
a-swfwha$(objext) \
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
--- ADA.STRINGS.UTF_ENCODING.STRING_ENCODING --
+-- ADA.STRINGS.UTF_ENCODING.STRINGS --
-- --
-- B o d y --
-- --
-- --
------------------------------------------------------------------------------
-package body Ada.Strings.UTF_Encoding.String_Encoding is
+package body Ada.Strings.UTF_Encoding.Strings is
use Interfaces;
------------
return Result;
end Encode;
-end Ada.Strings.UTF_Encoding.String_Encoding;
+end Ada.Strings.UTF_Encoding.Strings;
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
--- ADA.STRINGS.UTF_ENCODING.STRING_ENCODING --
+-- ADA.STRINGS.UTF_ENCODING.STRINGS --
-- --
-- S p e c --
-- --
-- and decoding String values using UTF encodings. Note: this package is
-- consistent with Ada 95, and may be included in Ada 95 implementations.
-package Ada.Strings.UTF_Encoding.String_Encoding is
- pragma Pure (String_Encoding);
+package Ada.Strings.UTF_Encoding.Strings is
+ pragma Pure (Strings);
-- The encoding routines take a String as input and encode the result
-- using the specified UTF encoding method. The result includes a BOM if
(Item : UTF_16_Wide_String) return String;
-- The input is encoded in UTF-16 and returned as a String value
-end Ada.Strings.UTF_Encoding.String_Encoding;
+end Ada.Strings.UTF_Encoding.Strings;
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
--- ADA.STRINGS.UTF_ENCODING.WIDE_STRING_ENCODING --
+-- ADA.STRINGS.UTF_ENCODING.WIDE_STRINGS --
-- --
-- B o d y --
-- --
-- --
------------------------------------------------------------------------------
-package body Ada.Strings.UTF_Encoding.Wide_String_Encoding is
+package body Ada.Strings.UTF_Encoding.Wide_Strings is
use Interfaces;
------------
return Result;
end Encode;
-end Ada.Strings.UTF_Encoding.Wide_String_Encoding;
+end Ada.Strings.UTF_Encoding.Wide_Strings;
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
--- ADA.STRINGS.UTF_ENCODING.WIDE_STRING_ENCODING --
+-- ADA.STRINGS.UTF_ENCODING.WIDE_STRINGS --
-- --
-- S p e c --
-- --
-- and decoding Wide_String values using UTF encodings. Note: this package is
-- consistent with Ada 95, and may be included in Ada 95 implementations.
-package Ada.Strings.UTF_Encoding.Wide_String_Encoding is
- pragma Pure (Wide_String_Encoding);
+package Ada.Strings.UTF_Encoding.Wide_Strings is
+ pragma Pure (Wide_Strings);
-- The encoding routines take a Wide_String as input and encode the result
-- using the specified UTF encoding method. The result includes a BOM if
(Item : UTF_16_Wide_String) return Wide_String;
-- The input is encoded in UTF-16 and returned as a Wide_String value
-end Ada.Strings.UTF_Encoding.Wide_String_Encoding;
+end Ada.Strings.UTF_Encoding.Wide_Strings;
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
--- ADA.STRINGS.UTF_ENCODING.WIDE_WIDE_STRING_ENCODING --
+-- ADA.STRINGS.UTF_ENCODING.WIDE_WIDE_STRINGS --
-- --
-- B o d y --
-- --
-- --
------------------------------------------------------------------------------
-package body Ada.Strings.UTF_Encoding.Wide_Wide_String_Encoding is
+package body Ada.Strings.UTF_Encoding.Wide_Wide_Strings is
use Interfaces;
------------
return Result (1 .. Len);
end Encode;
-end Ada.Strings.UTF_Encoding.Wide_Wide_String_Encoding;
+end Ada.Strings.UTF_Encoding.Wide_Wide_Strings;
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
--- ADA.STRINGS.UTF_ENCODING.WIDE_WIDE_STRING_ENCODING --
+-- ADA.STRINGS.UTF_ENCODING.WIDE_WIDE_STRINGS --
-- --
-- S p e c --
-- --
-- consistent with Ada 2005, and may be used in Ada 2005 mode, but cannot be
-- used in Ada 95 mode, since Wide_Wide_Character is an Ada 2005 feature.
-package Ada.Strings.UTF_Encoding.Wide_Wide_String_Encoding is
- pragma Pure (Wide_Wide_String_Encoding);
+package Ada.Strings.UTF_Encoding.Wide_Wide_Strings is
+ pragma Pure (Wide_Wide_Strings);
-- The encoding routines take a Wide_Wide_String as input and encode the
-- result using the specified UTF encoding method. The result includes a
(Item : UTF_16_Wide_String) return Wide_Wide_String;
-- The input is encoded in UTF-16 and returned as a Wide_String value
-end Ada.Strings.UTF_Encoding.Wide_Wide_String_Encoding;
+end Ada.Strings.UTF_Encoding.Wide_Wide_Strings;
Get_Immediate (Current_In, Item, Available);
end Get_Immediate;
+ --------------
+ -- Get_Line --
+ --------------
+
procedure Get_Line
(File : File_Type;
Item : out String;
Last : out Natural) is separate;
+ -- The implementation of Ada.Text_IO.Get_Line is split into a subunit so
+ -- that different implementations can be used on different systems. In
+ -- particular the standard implementation uses low level stuff that is
+ -- not appropriate for the JVM and .NET implementations.
procedure Get_Line
(Item : out String;
else
-- We're about to drop Return_Object_Declarations on the floor, so
-- we need to insert it, in case it got expanded into useful code.
+ -- Remove side effects from expression, which may be duplicated in
+ -- subsequent checks (see Expand_Simple_Function_Return).
Insert_List_Before (N, Return_Object_Declarations (N));
+ Remove_Side_Effects (Exp);
-- Build simple_return_statement that returns the expression directly
end;
-- AI05-0073: If function has a controlling access result, check that
- -- the tag of the return value matches the designated type.
+ -- the tag of the return value, if it is not null, matches designated
+ -- type of return type.
-- The "or else True" needs commenting here ???
elsif Ekind (R_Type) = E_Anonymous_Access_Type
and then Has_Controlling_Result (Scope_Id)
- and then (Ada_Version >= Ada_12 or else True)
then
- Insert_Action (Exp,
+ Insert_Action (N,
Make_Raise_Constraint_Error (Loc,
Condition =>
- Make_Op_Ne (Loc,
- Left_Opnd =>
- Make_Selected_Component (Loc,
- Prefix => Duplicate_Subexpr (Exp),
- Selector_Name =>
- Make_Identifier (Loc, Chars => Name_uTag)),
- Right_Opnd =>
- Make_Attribute_Reference (Loc,
- Prefix =>
- New_Occurrence_Of (Designated_Type (R_Type), Loc),
- Attribute_Name => Name_Tag)),
- Reason => CE_Tag_Check_Failed));
+ Make_And_Then (Loc,
+ Left_Opnd =>
+ Make_Op_Ne (Loc,
+ Left_Opnd => Exp,
+ Right_Opnd => Make_Null (Loc)),
+ Right_Opnd => Make_Op_Ne (Loc,
+ Left_Opnd =>
+ Make_Selected_Component (Loc,
+ Prefix => Duplicate_Subexpr (Exp),
+ Selector_Name =>
+ Make_Identifier (Loc, Chars => Name_uTag)),
+ Right_Opnd =>
+ Make_Attribute_Reference (Loc,
+ Prefix =>
+ New_Occurrence_Of (Designated_Type (R_Type), Loc),
+ Attribute_Name => Name_Tag))),
+ Reason => CE_Tag_Check_Failed),
+ Suppress => All_Checks);
end if;
-- If we are returning an object that may not be bit-aligned, then copy
"a-wichha", -- Ada.Wide_Characters.Handling
"a-stuten", -- Ada.Strings.UTF_Encoding
"a-suenco", -- Ada.Strings.UTF_Encoding.Conversions
- "a-suesen", -- Ada.Strings.UTF_Encoding.String_Encoding
- "a-suewse", -- Ada.Strings.UTF_Encoding.Wide_String_Encoding
+ "a-suenst", -- Ada.Strings.UTF_Encoding.Strings
+ "a-suewst", -- Ada.Strings.UTF_Encoding.Wide_Strings
---------------------------
-- GNAT Special IO Units --
-- Note: strictly the following should be Ada 2012 units, but it seems
-- harmless (and useful) to make then available in Ada 2005 mode.
- "a-suezse", -- Ada.Strings.UTF_Encoding.Wide_Wide_String_Encoding
+ "a-suezst", -- Ada.Strings.UTF_Encoding.Wide_Wide_Strings
---------------------------
-- GNAT Special IO Units --
System_Machine_Code,
System_Mantissa,
System_Memcop,
- System_Multiprocessors,
System_Pack_03,
System_Pack_05,
System_Pack_06,
-- In GNAT mode, this is just a warning, to allow it to be
-- evilly turned off. Otherwise it is a real error.
+ -- In a generic context, simplify the warning because it makes
+ -- no sense to discuss pass-by-reference or copy.
+
elsif Warn_On_Ada_2005_Compatibility or GNAT_Mode then
- if Is_Immutably_Limited_Type (R_Type) then
+ if Inside_A_Generic then
+ Error_Msg_N
+ ("return of limited object not permitted in Ada2005 " &
+ "(RM-2005 6.5(5.5/2))?", Expr);
+
+ elsif Is_Immutably_Limited_Type (R_Type) then
Error_Msg_N
("return by reference not permitted in Ada 2005 " &
"(RM-2005 6.5(5.5/2))?", Expr);
return; -- skip continuation messages below
end if;
- Error_Msg_N
- ("\consider switching to return of access type", Expr);
- Explain_Limited_Type (R_Type, Expr);
+ if not Inside_A_Generic then
+ Error_Msg_N
+ ("\consider switching to return of access type", Expr);
+ Explain_Limited_Type (R_Type, Expr);
+ end if;
end if;
end Check_Limited_Return;
and then Object_Access_Level (Expr) >
Subprogram_Access_Level (Scope_Id)
then
- Rewrite (N,
- Make_Raise_Program_Error (Loc,
- Reason => PE_Accessibility_Check_Failed));
- Analyze (N);
- Error_Msg_N
- ("cannot return a local value by reference?", N);
- Error_Msg_NE
- ("\& will be raised at run time?",
- N, Standard_Program_Error);
+ -- Suppress the message in a generic, where the rewriting
+ -- is irrelevant.
+
+ if Inside_A_Generic then
+ null;
+
+ else
+ Rewrite (N,
+ Make_Raise_Program_Error (Loc,
+ Reason => PE_Accessibility_Check_Failed));
+ Analyze (N);
+
+ Error_Msg_N
+ ("cannot return a local value by reference?", N);
+ Error_Msg_NE
+ ("\& will be raised at run time?",
+ N, Standard_Program_Error);
+ end if;
end if;
if Known_Null (Expr)
declare
Typ : constant Entity_Id := Etype (Designator);
Utyp : constant Entity_Id := Underlying_Type (Typ);
+
begin
if Is_Immutably_Limited_Type (Typ) then
Set_Returns_By_Ref (Designator);
+
elsif Present (Utyp) and then CW_Or_Has_Controlled_Part (Utyp) then
Set_Returns_By_Ref (Designator);
end if;