]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[multiple changes]
authorArnaud Charlet <charlet@gcc.gnu.org>
Fri, 8 Oct 2010 13:02:55 +0000 (15:02 +0200)
committerArnaud Charlet <charlet@gcc.gnu.org>
Fri, 8 Oct 2010 13:02:55 +0000 (15:02 +0200)
2010-10-08  Robert Dewar  <dewar@adacore.com>

* sem_prag.adb (Check_Duplicate_Pragma): New procedure
Add calls to this new procedure where appropriate

2010-10-08  Vincent Celier  <celier@adacore.com>

* a-textio.adb (Get_Chunk): Code clean up.

2010-10-08  Robert Dewar  <dewar@adacore.com>

* a-strbou.ads, a-strfix.adb, a-strfix.ads, a-strsea.adb, a-strsea.ads,
a-strsup.adb, a-strsup.ads, a-strunb-shared.adb, a-strunb-shared.ads,
a-strunb.adb, a-strunb.ads, a-stwibo.ads, a-stwifi.adb, a-stwifi.ads,
a-stwise.adb, a-stwise.ads, a-stwisu.adb, a-stwisu.ads,
a-stwiun-shared.adb, a-stwiun-shared.ads, a-stwiun.adb, a-stwiun.ads,
a-stzbou.ads, a-stzfix.adb, a-stzfix.ads, a-stzsea.adb, a-stzsea.ads,
a-stzsup.adb, a-stzsup.ads, a-stzunb-shared.adb, a-stzunb-shared.ads,
a-stzunb.adb, a-stzunb.ads (Find_Token): New version with From
parameter.

From-SVN: r165174

36 files changed:
gcc/ada/ChangeLog
gcc/ada/a-strbou.ads
gcc/ada/a-strfix.adb
gcc/ada/a-strfix.ads
gcc/ada/a-strsea.adb
gcc/ada/a-strsea.ads
gcc/ada/a-strsup.adb
gcc/ada/a-strsup.ads
gcc/ada/a-strunb-shared.adb
gcc/ada/a-strunb-shared.ads
gcc/ada/a-strunb.adb
gcc/ada/a-strunb.ads
gcc/ada/a-stwibo.ads
gcc/ada/a-stwifi.adb
gcc/ada/a-stwifi.ads
gcc/ada/a-stwise.adb
gcc/ada/a-stwise.ads
gcc/ada/a-stwisu.adb
gcc/ada/a-stwisu.ads
gcc/ada/a-stwiun-shared.adb
gcc/ada/a-stwiun-shared.ads
gcc/ada/a-stwiun.adb
gcc/ada/a-stwiun.ads
gcc/ada/a-stzbou.ads
gcc/ada/a-stzfix.adb
gcc/ada/a-stzfix.ads
gcc/ada/a-stzsea.adb
gcc/ada/a-stzsea.ads
gcc/ada/a-stzsup.adb
gcc/ada/a-stzsup.ads
gcc/ada/a-stzunb-shared.adb
gcc/ada/a-stzunb-shared.ads
gcc/ada/a-stzunb.adb
gcc/ada/a-stzunb.ads
gcc/ada/a-textio.adb
gcc/ada/sem_prag.adb

index b47253fa4a3013c2072ac905cc076abbcef317b2..68b248fab51771a892834b542ffd858c8a4c7b13 100644 (file)
@@ -1,3 +1,24 @@
+2010-10-08  Robert Dewar  <dewar@adacore.com>
+
+       * sem_prag.adb (Check_Duplicate_Pragma): New procedure
+       Add calls to this new procedure where appropriate
+
+2010-10-08  Vincent Celier  <celier@adacore.com>
+
+       * a-textio.adb (Get_Chunk): Code clean up.
+
+2010-10-08  Robert Dewar  <dewar@adacore.com>
+
+       * a-strbou.ads, a-strfix.adb, a-strfix.ads, a-strsea.adb, a-strsea.ads,
+       a-strsup.adb, a-strsup.ads, a-strunb-shared.adb, a-strunb-shared.ads,
+       a-strunb.adb, a-strunb.ads, a-stwibo.ads, a-stwifi.adb, a-stwifi.ads,
+       a-stwise.adb, a-stwise.ads, a-stwisu.adb, a-stwisu.ads,
+       a-stwiun-shared.adb, a-stwiun-shared.ads, a-stwiun.adb, a-stwiun.ads,
+       a-stzbou.ads, a-stzfix.adb, a-stzfix.ads, a-stzsea.adb, a-stzsea.ads,
+       a-stzsup.adb, a-stzsup.ads, a-stzunb-shared.adb, a-stzunb-shared.ads,
+       a-stzunb.adb, a-stzunb.ads (Find_Token): New version with From
+       parameter.
+
 2010-10-08  Robert Dewar  <dewar@adacore.com>
 
        * sem_cat.adb (Check_Categorization_Dependencies): Remote types
