diff options
author | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-10-08 13:02:55 +0000 |
---|---|---|
committer | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-10-08 13:02:55 +0000 |
commit | 9e555810ce3a72772cc223a42d293f349d5f2ef1 (patch) | |
tree | 0126ea2b3ba29b875348601ed7cceb253d55ec95 /gcc/ada | |
parent | b6a53a17ac8769adb9411bf0e0c757f0a31f4b7f (diff) | |
download | gcc-9e555810ce3a72772cc223a42d293f349d5f2ef1.tar.gz |
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@165174 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada')
36 files changed, 528 insertions, 30 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index b47253fa4a3..68b248fab51 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,5 +1,26 @@ 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 packages can depend on preleborated packages. diff --git a/gcc/ada/a-strbou.ads b/gcc/ada/a-strbou.ads index 3d9276399fc..ddc8c337683 100644 --- a/gcc/ada/a-strbou.ads +++ b/gcc/ada/a-strbou.ads @@ -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 -- @@ -292,6 +292,15 @@ package Ada.Strings.Bounded is 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; Test : Membership; First : out Positive; Last : out Natural); @@ -749,6 +758,15 @@ package Ada.Strings.Bounded is 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; Test : Membership; First : out Positive; Last : out Natural) diff --git a/gcc/ada/a-strfix.adb b/gcc/ada/a-strfix.adb index 5e5118ace31..6bb0229c71e 100644 --- a/gcc/ada/a-strfix.adb +++ b/gcc/ada/a-strfix.adb @@ -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- -- @@ -123,6 +123,15 @@ package body Ada.Strings.Fixed is 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; Test : Membership; First : out Positive; Last : out Natural) diff --git a/gcc/ada/a-strfix.ads b/gcc/ada/a-strfix.ads index 875219a1c9b..56db8bc9458 100644 --- a/gcc/ada/a-strfix.ads +++ b/gcc/ada/a-strfix.ads @@ -102,6 +102,15 @@ package Ada.Strings.Fixed is 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; Test : Membership; First : out Positive; Last : out Natural); diff --git a/gcc/ada/a-strsea.adb b/gcc/ada/a-strsea.adb index 848c0630710..6f458ff2395 100644 --- a/gcc/ada/a-strsea.adb +++ b/gcc/ada/a-strsea.adb @@ -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- -- @@ -197,6 +197,40 @@ package body Ada.Strings.Search is 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; Test : Membership; First : out Positive; Last : out Natural) diff --git a/gcc/ada/a-strsea.ads b/gcc/ada/a-strsea.ads index 153b8e61d78..bf8686815c0 100644 --- a/gcc/ada/a-strsea.ads +++ b/gcc/ada/a-strsea.ads @@ -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,14 @@ private package Ada.Strings.Search is 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; Test : Membership; First : out Positive; Last : out Natural); diff --git a/gcc/ada/a-strsup.adb b/gcc/ada/a-strsup.adb index 75fa3bfd23e..707d9ec7055 100644 --- a/gcc/ada/a-strsup.adb +++ b/gcc/ada/a-strsup.adb @@ -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- -- @@ -795,6 +795,19 @@ package body Ada.Strings.Superbounded is 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; Test : Strings.Membership; First : out Positive; Last : out Natural) diff --git a/gcc/ada/a-strsup.ads b/gcc/ada/a-strsup.ads index 3fbdc021703..c88c563d3d6 100644 --- a/gcc/ada/a-strsup.ads +++ b/gcc/ada/a-strsup.ads @@ -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- -- @@ -293,6 +293,14 @@ package Ada.Strings.Superbounded is 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; Test : Membership; First : out Positive; Last : out Natural); diff --git a/gcc/ada/a-strunb-shared.adb b/gcc/ada/a-strunb-shared.adb index f4083b59e93..2b497b88dcb 100644 --- a/gcc/ada/a-strunb-shared.adb +++ b/gcc/ada/a-strunb-shared.adb @@ -819,6 +819,19 @@ package body Ada.Strings.Unbounded is 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; Test : Strings.Membership; First : out Positive; Last : out Natural) diff --git a/gcc/ada/a-strunb-shared.ads b/gcc/ada/a-strunb-shared.ads index cbeae34fd98..f07ac314590 100644 --- a/gcc/ada/a-strunb-shared.ads +++ b/gcc/ada/a-strunb-shared.ads @@ -297,6 +297,15 @@ package Ada.Strings.Unbounded is 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; Test : Membership; First : out Positive; Last : out Natural); diff --git a/gcc/ada/a-strunb.adb b/gcc/ada/a-strunb.adb index cc5b92bfc43..eae34bee885 100644 --- a/gcc/ada/a-strunb.adb +++ b/gcc/ada/a-strunb.adb @@ -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- -- @@ -507,6 +507,19 @@ package body Ada.Strings.Unbounded is 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; Test : Strings.Membership; First : out Positive; Last : out Natural) diff --git a/gcc/ada/a-strunb.ads b/gcc/ada/a-strunb.ads index e61bae50a5a..af063f0c9d2 100644 --- a/gcc/ada/a-strunb.ads +++ b/gcc/ada/a-strunb.ads @@ -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 -- @@ -259,6 +259,15 @@ package Ada.Strings.Unbounded is 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; Test : Membership; First : out Positive; Last : out Natural); diff --git a/gcc/ada/a-stwibo.ads b/gcc/ada/a-stwibo.ads index 469e9cd714b..c5a54d14b14 100644 --- a/gcc/ada/a-stwibo.ads +++ b/gcc/ada/a-stwibo.ads @@ -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 -- @@ -296,6 +296,15 @@ package Ada.Strings.Wide_Bounded is 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; Test : Membership; First : out Positive; Last : out Natural); @@ -754,6 +763,15 @@ package Ada.Strings.Wide_Bounded is 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; Test : Membership; First : out Positive; Last : out Natural) diff --git a/gcc/ada/a-stwifi.adb b/gcc/ada/a-stwifi.adb index 14fd52f107c..c4229062424 100644 --- a/gcc/ada/a-stwifi.adb +++ b/gcc/ada/a-stwifi.adb @@ -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- -- @@ -117,6 +117,15 @@ package body Ada.Strings.Wide_Fixed is 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; Test : Membership; First : out Positive; Last : out Natural) diff --git a/gcc/ada/a-stwifi.ads b/gcc/ada/a-stwifi.ads index 8f3cf399fa8..75de811cfb3 100644 --- a/gcc/ada/a-stwifi.ads +++ b/gcc/ada/a-stwifi.ads @@ -105,6 +105,15 @@ package Ada.Strings.Wide_Fixed is 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; Test : Membership; First : out Positive; Last : out Natural); diff --git a/gcc/ada/a-stwise.adb b/gcc/ada/a-stwise.adb index 0e22f64bec7..adc8e5f621a 100644 --- a/gcc/ada/a-stwise.adb +++ b/gcc/ada/a-stwise.adb @@ -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- -- @@ -192,6 +192,40 @@ package body Ada.Strings.Wide_Search is 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; Test : Membership; First : out Positive; Last : out Natural) diff --git a/gcc/ada/a-stwise.ads b/gcc/ada/a-stwise.ads index 1a0931cb5e1..fa06c5b1502 100644 --- a/gcc/ada/a-stwise.ads +++ b/gcc/ada/a-stwise.ads @@ -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- -- @@ -109,6 +109,15 @@ private package Ada.Strings.Wide_Search is 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; Test : Membership; First : out Positive; Last : out Natural); diff --git a/gcc/ada/a-stwisu.adb b/gcc/ada/a-stwisu.adb index d0212ecced5..2ffae814682 100644 --- a/gcc/ada/a-stwisu.adb +++ b/gcc/ada/a-stwisu.adb @@ -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_Superbounded is 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; Test : Strings.Membership; First : out Positive; Last : out Natural) diff --git a/gcc/ada/a-stwisu.ads b/gcc/ada/a-stwisu.ads index 06fc1b6b847..0390031f3da 100644 --- a/gcc/ada/a-stwisu.ads +++ b/gcc/ada/a-stwisu.ads @@ -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- -- @@ -299,6 +299,14 @@ package Ada.Strings.Wide_Superbounded is 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; Test : Membership; First : out Positive; Last : out Natural); diff --git a/gcc/ada/a-stwiun-shared.adb b/gcc/ada/a-stwiun-shared.adb index 0f61c7130e6..7b99542510e 100644 --- a/gcc/ada/a-stwiun-shared.adb +++ b/gcc/ada/a-stwiun-shared.adb @@ -823,13 +823,28 @@ package body Ada.Strings.Wide_Unbounded is 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; 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 (1 .. SR.Last), Set, Test, First, Last); + Wide_Search.Find_Token + (SR.Data (1 .. SR.Last), Set, Test, First, Last); end Find_Token; ---------- diff --git a/gcc/ada/a-stwiun-shared.ads b/gcc/ada/a-stwiun-shared.ads index a438258c908..79cde5042b4 100644 --- a/gcc/ada/a-stwiun-shared.ads +++ b/gcc/ada/a-stwiun-shared.ads @@ -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 -- @@ -273,6 +273,15 @@ package Ada.Strings.Wide_Unbounded is 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; Test : Membership; First : out Positive; Last : out Natural); diff --git a/gcc/ada/a-stwiun.adb b/gcc/ada/a-stwiun.adb index 6016aaf2abe..77e427f9297 100644 --- a/gcc/ada/a-stwiun.adb +++ b/gcc/ada/a-stwiun.adb @@ -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_Unbounded is 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; Test : Strings.Membership; First : out Positive; Last : out Natural) diff --git a/gcc/ada/a-stwiun.ads b/gcc/ada/a-stwiun.ads index fc75be4278d..dcec88977e3 100644 --- a/gcc/ada/a-stwiun.ads +++ b/gcc/ada/a-stwiun.ads @@ -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 -- @@ -264,6 +264,15 @@ package Ada.Strings.Wide_Unbounded is 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; Test : Membership; First : out Positive; Last : out Natural); diff --git a/gcc/ada/a-stzbou.ads b/gcc/ada/a-stzbou.ads index cc7049160fb..9574802f255 100644 --- a/gcc/ada/a-stzbou.ads +++ b/gcc/ada/a-stzbou.ads @@ -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 -- @@ -302,6 +302,15 @@ package Ada.Strings.Wide_Wide_Bounded is 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; Test : Membership; First : out Positive; Last : out Natural); @@ -769,6 +778,15 @@ package Ada.Strings.Wide_Wide_Bounded is 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; Test : Membership; First : out Positive; Last : out Natural) diff --git a/gcc/ada/a-stzfix.adb b/gcc/ada/a-stzfix.adb index 9cbdf4af473..077a65c0ecd 100644 --- a/gcc/ada/a-stzfix.adb +++ b/gcc/ada/a-stzfix.adb @@ -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- -- @@ -123,6 +123,15 @@ package body Ada.Strings.Wide_Wide_Fixed is 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; Test : Membership; First : out Positive; Last : out Natural) diff --git a/gcc/ada/a-stzfix.ads b/gcc/ada/a-stzfix.ads index f6b313598d6..bee76582527 100644 --- a/gcc/ada/a-stzfix.ads +++ b/gcc/ada/a-stzfix.ads @@ -110,6 +110,15 @@ package Ada.Strings.Wide_Wide_Fixed is 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; Test : Membership; First : out Positive; Last : out Natural); diff --git a/gcc/ada/a-stzsea.adb b/gcc/ada/a-stzsea.adb index 0dc6d9bbf5c..e745091f6ba 100644 --- a/gcc/ada/a-stzsea.adb +++ b/gcc/ada/a-stzsea.adb @@ -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.Wide_Wide_Search is 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; Test : Membership; First : out Positive; Last : out Natural) diff --git a/gcc/ada/a-stzsea.ads b/gcc/ada/a-stzsea.ads index 0264bf13575..b8e39d25a4e 100644 --- a/gcc/ada/a-stzsea.ads +++ b/gcc/ada/a-stzsea.ads @@ -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- -- @@ -115,6 +115,14 @@ private package Ada.Strings.Wide_Wide_Search is 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; Test : Membership; First : out Positive; Last : out Natural); diff --git a/gcc/ada/a-stzsup.adb b/gcc/ada/a-stzsup.adb index 7eca54d3cfa..efad7b0f8c7 100644 --- a/gcc/ada/a-stzsup.adb +++ b/gcc/ada/a-stzsup.adb @@ -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- -- @@ -799,6 +799,19 @@ package body Ada.Strings.Wide_Wide_Superbounded is 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; Test : Strings.Membership; First : out Positive; Last : out Natural) diff --git a/gcc/ada/a-stzsup.ads b/gcc/ada/a-stzsup.ads index 978ad34e3f0..7e67f53bae8 100644 --- a/gcc/ada/a-stzsup.ads +++ b/gcc/ada/a-stzsup.ads @@ -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- -- @@ -307,6 +307,14 @@ package Ada.Strings.Wide_Wide_Superbounded is 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; Test : Membership; First : out Positive; Last : out Natural); diff --git a/gcc/ada/a-stzunb-shared.adb b/gcc/ada/a-stzunb-shared.adb index e20cd98e8a0..75799dad2f2 100644 --- a/gcc/ada/a-stzunb-shared.adb +++ b/gcc/ada/a-stzunb-shared.adb @@ -827,6 +827,20 @@ package body Ada.Strings.Wide_Wide_Unbounded is 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; Test : Strings.Membership; First : out Positive; Last : out Natural) diff --git a/gcc/ada/a-stzunb-shared.ads b/gcc/ada/a-stzunb-shared.ads index 4617f56fdc2..3a3cba300a3 100644 --- a/gcc/ada/a-stzunb-shared.ads +++ b/gcc/ada/a-stzunb-shared.ads @@ -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 -- @@ -279,6 +279,15 @@ package Ada.Strings.Wide_Wide_Unbounded is 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; Test : Membership; First : out Positive; Last : out Natural); diff --git a/gcc/ada/a-stzunb.adb b/gcc/ada/a-stzunb.adb index 226e26906ed..82dae6f88b7 100644 --- a/gcc/ada/a-stzunb.adb +++ b/gcc/ada/a-stzunb.adb @@ -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- -- @@ -517,6 +517,19 @@ package body Ada.Strings.Wide_Wide_Unbounded is 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; Test : Strings.Membership; First : out Positive; Last : out Natural) diff --git a/gcc/ada/a-stzunb.ads b/gcc/ada/a-stzunb.ads index c753051a5f1..fa7bc17d93d 100644 --- a/gcc/ada/a-stzunb.ads +++ b/gcc/ada/a-stzunb.ads @@ -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 -- @@ -269,6 +269,15 @@ package Ada.Strings.Wide_Wide_Unbounded is 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; Test : Membership; First : out Positive; Last : out Natural); diff --git a/gcc/ada/a-textio.adb b/gcc/ada/a-textio.adb index 27a0c3b7f74..924bfe59b3e 100644 --- a/gcc/ada/a-textio.adb +++ b/gcc/ada/a-textio.adb @@ -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; diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb index edad7e32e57..bd7e144a298 100644 --- a/gcc/ada/sem_prag.adb +++ b/gcc/ada/sem_prag.adb @@ -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) |