diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index b9614a6fc89..d216fcbe1a4 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,29 @@ +2010-10-11 Robert Dewar + + * a-textio.adb: Minor reformatting + +2010-10-11 Robert Dewar + + * 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 + + * exp_ch5.adb: Code clean up. + +2010-10-11 Ed Schonberg + + * 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 * s-multip.ads: Fix header. diff --git a/gcc/ada/Makefile.rtl b/gcc/ada/Makefile.rtl index 856dd496489..4989e794370 100644 --- a/gcc/ada/Makefile.rtl +++ b/gcc/ada/Makefile.rtl @@ -227,9 +227,9 @@ GNATRTL_NONTASKING_OBJS= \ 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) \ diff --git a/gcc/ada/a-suesen.adb b/gcc/ada/a-suenst.adb similarity index 98% rename from gcc/ada/a-suesen.adb rename to gcc/ada/a-suenst.adb index 263e6ec9241..d4207ed3e30 100755 --- a/gcc/ada/a-suesen.adb +++ b/gcc/ada/a-suenst.adb @@ -2,7 +2,7 @@ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- --- ADA.STRINGS.UTF_ENCODING.STRING_ENCODING -- +-- ADA.STRINGS.UTF_ENCODING.STRINGS -- -- -- -- B o d y -- -- -- @@ -29,7 +29,7 @@ -- -- ------------------------------------------------------------------------------ -package body Ada.Strings.UTF_Encoding.String_Encoding is +package body Ada.Strings.UTF_Encoding.Strings is use Interfaces; ------------ @@ -338,4 +338,4 @@ package body Ada.Strings.UTF_Encoding.String_Encoding is return Result; end Encode; -end Ada.Strings.UTF_Encoding.String_Encoding; +end Ada.Strings.UTF_Encoding.Strings; diff --git a/gcc/ada/a-suesen.ads b/gcc/ada/a-suenst.ads similarity index 93% rename from gcc/ada/a-suesen.ads rename to gcc/ada/a-suenst.ads index a8f913e454d..1706cd665e6 100755 --- a/gcc/ada/a-suesen.ads +++ b/gcc/ada/a-suenst.ads @@ -2,7 +2,7 @@ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- --- ADA.STRINGS.UTF_ENCODING.STRING_ENCODING -- +-- ADA.STRINGS.UTF_ENCODING.STRINGS -- -- -- -- S p e c -- -- -- @@ -17,8 +17,8 @@ -- 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 @@ -62,4 +62,4 @@ package Ada.Strings.UTF_Encoding.String_Encoding is (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; diff --git a/gcc/ada/a-suewse.adb b/gcc/ada/a-suewst.adb similarity index 98% rename from gcc/ada/a-suewse.adb rename to gcc/ada/a-suewst.adb index 1b697b91f9d..be8677ae67e 100755 --- a/gcc/ada/a-suewse.adb +++ b/gcc/ada/a-suewst.adb @@ -2,7 +2,7 @@ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- --- ADA.STRINGS.UTF_ENCODING.WIDE_STRING_ENCODING -- +-- ADA.STRINGS.UTF_ENCODING.WIDE_STRINGS -- -- -- -- B o d y -- -- -- @@ -29,7 +29,7 @@ -- -- ------------------------------------------------------------------------------ -package body Ada.Strings.UTF_Encoding.Wide_String_Encoding is +package body Ada.Strings.UTF_Encoding.Wide_Strings is use Interfaces; ------------ @@ -367,4 +367,4 @@ package body Ada.Strings.UTF_Encoding.Wide_String_Encoding is return Result; end Encode; -end Ada.Strings.UTF_Encoding.Wide_String_Encoding; +end Ada.Strings.UTF_Encoding.Wide_Strings; diff --git a/gcc/ada/a-suewse.ads b/gcc/ada/a-suewst.ads similarity index 93% rename from gcc/ada/a-suewse.ads rename to gcc/ada/a-suewst.ads index c013bad6976..e0f8d4cf5ed 100755 --- a/gcc/ada/a-suewse.ads +++ b/gcc/ada/a-suewst.ads @@ -2,7 +2,7 @@ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- --- ADA.STRINGS.UTF_ENCODING.WIDE_STRING_ENCODING -- +-- ADA.STRINGS.UTF_ENCODING.WIDE_STRINGS -- -- -- -- S p e c -- -- -- @@ -17,8 +17,8 @@ -- 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 @@ -64,4 +64,4 @@ package Ada.Strings.UTF_Encoding.Wide_String_Encoding is (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; diff --git a/gcc/ada/a-suezse.adb b/gcc/ada/a-suezst.adb similarity index 98% rename from gcc/ada/a-suezse.adb rename to gcc/ada/a-suezst.adb index 2aaf6b8329f..0e5bba70a7c 100755 --- a/gcc/ada/a-suezse.adb +++ b/gcc/ada/a-suezst.adb @@ -2,7 +2,7 @@ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- --- ADA.STRINGS.UTF_ENCODING.WIDE_WIDE_STRING_ENCODING -- +-- ADA.STRINGS.UTF_ENCODING.WIDE_WIDE_STRINGS -- -- -- -- B o d y -- -- -- @@ -29,7 +29,7 @@ -- -- ------------------------------------------------------------------------------ -package body Ada.Strings.UTF_Encoding.Wide_Wide_String_Encoding is +package body Ada.Strings.UTF_Encoding.Wide_Wide_Strings is use Interfaces; ------------ @@ -426,4 +426,4 @@ package body Ada.Strings.UTF_Encoding.Wide_Wide_String_Encoding is return Result (1 .. Len); end Encode; -end Ada.Strings.UTF_Encoding.Wide_Wide_String_Encoding; +end Ada.Strings.UTF_Encoding.Wide_Wide_Strings; diff --git a/gcc/ada/a-suezse.ads b/gcc/ada/a-suezst.ads similarity index 93% rename from gcc/ada/a-suezse.ads rename to gcc/ada/a-suezst.ads index 1882f426d8e..86d344d252d 100755 --- a/gcc/ada/a-suezse.ads +++ b/gcc/ada/a-suezst.ads @@ -2,7 +2,7 @@ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- --- ADA.STRINGS.UTF_ENCODING.WIDE_WIDE_STRING_ENCODING -- +-- ADA.STRINGS.UTF_ENCODING.WIDE_WIDE_STRINGS -- -- -- -- S p e c -- -- -- @@ -18,8 +18,8 @@ -- 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 @@ -61,4 +61,4 @@ package Ada.Strings.UTF_Encoding.Wide_Wide_String_Encoding is (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; diff --git a/gcc/ada/a-textio.adb b/gcc/ada/a-textio.adb index f8538abde51..721deca032b 100644 --- a/gcc/ada/a-textio.adb +++ b/gcc/ada/a-textio.adb @@ -684,10 +684,18 @@ package body Ada.Text_IO is 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; diff --git a/gcc/ada/exp_ch5.adb b/gcc/ada/exp_ch5.adb index f53ac1f57cb..a28c5ab1be0 100644 --- a/gcc/ada/exp_ch5.adb +++ b/gcc/ada/exp_ch5.adb @@ -3151,8 +3151,11 @@ package body Exp_Ch5 is 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 @@ -4248,29 +4251,35 @@ package body Exp_Ch5 is 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 diff --git a/gcc/ada/impunit.adb b/gcc/ada/impunit.adb index 6b427f0de1b..098622eeaf9 100644 --- a/gcc/ada/impunit.adb +++ b/gcc/ada/impunit.adb @@ -180,8 +180,8 @@ package body Impunit is "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 -- @@ -474,7 +474,7 @@ package body Impunit is -- 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 -- diff --git a/gcc/ada/rtsfind.ads b/gcc/ada/rtsfind.ads index 33621f5bfb8..ca61bd120a6 100644 --- a/gcc/ada/rtsfind.ads +++ b/gcc/ada/rtsfind.ads @@ -265,7 +265,6 @@ package Rtsfind is System_Machine_Code, System_Mantissa, System_Memcop, - System_Multiprocessors, System_Pack_03, System_Pack_05, System_Pack_06, diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb index 6957ed277c4..f5dcd5c4713 100644 --- a/gcc/ada/sem_ch6.adb +++ b/gcc/ada/sem_ch6.adb @@ -495,8 +495,16 @@ package body Sem_Ch6 is -- 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); @@ -512,9 +520,11 @@ package body Sem_Ch6 is 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; @@ -764,16 +774,25 @@ package body Sem_Ch6 is 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) @@ -4255,9 +4274,11 @@ package body Sem_Ch6 is 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;