index 3d9276399fc4078e33b850768e0bbb9839035dfe..ddc8c337683df6a0d7169bc37c7398ced267298d 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 S p e c                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2010, 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 --
@@ -289,6 +289,15 @@ package Ada.Strings.Bounded is
         (Source : Bounded_String;
          Set    : Maps.Character_Set) return Natural;
 
+      procedure Find_Token
+        (Source : Bounded_String;
+         Set    : Maps.Character_Set;
+         From   : Positive;
+         Test   : Membership;
+         First  : out Positive;
+         Last   : out Natural);
+      pragma Ada_2012 (Find_Token);
+
       procedure Find_Token
         (Source : Bounded_String;
          Set    : Maps.Character_Set;
@@ -746,6 +755,15 @@ package Ada.Strings.Bounded is
          Set    : Maps.Character_Set) return Natural
          renames Super_Count;
 
+      procedure Find_Token
+        (Source : Bounded_String;
+         Set    : Maps.Character_Set;
+         From   : Positive;
+         Test   : Membership;
+         First  : out Positive;
+         Last   : out Natural)
+         renames Super_Find_Token;
+
       procedure Find_Token
         (Source : Bounded_String;
          Set    : Maps.Character_Set;
index 5e5118ace31afaa83edea85d71f80fc272324d19..6bb0229c71efc380b19a95fcb3ead79d40311c1f 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2010, 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- --
@@ -120,6 +120,15 @@ package body Ada.Strings.Fixed is
       Set    : Maps.Character_Set) return Natural
    renames Ada.Strings.Search.Count;
 
