From c97c0163bcc9c1e3020fc47d639e19debc51e80d Mon Sep 17 00:00:00 2001 From: Arnaud Charlet Date: Thu, 5 Aug 2010 11:08:50 +0200 Subject: [PATCH] [multiple changes] 2010-08-05 Robert Dewar * a-suezse.adb, a-suezse.ads, a-suezen.adb, a-suezen.ads: Removed. * a-suewse.adb, a-suewse.ads, a-suesen.adb, a-suesen.ads, a-suewen.adb, a-suewen.ads: New files. * Makefile.rtl, impunit.adb: Update implementation of Ada 2012 string encoding packages. * sem_elab.adb: Minor reformatting. 2010-08-05 Arnaud Charlet * sem_ch8.adb (Use_One_Type): Protect against empty scopes. * exp_util.adb (Component_May_Be_Bit_Aligned): Prevent assert failure in case of null Comp. From-SVN: r162904 --- gcc/ada/ChangeLog | 15 ++ gcc/ada/Makefile.rtl | 5 +- gcc/ada/a-suesen.adb | 341 +++++++++++++++++++++++++++++++++ gcc/ada/a-suesen.ads | 65 +++++++ gcc/ada/{a-suewen.adb => a-suewse.adb} | 28 ++- gcc/ada/{a-suewen.ads => a-suewse.ads} | 8 +- gcc/ada/{a-suezen.adb => a-suezse.adb} | 28 ++- gcc/ada/{a-suezen.ads => a-suezse.ads} | 8 +- gcc/ada/exp_util.adb | 6 +- gcc/ada/impunit.adb | 9 +- gcc/ada/sem_ch8.adb | 7 +- gcc/ada/sem_elab.adb | 4 +- 12 files changed, 473 insertions(+), 51 deletions(-) create mode 100755 gcc/ada/a-suesen.adb create mode 100755 gcc/ada/a-suesen.ads rename gcc/ada/{a-suewen.adb => a-suewse.adb} (90%) rename gcc/ada/{a-suewen.ads => a-suewse.ads} (93%) rename gcc/ada/{a-suezen.adb => a-suezse.adb} (92%) rename gcc/ada/{a-suezen.ads => a-suezse.ads} (93%) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 129b89d..9958ead 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,5 +1,20 @@ 2010-08-05 Robert Dewar + * a-suezse.adb, a-suezse.ads, a-suezen.adb, a-suezen.ads: Removed. + * a-suewse.adb, a-suewse.ads, a-suesen.adb, a-suesen.ads, + a-suewen.adb, a-suewen.ads: New files. + * Makefile.rtl, impunit.adb: Update implementation of Ada 2012 string + encoding packages. + * sem_elab.adb: Minor reformatting. + +2010-08-05 Arnaud Charlet + + * sem_ch8.adb (Use_One_Type): Protect against empty scopes. + * exp_util.adb (Component_May_Be_Bit_Aligned): Prevent assert failure + in case of null Comp. + +2010-08-05 Robert Dewar + * errout.adb, a-suewen.adb, a-suezen.adb: Minor reformatting. 2010-08-05 Gary Dismukes diff --git a/gcc/ada/Makefile.rtl b/gcc/ada/Makefile.rtl index 6e7d4eb..169c368 100644 --- a/gcc/ada/Makefile.rtl +++ b/gcc/ada/Makefile.rtl @@ -227,8 +227,9 @@ GNATRTL_NONTASKING_OBJS= \ a-stzsup$(objext) \ a-stzunb$(objext) \ a-suenco$(objext) \ - a-suewen$(objext) \ - a-suezen$(objext) \ + a-suesen$(objext) \ + a-suewse$(objext) \ + a-suezse$(objext) \ a-suteio$(objext) \ a-swbwha$(objext) \ a-swfwha$(objext) \ diff --git a/gcc/ada/a-suesen.adb b/gcc/ada/a-suesen.adb new file mode 100755 index 0000000..263e6ec --- /dev/null +++ b/gcc/ada/a-suesen.adb @@ -0,0 +1,341 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT RUN-TIME COMPONENTS -- +-- -- +-- ADA.STRINGS.UTF_ENCODING.STRING_ENCODING -- +-- -- +-- B o d y -- +-- -- +-- Copyright (C) 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- -- +-- ware Foundation; either version 3, or (at your option) any later ver- -- +-- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- +-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- +-- or FITNESS FOR A PARTICULAR PURPOSE. -- +-- -- +-- As a special exception under Section 7 of GPL version 3, you are granted -- +-- additional permissions described in the GCC Runtime Library Exception, -- +-- version 3.1, as published by the Free Software Foundation. -- +-- -- +-- You should have received a copy of the GNU General Public License and -- +-- a copy of the GCC Runtime Library Exception along with this program; -- +-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- +-- . -- +-- -- +-- GNAT was originally developed by the GNAT team at New York University. -- +-- Extensive contributions were provided by Ada Core Technologies Inc. -- +-- -- +------------------------------------------------------------------------------ + +package body Ada.Strings.UTF_Encoding.String_Encoding is + use Interfaces; + + ------------ + -- Decode -- + ------------ + + -- Decode UTF-8/UTF-16BE/UTF-16LE input to String + + function Decode + (Item : UTF_String; + Input_Scheme : Encoding_Scheme) return String + is + begin + if Input_Scheme = UTF_8 then + return Decode (Item); + else + return Decode (To_UTF_16 (Item, Input_Scheme)); + end if; + end Decode; + + -- Decode UTF-8 input to String + + function Decode (Item : UTF_8_String) return String is + Result : String (1 .. Item'Length); + -- Result string (worst case is same length as input) + + Len : Natural := 0; + -- Length of result stored so far + + Iptr : Natural; + -- Input Item pointer + + C : Unsigned_8; + R : Unsigned_16; + + procedure Get_Continuation; + -- Reads a continuation byte of the form 10xxxxxx, shifts R left + -- by 6 bits, and or's in the xxxxxx to the low order 6 bits. On + -- return Ptr is incremented. Raises exceptioon if continuation + -- byte does not exist or is invalid. + + ---------------------- + -- Get_Continuation -- + ---------------------- + + procedure Get_Continuation is + begin + if Iptr > Item'Last then + Raise_Encoding_Error (Iptr - 1); + + else + C := To_Unsigned_8 (Item (Iptr)); + Iptr := Iptr + 1; + + if C not in 2#10_000000# .. 2#10_111111# then + Raise_Encoding_Error (Iptr - 1); + else + R := Shift_Left (R, 6) or Unsigned_16 (C and 2#00_111111#); + end if; + end if; + end Get_Continuation; + + -- Start of processing for Decode + + begin + Iptr := Item'First; + + -- Skip BOM at start + + if Item'Length >= 3 + and then Item (Iptr .. Iptr + 2) = BOM_8 + then + Iptr := Iptr + 3; + + -- Error if bad BOM + + elsif Item'Length >= 2 + and then (Item (Iptr .. Iptr + 1) = BOM_16BE + or else + Item (Iptr .. Iptr + 1) = BOM_16LE) + then + Raise_Encoding_Error (Iptr); + end if; + + while Iptr <= Item'Last loop + C := To_Unsigned_8 (Item (Iptr)); + Iptr := Iptr + 1; + + -- Codes in the range 16#00# - 16#7F# are represented as + -- 0xxxxxxx + + if C <= 16#7F# then + R := Unsigned_16 (C); + + -- No initial code can be of the form 10xxxxxx. Such codes are used + -- only for continuations. + + elsif C <= 2#10_111111# then + Raise_Encoding_Error (Iptr - 1); + + -- Codes in the range 16#80# - 16#7FF# are represented as + -- 110yyyxx 10xxxxxx + + elsif C <= 2#110_11111# then + R := Unsigned_16 (C and 2#000_11111#); + Get_Continuation; + + -- Codes in the range 16#800# - 16#FFFF# are represented as + -- 1110yyyy 10yyyyxx 10xxxxxx + + -- Such codes are out of range for type Character + + -- Codes in the range 16#10000# - 16#10FFFF# are represented as + -- 11110zzz 10zzyyyy 10yyyyxx 10xxxxxx + + -- Such codes are out of range for Wide_String output + + -- Thus all remaining cases raise Encoding_Error + + else + Raise_Encoding_Error (Iptr - 1); + end if; + + Len := Len + 1; + Result (Len) := Character'Val (R); + end loop; + + return Result (1 .. Len); + end Decode; + + -- Decode UTF-16 input to String + + function Decode (Item : UTF_16_Wide_String) return String is + Result : String (1 .. Item'Length); + -- Result is same length as input (possibly minus 1 if BOM present) + + Len : Natural := 0; + -- Length of result + + Iptr : Natural; + -- Index of next Item element + + C : Unsigned_16; + + begin + -- Skip UTF-16 BOM at start + + Iptr := Item'First; + + if Item'Length > 0 and then Item (Iptr) = BOM_16 (1) then + Iptr := Iptr + 1; + end if; + + -- Loop through input characters + + while Iptr <= Item'Last loop + C := To_Unsigned_16 (Item (Iptr)); + Iptr := Iptr + 1; + + -- Codes in the range 16#0000#..16#00FF# represent their own value + + if C <= 16#00FF# then + Len := Len + 1; + Result (Len) := Character'Val (C); + + -- All other codes are invalid, either they are invalid UTF-16 + -- encoding sequences, or they represent values that are out of + -- range for type Character. + + else + Raise_Encoding_Error (Iptr - 1); + end if; + end loop; + + return Result (1 .. Len); + end Decode; + + ------------ + -- Encode -- + ------------ + + -- Encode String in UTF-8, UTF-16BE or UTF-16LE + + function Encode + (Item : String; + Output_Scheme : Encoding_Scheme; + Output_BOM : Boolean := False) return UTF_String + is + begin + -- Case of UTF_8 + + if Output_Scheme = UTF_8 then + return Encode (Item, Output_BOM); + + -- Case of UTF_16LE or UTF_16BE, use UTF-16 intermediary + + else + return From_UTF_16 (UTF_16_Wide_String'(Encode (Item)), + Output_Scheme, Output_BOM); + end if; + end Encode; + + -- Encode String in UTF-8 + + function Encode + (Item : String; + Output_BOM : Boolean := False) return UTF_8_String + is + Result : UTF_8_String (1 .. 3 * Item'Length + 3); + -- Worst case is three bytes per input byte + space for BOM + + Len : Natural; + -- Number of output codes stored in Result + + C : Unsigned_8; + -- Single input character + + procedure Store (C : Unsigned_8); + pragma Inline (Store); + -- Store one output code, C is in the range 0 .. 255 + + ----------- + -- Store -- + ----------- + + procedure Store (C : Unsigned_8) is + begin + Len := Len + 1; + Result (Len) := Character'Val (C); + end Store; + + -- Start of processing for UTF8_Encode + + begin + -- Output BOM if required + + if Output_BOM then + Result (1 .. 3) := BOM_8; + Len := 3; + else + Len := 0; + end if; + + -- Loop through characters of input + + for J in Item'Range loop + C := To_Unsigned_8 (Item (J)); + + -- Codes in the range 16#00# - 16#7F# are represented as + -- 0xxxxxxx + + if C <= 16#7F# then + Store (C); + + -- Codes in the range 16#80# - 16#7FF# are represented as + -- 110yyyxx 10xxxxxx + + -- For type character of course, the limit is 16#FF# in any case + + else + Store (2#110_00000# or Shift_Right (C, 6)); + Store (2#10_000000# or (C and 2#00_111111#)); + end if; + end loop; + + return Result (1 .. Len); + end Encode; + + -- Encode String in UTF-16 + + function Encode + (Item : String; + Output_BOM : Boolean := False) return UTF_16_Wide_String + is + Result : UTF_16_Wide_String + (1 .. Item'Length + Boolean'Pos (Output_BOM)); + -- Output is same length as input + possible BOM + + Len : Integer; + -- Length of output string + + C : Unsigned_8; + + begin + -- Output BOM if required + + if Output_BOM then + Result (1) := BOM_16 (1); + Len := 1; + else + Len := 0; + end if; + + -- Loop through input characters encoding them + + for Iptr in Item'Range loop + C := To_Unsigned_8 (Item (Iptr)); + + -- Codes in the range 16#0000#..16#00FF# are output unchanged. This + -- includes all possible cases of Character values. + + Len := Len + 1; + Result (Len) := Wide_Character'Val (C); + end loop; + + return Result; + end Encode; + +end Ada.Strings.UTF_Encoding.String_Encoding; diff --git a/gcc/ada/a-suesen.ads b/gcc/ada/a-suesen.ads new file mode 100755 index 0000000..a8f913e --- /dev/null +++ b/gcc/ada/a-suesen.ads @@ -0,0 +1,65 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT RUN-TIME COMPONENTS -- +-- -- +-- ADA.STRINGS.UTF_ENCODING.STRING_ENCODING -- +-- -- +-- S p e c -- +-- -- +-- This specification is derived from the Ada Reference Manual for use with -- +-- GNAT. In accordance with the copyright of that document, you can freely -- +-- copy and modify this specification, provided that if you redistribute a -- +-- modified version, any changes that you have made are clearly indicated. -- +-- -- +------------------------------------------------------------------------------ + +-- This is an Ada 2012 package defined in AI05-0137-1. It is used for encoding +-- 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); + + -- The encoding routines take a String as input and encode the result + -- using the specified UTF encoding method. The result includes a BOM if + -- the Output_BOM argument is set to True. All 256 values of type Character + -- are valid, so Encoding_Error cannot be raised for string input data. + + function Encode + (Item : String; + Output_Scheme : Encoding_Scheme; + Output_BOM : Boolean := False) return UTF_String; + -- Encode String using UTF-8, UTF-16LE or UTF-16BE encoding as specified by + -- the Output_Scheme parameter. + + function Encode + (Item : String; + Output_BOM : Boolean := False) return UTF_8_String; + -- Encode String using UTF-8 encoding + + function Encode + (Item : String; + Output_BOM : Boolean := False) return UTF_16_Wide_String; + -- Encode String using UTF_16 encoding + + -- The decoding routines take a UTF String as input, and return a decoded + -- Wide_String. If the UTF String starts with a BOM that matches the + -- encoding method, it is ignored. An incorrect BOM raises Encoding_Error, + -- as does a code out of range of type Character. + + function Decode + (Item : UTF_String; + Input_Scheme : Encoding_Scheme) return String; + -- The input is encoded in UTF_8, UTF_16LE or UTF_16BE as specified by the + -- Input_Scheme parameter. It is decoded and returned as a String value. + -- Note: a convenient form for scheme may be Encoding (UTF_String). + + function Decode + (Item : UTF_8_String) return String; + -- The input is encoded in UTF-8 and returned as a String value + + function Decode + (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; diff --git a/gcc/ada/a-suewen.adb b/gcc/ada/a-suewse.adb similarity index 90% rename from gcc/ada/a-suewen.adb rename to gcc/ada/a-suewse.adb index 92b04fd..1b697b9 100755 --- a/gcc/ada/a-suewen.adb +++ b/gcc/ada/a-suewse.adb @@ -2,7 +2,7 @@ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- --- ADA.STRINGS.UTF_ENCODING.WIDE_ENCODING -- +-- ADA.STRINGS.UTF_ENCODING.WIDE_STRING_ENCODING -- -- -- -- B o d y -- -- -- @@ -10,28 +10,26 @@ -- -- -- 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- -- --- ware Foundation; either version 2, or (at your option) any later ver- -- +-- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- --- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- --- for more details. You should have received a copy of the GNU General -- --- Public License distributed with GNAT; see file COPYING. If not, write -- --- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, -- --- Boston, MA 02110-1301, USA. -- +-- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- --- As a special exception, if other files instantiate generics from this -- --- unit, or you link this unit with other files to produce an executable, -- --- this unit does not by itself cause the resulting executable to be -- --- covered by the GNU General Public License. This exception does not -- --- however invalidate any other reasons why the executable file might be -- --- covered by the GNU Public License. -- +-- As a special exception under Section 7 of GPL version 3, you are granted -- +-- additional permissions described in the GCC Runtime Library Exception, -- +-- version 3.1, as published by the Free Software Foundation. -- +-- -- +-- You should have received a copy of the GNU General Public License and -- +-- a copy of the GCC Runtime Library Exception along with this program; -- +-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- +-- . -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ -package body Ada.Strings.UTF_Encoding.Wide_Encoding is +package body Ada.Strings.UTF_Encoding.Wide_String_Encoding is use Interfaces; ------------ @@ -369,4 +367,4 @@ package body Ada.Strings.UTF_Encoding.Wide_Encoding is return Result; end Encode; -end Ada.Strings.UTF_Encoding.Wide_Encoding; +end Ada.Strings.UTF_Encoding.Wide_String_Encoding; diff --git a/gcc/ada/a-suewen.ads b/gcc/ada/a-suewse.ads similarity index 93% rename from gcc/ada/a-suewen.ads rename to gcc/ada/a-suewse.ads index bae9e14..c013bad 100755 --- a/gcc/ada/a-suewen.ads +++ b/gcc/ada/a-suewse.ads @@ -2,7 +2,7 @@ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- --- ADA.STRINGS.UTF_ENCODING.WIDE_ENCODING -- +-- ADA.STRINGS.UTF_ENCODING.WIDE_STRING_ENCODING -- -- -- -- 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_Encoding is - pragma Pure (Wide_Encoding); +package Ada.Strings.UTF_Encoding.Wide_String_Encoding is + pragma Pure (Wide_String_Encoding); -- 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_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_Encoding; +end Ada.Strings.UTF_Encoding.Wide_String_Encoding; diff --git a/gcc/ada/a-suezen.adb b/gcc/ada/a-suezse.adb similarity index 92% rename from gcc/ada/a-suezen.adb rename to gcc/ada/a-suezse.adb index b917e9e..2aaf6b8 100755 --- a/gcc/ada/a-suezen.adb +++ b/gcc/ada/a-suezse.adb @@ -2,7 +2,7 @@ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- --- ADA.STRINGS.UTF_ENCODING.WIDE_WIDE_ENCODING -- +-- ADA.STRINGS.UTF_ENCODING.WIDE_WIDE_STRING_ENCODING -- -- -- -- B o d y -- -- -- @@ -10,28 +10,26 @@ -- -- -- 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- -- --- ware Foundation; either version 2, or (at your option) any later ver- -- +-- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- --- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- --- for more details. You should have received a copy of the GNU General -- --- Public License distributed with GNAT; see file COPYING. If not, write -- --- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, -- --- Boston, MA 02110-1301, USA. -- +-- or FITNESS FOR A PARTICULAR PURPOSE. -- -- -- --- As a special exception, if other files instantiate generics from this -- --- unit, or you link this unit with other files to produce an executable, -- --- this unit does not by itself cause the resulting executable to be -- --- covered by the GNU General Public License. This exception does not -- --- however invalidate any other reasons why the executable file might be -- --- covered by the GNU Public License. -- +-- As a special exception under Section 7 of GPL version 3, you are granted -- +-- additional permissions described in the GCC Runtime Library Exception, -- +-- version 3.1, as published by the Free Software Foundation. -- +-- -- +-- You should have received a copy of the GNU General Public License and -- +-- a copy of the GCC Runtime Library Exception along with this program; -- +-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- +-- . -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ -package body Ada.Strings.UTF_Encoding.Wide_Wide_Encoding is +package body Ada.Strings.UTF_Encoding.Wide_Wide_String_Encoding is use Interfaces; ------------ @@ -428,4 +426,4 @@ package body Ada.Strings.UTF_Encoding.Wide_Wide_Encoding is return Result (1 .. Len); end Encode; -end Ada.Strings.UTF_Encoding.Wide_Wide_Encoding; +end Ada.Strings.UTF_Encoding.Wide_Wide_String_Encoding; diff --git a/gcc/ada/a-suezen.ads b/gcc/ada/a-suezse.ads similarity index 93% rename from gcc/ada/a-suezen.ads rename to gcc/ada/a-suezse.ads index 7d2a91d..1882f42 100755 --- a/gcc/ada/a-suezen.ads +++ b/gcc/ada/a-suezse.ads @@ -2,7 +2,7 @@ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- --- ADA.STRINGS.UTF_ENCODING.WIDE_WIDE_ENCODING -- +-- ADA.STRINGS.UTF_ENCODING.WIDE_WIDE_STRING_ENCODING -- -- -- -- 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_Encoding is - pragma Pure (Wide_Wide_Encoding); +package Ada.Strings.UTF_Encoding.Wide_Wide_String_Encoding is + pragma Pure (Wide_Wide_String_Encoding); -- 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_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_Encoding; +end Ada.Strings.UTF_Encoding.Wide_Wide_String_Encoding; diff --git a/gcc/ada/exp_util.adb b/gcc/ada/exp_util.adb index b9e5d38..133a767 100644 --- a/gcc/ada/exp_util.adb +++ b/gcc/ada/exp_util.adb @@ -904,17 +904,19 @@ package body Exp_Util is ---------------------------------- function Component_May_Be_Bit_Aligned (Comp : Entity_Id) return Boolean is - UT : constant Entity_Id := Underlying_Type (Etype (Comp)); + UT : Entity_Id; begin -- If no component clause, then everything is fine, since the back end -- never bit-misaligns by default, even if there is a pragma Packed for -- the record. - if No (Component_Clause (Comp)) then + if No (Comp) or else No (Component_Clause (Comp)) then return False; end if; + UT := Underlying_Type (Etype (Comp)); + -- It is only array and record types that cause trouble if not Is_Record_Type (UT) diff --git a/gcc/ada/impunit.adb b/gcc/ada/impunit.adb index cbd4890..53f4783 100644 --- a/gcc/ada/impunit.adb +++ b/gcc/ada/impunit.adb @@ -173,13 +173,14 @@ package body Impunit is "a-wichun", -- Ada.Wide_Characters.Unicode "a-widcha", -- Ada.Wide_Characters - -- Note: strictly the next two should be Ada 2012 units, but it seems + -- Note: strictly the following should be Ada 2012 units, but it seems -- harmless (and useful) to make then available in Ada 95 mode, since - -- they only deal with Wide_Character, not Wide_Wide_Character. + -- they do not deal with Wide_Wide_Character. "a-stuten", -- Ada.Strings.UTF_Encoding "a-suenco", -- Ada.Strings.UTF_Encoding.Conversions - "a-suewen", -- Ada.Strings.UTF_Encoding.Wide_Encoding + "a-suesen", -- Ada.Strings.UTF_Encoding.String_Encoding + "a-suewse", -- Ada.Strings.UTF_Encoding.Wide_String_Encoding --------------------------- -- GNAT Special IO Units -- @@ -470,7 +471,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-suezen", -- Ada.Strings.UTF_Encoding.Wide_Wide_Encoding + "a-suezse", -- Ada.Strings.UTF_Encoding.Wide_Wide_String_Encoding --------------------------- -- GNAT Special IO Units -- diff --git a/gcc/ada/sem_ch8.adb b/gcc/ada/sem_ch8.adb index 370e2d6..6958862 100644 --- a/gcc/ada/sem_ch8.adb +++ b/gcc/ada/sem_ch8.adb @@ -7622,9 +7622,10 @@ package body Sem_Ch8 is begin S1 := Scope (Ent1); S2 := Scope (Ent2); - while S1 /= Standard_Standard - and then - S2 /= Standard_Standard + while Present (S1) + and then Present (S2) + and then S1 /= Standard_Standard + and then S2 /= Standard_Standard loop S1 := Scope (S1); S2 := Scope (S2); diff --git a/gcc/ada/sem_elab.adb b/gcc/ada/sem_elab.adb index 74aac9e..7ed76f6 100644 --- a/gcc/ada/sem_elab.adb +++ b/gcc/ada/sem_elab.adb @@ -2850,8 +2850,8 @@ package body Sem_Elab is Typ : constant Entity_Id := Etype (N); Chk : constant Boolean := Do_Range_Check (N); - R : constant Node_Id := - Make_Raise_Program_Error (Loc, + R : constant Node_Id := + Make_Raise_Program_Error (Loc, Reason => PE_Access_Before_Elaboration); Reloc_N : Node_Id; -- 2.7.4