diff options
author | Arnaud Charlet <charlet@gcc.gnu.org> | 2010-10-11 10:23:31 +0200 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2010-10-11 10:23:31 +0200 |
commit | 9694c03951602dd1216838de82dc1c2de54d2754 (patch) | |
tree | 683b8604bef46a8c1128c9c36abfc63a9c1e98cb | |
parent | 0144fd18d746179a058011b4339dd852a2805dda (diff) | |
download | gcc-9694c03951602dd1216838de82dc1c2de54d2754.zip gcc-9694c03951602dd1216838de82dc1c2de54d2754.tar.gz gcc-9694c03951602dd1216838de82dc1c2de54d2754.tar.bz2 |
[multiple changes]
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.
From-SVN: r165276
-rw-r--r-- | gcc/ada/ChangeLog | 26 | ||||
-rw-r--r-- | gcc/ada/Makefile.rtl | 6 | ||||
-rwxr-xr-x | gcc/ada/a-suenst.adb (renamed from gcc/ada/a-suesen.adb) | 6 | ||||
-rwxr-xr-x | gcc/ada/a-suenst.ads (renamed from gcc/ada/a-suesen.ads) | 8 | ||||
-rwxr-xr-x | gcc/ada/a-suewst.adb (renamed from gcc/ada/a-suewse.adb) | 6 | ||||
-rwxr-xr-x | gcc/ada/a-suewst.ads (renamed from gcc/ada/a-suewse.ads) | 8 | ||||
-rwxr-xr-x | gcc/ada/a-suezst.adb (renamed from gcc/ada/a-suezse.adb) | 6 | ||||
-rwxr-xr-x | gcc/ada/a-suezst.ads (renamed from gcc/ada/a-suezse.ads) | 8 | ||||
-rw-r--r-- | gcc/ada/a-textio.adb | 8 | ||||
-rw-r--r-- | gcc/ada/exp_ch5.adb | 39 | ||||
-rw-r--r-- | gcc/ada/impunit.adb | 6 | ||||
-rw-r--r-- | gcc/ada/rtsfind.ads | 1 | ||||
-rw-r--r-- | gcc/ada/sem_ch6.adb | 47 |
13 files changed, 119 insertions, 56 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index b9614a6..d216fcb 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,5 +1,31 @@ 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. diff --git a/gcc/ada/Makefile.rtl b/gcc/ada/Makefile.rtl index 856dd49..4989e79 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 index 263e6ec..d4207ed 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 index a8f913e..1706cd6 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 index 1b697b9..be8677a 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 index c013bad..e0f8d4c 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 index 2aaf6b8..0e5bba7 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 index 1882f42..86d344d 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 f8538ab..721deca 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 f53ac1f..a28c5ab 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 6b427f0..098622e 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 33621f5..ca61bd1 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 6957ed2..f5dcd5c 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; |