OSDN Git Service

2010-10-11 Robert Dewar <dewar@adacore.com>
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 11 Oct 2010 08:23:31 +0000 (08:23 +0000)
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 11 Oct 2010 08:23:31 +0000 (08:23 +0000)
* 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

13 files changed:
gcc/ada/ChangeLog
gcc/ada/Makefile.rtl
gcc/ada/a-suenst.adb [moved from gcc/ada/a-suesen.adb with 98% similarity]
gcc/ada/a-suenst.ads [moved from gcc/ada/a-suesen.ads with 93% similarity]
gcc/ada/a-suewst.adb [moved from gcc/ada/a-suewse.adb with 98% similarity]
gcc/ada/a-suewst.ads [moved from gcc/ada/a-suewse.ads with 93% similarity]
gcc/ada/a-suezst.adb [moved from gcc/ada/a-suezse.adb with 98% similarity]
gcc/ada/a-suezst.ads [moved from gcc/ada/a-suezse.ads with 93% similarity]
gcc/ada/a-textio.adb
gcc/ada/exp_ch5.adb
gcc/ada/impunit.adb
gcc/ada/rtsfind.ads
gcc/ada/sem_ch6.adb

index b9614a6..d216fcb 100644 (file)
@@ -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.
 
index 856dd49..4989e79 100644 (file)
@@ -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) \
similarity index 98%
rename from gcc/ada/a-suesen.adb
rename to gcc/ada/a-suenst.adb
index 263e6ec..d4207ed 100755 (executable)
@@ -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;
similarity index 93%
rename from gcc/ada/a-suesen.ads
rename to gcc/ada/a-suenst.ads
index a8f913e..1706cd6 100755 (executable)
@@ -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;
similarity index 98%
rename from gcc/ada/a-suewse.adb
rename to gcc/ada/a-suewst.adb
index 1b697b9..be8677a 100755 (executable)
@@ -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;
similarity index 93%
rename from gcc/ada/a-suewse.ads
rename to gcc/ada/a-suewst.ads
index c013bad..e0f8d4c 100755 (executable)
@@ -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;
similarity index 98%
rename from gcc/ada/a-suezse.adb
rename to gcc/ada/a-suezst.adb
index 2aaf6b8..0e5bba7 100755 (executable)
@@ -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;
similarity index 93%
rename from gcc/ada/a-suezse.ads
rename to gcc/ada/a-suezst.ads
index 1882f42..86d344d 100755 (executable)
@@ -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;
index f8538ab..721deca 100644 (file)
@@ -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;
index f53ac1f..a28c5ab 100644 (file)
@@ -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
index 6b427f0..098622e 100644 (file)
@@ -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 --
index 33621f5..ca61bd1 100644 (file)
@@ -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,
index 6957ed2..f5dcd5c 100644 (file)
@@ -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;