+   procedure Find_Token
+     (Source : String;
+      Set    : Maps.Character_Set;
+      From   : Positive;
+      Test   : Membership;
+      First  : out Positive;
+      Last   : out Natural)
+   renames Ada.Strings.Search.Find_Token;
+
    procedure Find_Token
      (Source : String;
       Set    : Maps.Character_Set;
index 875219a1c9bdfcb62dff480c727cebc131cac4ee..56db8bc9458bc5305e0a497d0eb84c19900bcadf 100644 (file)
@@ -99,6 +99,15 @@ package Ada.Strings.Fixed is
      (Source : String;
       Set    : Maps.Character_Set) return Natural;
 
+   procedure Find_Token
+     (Source : String;
+      Set    : Maps.Character_Set;
+      From   : Positive;
+      Test   : Membership;
+      First  : out Positive;
+      Last   : out Natural);
+   pragma Ada_2012 (Find_Token);
+
    procedure Find_Token
      (Source : String;
       Set    : Maps.Character_Set;
index 848c0630710ee40dd9b882ec7a5b7502e903d919..6f458ff23957d5af323a72d99af0a091c0f7d3ef 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2010, 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- --
@@ -194,6 +194,40 @@ package body Ada.Strings.Search is
    -- Find_Token --
    ----------------
 
+   procedure Find_Token
+     (Source : String;
+      Set    : Maps.Character_Set;
+      From   : Positive;
+      Test   : Membership;
+      First  : out Positive;
+      Last   : out Natural)
+   is
+   begin
+      for J in From .. Source'Last loop
+         if Belongs (Source (J), Set, Test) then
+            First := J;
+
+            for K in J + 1 .. Source'Last loop
+               if not Belongs (Source (K), Set, Test) then
+                  Last := K - 1;
+                  return;
+               end if;
+            end loop;
+
+            --  Here if J indexes first char of token, and all chars after J
+            --  are in the token.
+
+            Last := Source'Last;
+            return;
+         end if;
+      end loop;
+
+      --  Here if no token found
+
+      First := From;
+      Last  := 0;
+   end Find_Token;
+
    procedure Find_Token
      (Source : String;
       Set    : Maps.Character_Set;
index 153b8e61d787db5748500a4bfa9415d9aa1848b5..bf8686815c02cb8eb75c15ea7cc98bf113678bf7 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 S p e c                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2010, 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- --
@@ -103,6 +103,14 @@ private package Ada.Strings.Search is
      (Source : String;
       Set    : Maps.Character_Set) return Natural;
 
+   procedure Find_Token
+     (Source : String;
+      Set    : Maps.Character_Set;
+      From   : Positive;
+      Test   : Membership;
+      First  : out Positive;
+      Last   : out Natural);
+
    procedure Find_Token
      (Source : String;
       Set    : Maps.Character_Set;
index 75fa3bfd23e3c9431f8c8bf94d2da46a488f1758..707d9ec7055b7833649926fdaff0ee164d534d88 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 2003-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 2003-2010, 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- --
@@ -792,6 +792,19 @@ package body Ada.Strings.Superbounded is
    -- Super_Find_Token --
    ----------------------
 
+   procedure Super_Find_Token
+     (Source : Super_String;
+      Set    : Maps.Character_Set;
+      From   : Positive;
+      Test   : Strings.Membership;
+      First  : out Positive;
+      Last   : out Natural)
+   is
+   begin
+      Search.Find_Token
+        (Source.Data (From .. Source.Current_Length), Set, Test, First, Last);
+   end Super_Find_Token;
+
    procedure Super_Find_Token
      (Source : Super_String;
       Set    : Maps.Character_Set;
index 3fbdc02170380bbd3744f71b3d11ef8716f15b3d..c88c563d3d619ab58b7b5b0999d69371e5d84d00 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 S p e c                                  --
 --                                                                          --
---          Copyright (C) 2003-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 2003-2010, 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- --
@@ -290,6 +290,14 @@ package Ada.Strings.Superbounded is
      (Source : Super_String;
       Set    : Maps.Character_Set) return Natural;
 
+   procedure Super_Find_Token
+     (Source : Super_String;
+      Set    : Maps.Character_Set;
+      From   : Positive;
+      Test   : Membership;
+      First  : out Positive;
+      Last   : out Natural);
+
    procedure Super_Find_Token
      (Source : Super_String;
       Set    : Maps.Character_Set;
index f4083b59e935d6dac133fed1c2e1c4da593db61a..2b497b88dcb159e8ce32615cb8b8de877d57f976 100644 (file)
@@ -816,6 +816,19 @@ package body Ada.Strings.Unbounded is
    -- Find_Token --
    ----------------
 
+   procedure Find_Token
+     (Source : Unbounded_String;
+      Set    : Maps.Character_Set;
+      From   : Positive;
+      Test   : Strings.Membership;
+      First  : out Positive;
+      Last   : out Natural)
+   is
+      SR : constant Shared_String_Access := Source.Reference;
+   begin
+      Search.Find_Token (SR.Data (From .. SR.Last), Set, Test, First, Last);
+   end Find_Token;
+
    procedure Find_Token
      (Source : Unbounded_String;
       Set    : Maps.Character_Set;
index cbeae34fd985115f840335290a9a00f127f36f77..f07ac3145904e345687a4afc420a78e0a09cfa65 100644 (file)
@@ -294,6 +294,15 @@ package Ada.Strings.Unbounded is
      (Source : Unbounded_String;
       Set    : Maps.Character_Set) return Natural;
 
+   procedure Find_Token
+     (Source : Unbounded_String;
+      Set    : Maps.Character_Set;
+      From   : Positive;
+      Test   : Membership;
+      First  : out Positive;
+      Last   : out Natural);
+   pragma Ada_2012 (Find_Token);
+
    procedure Find_Token
      (Source : Unbounded_String;
       Set    : Maps.Character_Set;
index cc5b92bfc435bc8da0ae5922eb183bde172dc069..eae34bee885baf4e35fffdcc5a30a9a264eccbc0 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2010, 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- --
@@ -504,6 +504,19 @@ package body Ada.Strings.Unbounded is
    -- Find_Token --
    ----------------
 
+   procedure Find_Token
+     (Source : Unbounded_String;
+      Set    : Maps.Character_Set;
+      From   : Positive;
+      Test   : Strings.Membership;
+      First  : out Positive;
+      Last   : out Natural)
+   is
+   begin
+      Search.Find_Token
+        (Source.Reference (From .. Source.Last), Set, Test, First, Last);
+   end Find_Token;
+
    procedure Find_Token
      (Source : Unbounded_String;
       Set    : Maps.Character_Set;
index e61bae50a5a4625c329d7ee999778dc9cc6993c3..af063f0c9d2de9b9faecd6c5c37896987a105e2e 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 S p e c                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2010, 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 --
@@ -256,6 +256,15 @@ package Ada.Strings.Unbounded is
      (Source : Unbounded_String;
       Set    : Maps.Character_Set) return Natural;
 
+   procedure Find_Token
+     (Source : Unbounded_String;
+      Set    : Maps.Character_Set;
+      From   : Positive;
+      Test   : Membership;
+      First  : out Positive;
+      Last   : out Natural);
+   pragma Ada_2012 (Find_Token);
+
    procedure Find_Token
      (Source : Unbounded_String;
       Set    : Maps.Character_Set;
index 469e9cd714b70de237a0279042aacbf7fcd00bcc..c5a54d14b1476d999187b9b9448f17dae71b4110 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 S p e c                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2010, 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 --
@@ -293,6 +293,15 @@ package Ada.Strings.Wide_Bounded is
         (Source : Bounded_Wide_String;
          Set    : Wide_Maps.Wide_Character_Set) return Natural;
 
+      procedure Find_Token
+        (Source : Bounded_Wide_String;
+         Set    : Wide_Maps.Wide_Character_Set;
+         From   : Positive;
+         Test   : Membership;
+         First  : out Positive;
+         Last   : out Natural);
+      pragma Ada_2012 (Find_Token);
+
       procedure Find_Token
         (Source : Bounded_Wide_String;
          Set    : Wide_Maps.Wide_Character_Set;
@@ -751,6 +760,15 @@ package Ada.Strings.Wide_Bounded is
          Set    : Wide_Maps.Wide_Character_Set) return Natural
          renames Super_Count;
 
+      procedure Find_Token
+        (Source : Bounded_Wide_String;
+         Set    : Wide_Maps.Wide_Character_Set;
+         From   : Positive;
+         Test   : Membership;
+         First  : out Positive;
+         Last   : out Natural)
+         renames Super_Find_Token;
+
       procedure Find_Token
         (Source : Bounded_Wide_String;
          Set    : Wide_Maps.Wide_Character_Set;
index 14fd52f107c8aadc87298214faadfc750578e8f7..c4229062424cc1e9dc63fd316b19d3713f191883 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2010, 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- --
@@ -114,6 +114,15 @@ package body Ada.Strings.Wide_Fixed is
       Set    : Wide_Maps.Wide_Character_Set) return Natural
    renames Ada.Strings.Wide_Search.Count;
 
+   procedure Find_Token
+     (Source : Wide_String;
+      Set    : Wide_Maps.Wide_Character_Set;
+      From   : Positive;
+      Test   : Membership;
+      First  : out Positive;
+      Last   : out Natural)
+   renames Ada.Strings.Wide_Search.Find_Token;
+
    procedure Find_Token
      (Source : Wide_String;
       Set    : Wide_Maps.Wide_Character_Set;
index 8f3cf399fa8c1fea7baa94102bb24addf695ae64..75de811cfb32fe9de6d8680ea67f4f42db69ce9a 100644 (file)
@@ -102,6 +102,15 @@ package Ada.Strings.Wide_Fixed is
      (Source : Wide_String;
       Set    : Wide_Maps.Wide_Character_Set) return Natural;
 
+   procedure Find_Token
+     (Source : Wide_String;
+      Set    : Wide_Maps.Wide_Character_Set;
+      From   : Positive;
+      Test   : Membership;
+      First  : out Positive;
+      Last   : out Natural);
+   pragma Ada_2012 (Find_Token);
+
    procedure Find_Token
      (Source : Wide_String;
       Set    : Wide_Maps.Wide_Character_Set;
index 0e22f64bec7969681eb1aef66372393b48ba9f45..adc8e5f621a56800fdd923aae15d1ee716e648ee 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2010, 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- --
@@ -189,6 +189,40 @@ package body Ada.Strings.Wide_Search is
    -- Find_Token --
    ----------------
 
+   procedure Find_Token
+     (Source : Wide_String;
+      Set    : Wide_Maps.Wide_Character_Set;
+      From   : Positive;
+      Test   : Membership;
+      First  : out Positive;
+      Last   : out Natural)
+   is
+   begin
+      for J in From .. Source'Last loop
+         if Belongs (Source (J), Set, Test) then
+            First := J;
+
+            for K in J + 1 .. Source'Last loop
+               if not Belongs (Source (K), Set, Test) then
+                  Last := K - 1;
+                  return;
+               end if;
+            end loop;
+
+            --  Here if J indexes first char of token, and all chars after J
+            --  are in the token.
+
+            Last := Source'Last;
+            return;
+         end if;
+      end loop;
+
+      --  Here if no token found
+
+      First := From;
+      Last  := 0;
+   end Find_Token;
+
    procedure Find_Token
      (Source : Wide_String;
       Set    : Wide_Maps.Wide_Character_Set;
index 1a0931cb5e1c08e4d2e85264a2c92d6888d33fa5..fa06c5b15024479fc69248f06198e522001f4f6a 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 S p e c                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2010, 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- --
@@ -106,6 +106,15 @@ private package Ada.Strings.Wide_Search is
      (Source : Wide_String;
       Set    : Wide_Maps.Wide_Character_Set) return Natural;
 
+   procedure Find_Token
+     (Source : Wide_String;
+      Set    : Wide_Maps.Wide_Character_Set;
+      From   : Positive;
+      Test   : Membership;
+      First  : out Positive;
+      Last   : out Natural);
+   pragma Ada_2012 (Find_Token);
+
    procedure Find_Token
      (Source : Wide_String;
       Set    : Wide_Maps.Wide_Character_Set;
index d0212ecced5f051091bba441f405367218c1a5e0..2ffae8146827c7b122b124e920e899e2c1dd787a 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 2003-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 2003-2010, 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- --
@@ -793,6 +793,19 @@ package body Ada.Strings.Wide_Superbounded is
    -- Super_Find_Token --
    ----------------------
 
+   procedure Super_Find_Token
+     (Source : Super_String;
+      Set    : Wide_Maps.Wide_Character_Set;
+      From   : Positive;
+      Test   : Strings.Membership;
+      First  : out Positive;
+      Last   : out Natural)
+   is
+   begin
+      Wide_Search.Find_Token
+        (Source.Data (From .. Source.Current_Length), Set, Test, First, Last);
+   end Super_Find_Token;
+
    procedure Super_Find_Token
      (Source : Super_String;
       Set    : Wide_Maps.Wide_Character_Set;
index 06fc1b6b84753f00d40128afc18a45bc083a876e..0390031f3da5ee58e780254e1553460187e7d534 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 S p e c                                  --
 --                                                                          --
---          Copyright (C) 2003-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 2003-2010, 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- --
@@ -296,6 +296,14 @@ package Ada.Strings.Wide_Superbounded is
      (Source : Super_String;
       Set    : Wide_Maps.Wide_Character_Set) return Natural;
 
+   procedure Super_Find_Token
+     (Source : Super_String;
+      Set    : Wide_Maps.Wide_Character_Set;
+      From   : Positive;
+      Test   : Membership;
+      First  : out Positive;
+      Last   : out Natural);
+
    procedure Super_Find_Token
      (Source : Super_String;
       Set    : Wide_Maps.Wide_Character_Set;
index 0f61c7130e6659f39367273f7b0fdbf79ffc1670..7b99542510e80da06a1fdf12f999a12a6c4e555f 100644 (file)
@@ -820,6 +820,20 @@ package body Ada.Strings.Wide_Unbounded is
    -- Find_Token --
    ----------------
 
+   procedure Find_Token
+     (Source : Unbounded_Wide_String;
+      Set    : Wide_Maps.Wide_Character_Set;
+      From   : Positive;
+      Test   : Strings.Membership;
+      First  : out Positive;
+      Last   : out Natural)
+   is
+      SR : constant Shared_Wide_String_Access := Source.Reference;
+   begin
+      Wide_Search.Find_Token
+        (SR.Data (From .. SR.Last), Set, Test, First, Last);
+   end Find_Token;
+
    procedure Find_Token
      (Source : Unbounded_Wide_String;
       Set    : Wide_Maps.Wide_Character_Set;
@@ -829,7 +843,8 @@ package body Ada.Strings.Wide_Unbounded is
    is
       SR : constant Shared_Wide_String_Access := Source.Reference;
    begin
-      Wide_Search.Find_Token (SR.Data (1 .. SR.Last), Set, Test, First, Last);
+      Wide_Search.Find_Token
+        (SR.Data (1 .. SR.Last), Set, Test, First, Last);
    end Find_Token;
 
    ----------
index a438258c908c448e459380d0e7f4108a76d5c714..79cde5042b40237f6a54a52839343cbf51892930 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 S p e c                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2010, 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 --
@@ -270,6 +270,15 @@ package Ada.Strings.Wide_Unbounded is
      (Source : Unbounded_Wide_String;
       Set    : Wide_Maps.Wide_Character_Set) return Natural;
 
+   procedure Find_Token
+     (Source : Unbounded_Wide_String;
+      Set    : Wide_Maps.Wide_Character_Set;
+      From   : Positive;
+      Test   : Membership;
+      First  : out Positive;
+      Last   : out Natural);
+   pragma Ada_2012 (Find_Token);
+
    procedure Find_Token
      (Source : Unbounded_Wide_String;
       Set    : Wide_Maps.Wide_Character_Set;
index 6016aaf2abe0738ed5a4ac8394bb7ba250cf07f6..77e427f92971d2e01a637b9107483f48f2fa5413 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2010, 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- --
@@ -511,6 +511,19 @@ package body Ada.Strings.Wide_Unbounded is
    -- Find_Token --
    ----------------
 
+   procedure Find_Token
+     (Source : Unbounded_Wide_String;
+      Set    : Wide_Maps.Wide_Character_Set;
+      From   : Positive;
+      Test   : Strings.Membership;
+      First  : out Positive;
+      Last   : out Natural)
+   is
+   begin
+      Wide_Search.Find_Token
+        (Source.Reference (From .. Source.Last), Set, Test, First, Last);
+   end Find_Token;
+
    procedure Find_Token
      (Source : Unbounded_Wide_String;
       Set    : Wide_Maps.Wide_Character_Set;
index fc75be4278de36e1a46092a279b5a5dc06879f5a..dcec88977e353b1908726b53923108a44163184c 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 S p e c                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2010, 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 --
@@ -261,6 +261,15 @@ package Ada.Strings.Wide_Unbounded is
      (Source : Unbounded_Wide_String;
       Set    : Wide_Maps.Wide_Character_Set) return Natural;
 
+   procedure Find_Token
+     (Source : Unbounded_Wide_String;
+      Set    : Wide_Maps.Wide_Character_Set;
+      From   : Positive;
+      Test   : Membership;
+      First  : out Positive;
+      Last   : out Natural);
+   pragma Ada_2012 (Find_Token);
+
    procedure Find_Token
      (Source : Unbounded_Wide_String;
       Set    : Wide_Maps.Wide_Character_Set;
index cc7049160fbfcd2fc7a7486da2cd5ce0979f95e4..9574802f255fb526d3b2f85c2a3c509914b07e10 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 S p e c                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2010, 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 --
@@ -299,6 +299,15 @@ package Ada.Strings.Wide_Wide_Bounded is
         (Source : Bounded_Wide_Wide_String;
          Set    : Wide_Wide_Maps.Wide_Wide_Character_Set) return Natural;
 
+      procedure Find_Token
+        (Source : Bounded_Wide_Wide_String;
+         Set    : Wide_Wide_Maps.Wide_Wide_Character_Set;
+         From   : Positive;
+         Test   : Membership;
+         First  : out Positive;
+         Last   : out Natural);
+      pragma Ada_2012 (Find_Token);
+
       procedure Find_Token
         (Source : Bounded_Wide_Wide_String;
          Set    : Wide_Wide_Maps.Wide_Wide_Character_Set;
@@ -766,6 +775,15 @@ package Ada.Strings.Wide_Wide_Bounded is
          Set    : Wide_Wide_Maps.Wide_Wide_Character_Set) return Natural
          renames Super_Count;
 
+      procedure Find_Token
+        (Source : Bounded_Wide_Wide_String;
+         Set    : Wide_Wide_Maps.Wide_Wide_Character_Set;
+         From   : Positive;
+         Test   : Membership;
+         First  : out Positive;
+         Last   : out Natural)
+         renames Super_Find_Token;
+
       procedure Find_Token
         (Source : Bounded_Wide_Wide_String;
          Set    : Wide_Wide_Maps.Wide_Wide_Character_Set;
index 9cbdf4af473050ba4301b1c4b56f5c7bc280051b..077a65c0ecd78318e19dcf1b684f7e48832b9a50 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2010, 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- --
@@ -120,6 +120,15 @@ package body Ada.Strings.Wide_Wide_Fixed is
       Set    : Wide_Wide_Maps.Wide_Wide_Character_Set) return Natural
    renames Ada.Strings.Wide_Wide_Search.Count;
 
+   procedure Find_Token
+     (Source : Wide_Wide_String;
+      Set    : Wide_Wide_Maps.Wide_Wide_Character_Set;
+      From   : Positive;
+      Test   : Membership;
+      First  : out Positive;
+      Last   : out Natural)
+   renames Ada.Strings.Wide_Wide_Search.Find_Token;
+
    procedure Find_Token
      (Source : Wide_Wide_String;
       Set    : Wide_Wide_Maps.Wide_Wide_Character_Set;
index f6b313598d664425a698d61f459aa6ce58ef3074..bee76582527b7cb61d3959c84fb6dafc54c38b9f 100644 (file)
@@ -107,6 +107,15 @@ package Ada.Strings.Wide_Wide_Fixed is
      (Source : Wide_Wide_String;
       Set    : Wide_Wide_Maps.Wide_Wide_Character_Set) return Natural;
 
+   procedure Find_Token
+     (Source : Wide_Wide_String;
+      Set    : Wide_Wide_Maps.Wide_Wide_Character_Set;
+      From   : Positive;
+      Test   : Membership;
+      First  : out Positive;
+      Last   : out Natural);
+   pragma Ada_2012 (Find_Token);
+
    procedure Find_Token
      (Source : Wide_Wide_String;
       Set    : Wide_Wide_Maps.Wide_Wide_Character_Set;
index 0dc6d9bbf5c5eaf96e25d257f64988499258d1a7..e745091f6bae856d1d1d0c9c668049dc0050f9f0 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2010, 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- --
@@ -191,6 +191,40 @@ package body Ada.Strings.Wide_Wide_Search is
    -- Find_Token --
    ----------------
 
+   procedure Find_Token
+     (Source : Wide_Wide_String;
+      Set    : Wide_Wide_Maps.Wide_Wide_Character_Set;
+      From   : Positive;
+      Test   : Membership;
+      First  : out Positive;
+      Last   : out Natural)
+   is
+   begin
+      for J in From .. Source'Last loop
+         if Belongs (Source (J), Set, Test) then
+            First := J;
+
+            for K in J + 1 .. Source'Last loop
+               if not Belongs (Source (K), Set, Test) then
+                  Last := K - 1;
+                  return;
+               end if;
+            end loop;
+
+            --  Here if J indexes first char of token, and all chars after J
+            --  are in the token.
+
+            Last := Source'Last;
+            return;
+         end if;
+      end loop;
+
+      --  Here if no token found
+
+      First := From;
+      Last  := 0;
+   end Find_Token;
+
    procedure Find_Token
      (Source : Wide_Wide_String;
       Set    : Wide_Wide_Maps.Wide_Wide_Character_Set;
index 0264bf13575dd8a31f49362b38a6a55198f9e5d6..b8e39d25a4e078e69981f76eda2503d40e5e641e 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 S p e c                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2010, 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- --
@@ -112,6 +112,14 @@ private package Ada.Strings.Wide_Wide_Search is
      (Source : Wide_Wide_String;
       Set    : Wide_Wide_Maps.Wide_Wide_Character_Set) return Natural;
 
+   procedure Find_Token
+     (Source : Wide_Wide_String;
+      Set    : Wide_Wide_Maps.Wide_Wide_Character_Set;
+      From   : Positive;
+      Test   : Membership;
+      First  : out Positive;
+      Last   : out Natural);
+
    procedure Find_Token
      (Source : Wide_Wide_String;
       Set    : Wide_Wide_Maps.Wide_Wide_Character_Set;
index 7eca54d3cfa58cb9e3bbb9a509a5368bdd99f640..efad7b0f8c7d4aaab4453020f12ce8b13a28e473 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 2003-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 2003-2010, 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- --
@@ -796,6 +796,19 @@ package body Ada.Strings.Wide_Wide_Superbounded is
    -- Super_Find_Token --
    ----------------------
 
+   procedure Super_Find_Token
+     (Source : Super_String;
+      Set    : Wide_Wide_Maps.Wide_Wide_Character_Set;
+      From   : Positive;
+      Test   : Strings.Membership;
+      First  : out Positive;
+      Last   : out Natural)
+   is
+   begin
+      Wide_Wide_Search.Find_Token
+        (Source.Data (From .. Source.Current_Length), Set, Test, First, Last);
+   end Super_Find_Token;
+
    procedure Super_Find_Token
      (Source : Super_String;
       Set    : Wide_Wide_Maps.Wide_Wide_Character_Set;
index 978ad34e3f0aa707a8e874814b71448052bb24fb..7e67f53bae849e7720f15ad49489482657a3074f 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 S p e c                                  --
 --                                                                          --
---          Copyright (C) 2003-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 2003-2010, 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- --
@@ -304,6 +304,14 @@ package Ada.Strings.Wide_Wide_Superbounded is
      (Source : Super_String;
       Set    : Wide_Wide_Maps.Wide_Wide_Character_Set) return Natural;
 
+   procedure Super_Find_Token
+     (Source : Super_String;
+      Set    : Wide_Wide_Maps.Wide_Wide_Character_Set;
+      From   : Positive;
+      Test   : Membership;
+      First  : out Positive;
+      Last   : out Natural);
+
    procedure Super_Find_Token
      (Source : Super_String;
       Set    : Wide_Wide_Maps.Wide_Wide_Character_Set;
index e20cd98e8a098574124fd892097562ba55be126b..75799dad2f224e13e06bfc671f69002503c5e6b8 100644 (file)
@@ -824,6 +824,20 @@ package body Ada.Strings.Wide_Wide_Unbounded is
    -- Find_Token --
    ----------------
 
+   procedure Find_Token
+     (Source : Unbounded_Wide_Wide_String;
+      Set    : Wide_Wide_Maps.Wide_Wide_Character_Set;
+      From   : Positive;
+      Test   : Strings.Membership;
+      First  : out Positive;
+      Last   : out Natural)
+   is
+      SR : constant Shared_Wide_Wide_String_Access := Source.Reference;
+   begin
+      Wide_Wide_Search.Find_Token
+        (SR.Data (From .. SR.Last), Set, Test, First, Last);
+   end Find_Token;
+
    procedure Find_Token
      (Source : Unbounded_Wide_Wide_String;
       Set    : Wide_Wide_Maps.Wide_Wide_Character_Set;
index 4617f56fdc237522b9fb3683fe251573bc11b211..3a3cba300a357a2052921154d65c189c371324f1 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 S p e c                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2010, 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 --
@@ -276,6 +276,15 @@ package Ada.Strings.Wide_Wide_Unbounded is
      (Source : Unbounded_Wide_Wide_String;
       Set    : Wide_Wide_Maps.Wide_Wide_Character_Set) return Natural;
 
+   procedure Find_Token
+     (Source : Unbounded_Wide_Wide_String;
+      Set    : Wide_Wide_Maps.Wide_Wide_Character_Set;
+      From   : Positive;
+      Test   : Membership;
+      First  : out Positive;
+      Last   : out Natural);
+   pragma Ada_2012 (Find_Token);
+
    procedure Find_Token
      (Source : Unbounded_Wide_Wide_String;
       Set    : Wide_Wide_Maps.Wide_Wide_Character_Set;
index 226e26906ed61d7283e354b18b80da4e9e6a2918..82dae6f88b74e8358c1d233bf855a846a506dbb0 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2010, 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- --
@@ -514,6 +514,19 @@ package body Ada.Strings.Wide_Wide_Unbounded is
    -- Find_Token --
    ----------------
 
+   procedure Find_Token
+     (Source : Unbounded_Wide_Wide_String;
+      Set    : Wide_Wide_Maps.Wide_Wide_Character_Set;
+      From   : Positive;
+      Test   : Strings.Membership;
+      First  : out Positive;
+      Last   : out Natural)
+   is
+   begin
+      Wide_Wide_Search.Find_Token
+        (Source.Reference (From .. Source.Last), Set, Test, First, Last);
+   end Find_Token;
+
    procedure Find_Token
      (Source : Unbounded_Wide_Wide_String;
       Set    : Wide_Wide_Maps.Wide_Wide_Character_Set;
index c753051a5f1deeab49bccbb4aa3168162a73adb9..fa7bc17d93de7065c77030a7aef3d57b448ac399 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 S p e c                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2010, 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 --
@@ -266,6 +266,15 @@ package Ada.Strings.Wide_Wide_Unbounded is
      (Source : Unbounded_Wide_Wide_String;
       Set    : Wide_Wide_Maps.Wide_Wide_Character_Set) return Natural;
 
+   procedure Find_Token
+     (Source : Unbounded_Wide_Wide_String;
+      Set    : Wide_Wide_Maps.Wide_Wide_Character_Set;
+      From   : Positive;
+      Test   : Membership;
+      First  : out Positive;
+      Last   : out Natural);
+   pragma Ada_2012 (Find_Token);
+
    procedure Find_Token
      (Source : Unbounded_Wide_Wide_String;
       Set    : Wide_Wide_Maps.Wide_Wide_Character_Set;
index 27a0c3b7f74c532768decbe7eaf8286b7a05998c..924bfe59b3e2246058dc58124b424e2d100e2dd7 100644 (file)
@@ -758,7 +758,7 @@ package body Ada.Text_IO is
 
          if P = Null_Address then
             pragma Assert (Buf (N) = ASCII.NUL);
-            memcpy (Item (Item'First + Last)'Address,
+            memcpy (Item (Last + 1)'Address,
                     Buf (1)'Address, size_t (N - 1));
             Last := Last + N - 1;
 
@@ -783,7 +783,7 @@ package body Ada.Text_IO is
                   K := K - 1;
                end if;
 
-               memcpy (Item (Item'First + Last)'Address,
+               memcpy (Item (Last + 1)'Address,
                        Buf (1)'Address, size_t (K));
                Last := Last + K;
             end;
index edad7e32e57bffdb20195d52fb57d5cfdd620e52..bd7e144a2981c78fe022717ec0731c5830ba7f13 100644 (file)
@@ -407,6 +407,11 @@ package body Sem_Prag is
       --  UU_Typ is the related Unchecked_Union type. Flag In_Variant_Part
       --  should be set when Comp comes from a record variant.
 
+      procedure Check_Duplicate_Pragma (E : Entity_Id);
+      --  Check if a pragma of the same name as the current pragma is already
+      --  chained as a rep pragma to the given entity. if so give a message
+      --  about the duplicate, using Error_Pragma so the call does not return.
+
       procedure Check_Duplicated_Export_Name (Nam : Node_Id);
       --  Nam is an N_String_Literal node containing the external name set by
       --  an Import or Export pragma (or extended Import or Export pragma).
@@ -1194,6 +1199,17 @@ package body Sem_Prag is
          end if;
       end Check_Component;
 
+      procedure Check_Duplicate_Pragma (E : Entity_Id) is
+         P : constant Node_Id := Get_Rep_Pragma (E, Pragma_Name (N));
+      begin
+         if Present (P) then
+            Error_Msg_Name_1 := Pname;
+            Error_Msg_Sloc := Sloc (P);
+            Error_Msg_NE ("pragma% for & duplicates one#", N, E);
+            raise Pragma_Exit;
+         end if;
+      end Check_Duplicate_Pragma;
+
       ----------------------------------
       -- Check_Duplicated_Export_Name --
       ----------------------------------
@@ -1306,8 +1322,16 @@ package body Sem_Prag is
               ("argument for pragma% must be library level entity", Arg1);
          end if;
 
+         --  AI05-0033 : pragma cannot appear within a generic body, because
+         --  instance can be in a nested scope. The check that protected type
+         --  is itself a library-level declaration is done elsewhere.
+
          if Inside_A_Generic then
-            Error_Pragma ("pragma% cannot be used inside a generic");
+            if Ekind (Scope (Current_Scope)) = E_Generic_Package
+               and then In_Package_Body (Scope (Current_Scope))
+            then
+               Error_Pragma ("pragma% cannot be used inside a generic");
+            end if;
          end if;
       end Check_Interrupt_Or_Attach_Handler;
 
@@ -2220,6 +2244,12 @@ package body Sem_Prag is
          D := Declaration_Node (E);
          K := Nkind (D);
 
+         --  Check duplicate before we chain ourselves!
+
+         Check_Duplicate_Pragma (E);
+
+         --  Now check appropriateness of the entity
+
          if Is_Type (E) then
             if Rep_Item_Too_Early (E, N)
                  or else
@@ -5946,6 +5976,8 @@ package body Sem_Prag is
 
             E := Entity (E_Id);
 
+            Check_Duplicate_Pragma (E);
+
             if Rep_Item_Too_Early (E, N)
                  or else
                Rep_Item_Too_Late (E, N)
@@ -8410,6 +8442,12 @@ package body Sem_Prag is
             D := Declaration_Node (E);
             K := Nkind (D);
 
+            --  Check duplicate before we chain ourselves!
+
+            Check_Duplicate_Pragma (E);
+
+            --  Check appropriate entity
+
             if Is_Type (E) then
                if Rep_Item_Too_Early (E, N)
                     or else
@@ -8464,6 +8502,12 @@ package body Sem_Prag is
 
             E := Entity (E_Id);
 
+            --  Check duplicate before we chain ourselves!
+
+            Check_Duplicate_Pragma (E);
+
+            --  Check appropriate entity
+
             if Rep_Item_Too_Early (E, N)
                  or else
                Rep_Item_Too_Late (E, N)