]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[multiple changes]
authorArnaud Charlet <charlet@gcc.gnu.org>
Tue, 29 Jul 2014 13:24:47 +0000 (15:24 +0200)
committerArnaud Charlet <charlet@gcc.gnu.org>
Tue, 29 Jul 2014 13:24:47 +0000 (15:24 +0200)
2014-07-29  Robert Dewar  <dewar@adacore.com>

* gnat_ugn.texi: Add section on Wide_Wide_Character encodings.
* erroutc.adb (Output_Error_Msgs): Take wide characters into
account in computing position of error flags.
* sinput.adb (Get_Column_Number): Take wide characters into
account.

2014-07-29  Ed Schonberg  <schonberg@adacore.com>

* par-ch3.adb (P_Access_Type_Definition): The subtype indication
in an access type definition can carry a null_exclusion indicator.
* sem_ch3.adb (Access_Type_Declaration): If the subtype indication
carries a null_exclusion indicator, verify that the subtype
indication denotes an access type, and create a null-excluding
subtype for it.
* sinfo.ads, sinfo.adb: New attribute Null_Excluding_Subtype,
defined on N_Access_To_Object_Definition to indicate that the
subtype indication carries a null_exclusion indicator.

2014-07-29  Hristian Kirtchev  <kirtchev@adacore.com>

* exp_ch6.adb (Add_Extra_Actual): Do not construct
the extra actual by name, generate a reference instead.

2014-07-29  Arnaud Charlet  <charlet@adacore.com>

* sem_prag.adb (Analyze_Pragma): Do not crash analyzing
Allow_Integer_Address if already set.
* a-except-2005.adb (Rcheck_PE_Stream_Operation_Not_Allowed):
Fix order, for consistency with Rmsg_xx declarations.

From-SVN: r213172

gcc/ada/ChangeLog
gcc/ada/a-except-2005.adb
gcc/ada/erroutc.adb
gcc/ada/exp_ch6.adb
gcc/ada/gnat_ugn.texi
gcc/ada/par-ch3.adb
gcc/ada/sem_ch3.adb
gcc/ada/sem_prag.adb
gcc/ada/sinfo.adb
gcc/ada/sinfo.ads
gcc/ada/sinput.adb

index 218c225cbcc2cfc067d5d2ff01a011e4be831579..d85f48729783de328b72fa5216a79ba3f2df34f2 100644 (file)
@@ -1,3 +1,35 @@
+2014-07-29  Robert Dewar  <dewar@adacore.com>
+
+       * gnat_ugn.texi: Add section on Wide_Wide_Character encodings.
+       * erroutc.adb (Output_Error_Msgs): Take wide characters into
+       account in computing position of error flags.
+       * sinput.adb (Get_Column_Number): Take wide characters into
+       account.
+
+2014-07-29  Ed Schonberg  <schonberg@adacore.com>
+
+       * par-ch3.adb (P_Access_Type_Definition): The subtype indication
+       in an access type definition can carry a null_exclusion indicator.
+       * sem_ch3.adb (Access_Type_Declaration): If the subtype indication
+       carries a null_exclusion indicator, verify that the subtype
+       indication denotes an access type, and create a null-excluding
+       subtype for it.
+       * sinfo.ads, sinfo.adb: New attribute Null_Excluding_Subtype,
+       defined on N_Access_To_Object_Definition to indicate that the
+       subtype indication carries a null_exclusion indicator.
+
+2014-07-29  Hristian Kirtchev  <kirtchev@adacore.com>
+
+       * exp_ch6.adb (Add_Extra_Actual): Do not construct
+       the extra actual by name, generate a reference instead.
+
+2014-07-29  Arnaud Charlet  <charlet@adacore.com>
+
+       * sem_prag.adb (Analyze_Pragma): Do not crash analyzing
+       Allow_Integer_Address if already set.
+       * a-except-2005.adb (Rcheck_PE_Stream_Operation_Not_Allowed):
+       Fix order, for consistency with Rmsg_xx declarations.
+
 2014-07-29  Ed Schonberg  <schonberg@adacore.com>
 
        * sem_ch4.adb (Complete_Object_Operation): If the type of the
index 52de66f21878251094a5451d971b269875b0aea0..ab29b0988f6d833459b9d91f55f665edb229b926 100644 (file)
@@ -403,6 +403,9 @@ package body Ada.Exceptions is
    --  These routines raise a specific exception with a reason message
    --  attached. The parameters are the file name and line number in each
    --  case. The names are defined by Exp_Ch11.Get_RT_Exception_Name.
+   --  Note that these routines should be declared in the same order as the
+   --  corresponding Rmsg_xx constants below, this is needed by the
+   --  .NET runtime (see exceptmsg.awk script).
 
    procedure Rcheck_CE_Access_Check
      (File : System.Address; Line : Integer);
@@ -462,8 +465,6 @@ package body Ada.Exceptions is
      (File : System.Address; Line : Integer);
    procedure Rcheck_PE_Potentially_Blocking_Operation
      (File : System.Address; Line : Integer);
-   procedure Rcheck_PE_Stream_Operation_Not_Allowed
-     (File : System.Address; Line : Integer);
    procedure Rcheck_PE_Stubbed_Subprogram_Called
      (File : System.Address; Line : Integer);
    procedure Rcheck_PE_Unchecked_Union_Restriction
@@ -476,6 +477,8 @@ package body Ada.Exceptions is
      (File : System.Address; Line : Integer);
    procedure Rcheck_SE_Object_Too_Large
      (File : System.Address; Line : Integer);
+   procedure Rcheck_PE_Stream_Operation_Not_Allowed
+     (File : System.Address; Line : Integer);
 
    procedure Rcheck_CE_Access_Check_Ext
      (File : System.Address; Line, Column : Integer);
index 66ab8f18452d0df705d12815dc4b8119639d154a..4e5070a74f29acd644ea6c929e12e229927513d9 100644 (file)
@@ -42,6 +42,7 @@ with Snames;   use Snames;
 with Stringt;  use Stringt;
 with Targparm; use Targparm;
 with Uintp;    use Uintp;
+with Widechar; use Widechar;
 
 package body Erroutc is
 
@@ -445,32 +446,75 @@ package body Erroutc is
            and then Errors.Table (T).Line = Errors.Table (E).Line
            and then Errors.Table (T).Sfile = Errors.Table (E).Sfile
          loop
-            --  Loop to output blanks till current flag position
+            declare
+               Src : Source_Buffer_Ptr
+                       renames Source_Text (Errors.Table (T).Sfile);
 
-            while P < Errors.Table (T).Sptr loop
-               if Source_Text (Errors.Table (T).Sfile) (P) = ASCII.HT then
-                  Write_Char (ASCII.HT);
-               else
-                  Write_Char (' ');
-               end if;
+            begin
+               --  Loop to output blanks till current flag position
 
-               P := P + 1;
-            end loop;
+               while P < Errors.Table (T).Sptr loop
 
-            --  Output flag (unless already output, this happens if more
-            --  than one error message occurs at the same flag position).
+                  --  Horizontal tab case, just echo the tab
 
-            if P = Errors.Table (T).Sptr then
-               if (Flag_Num = 1 and then not Mult_Flags)
-                 or else Flag_Num > 9
-               then
-                  Write_Char ('|');
-               else
-                  Write_Char (Character'Val (Character'Pos ('0') + Flag_Num));
-               end if;
+                  if Src (P) = ASCII.HT then
+                     Write_Char (ASCII.HT);
+                     P := P + 1;
 
-               P := P + 1;
-            end if;
+                  --  Deal with wide character case, but don't include brackets
+                  --  notation in this circuit, since we know that this will
+                  --  display unencoded (no one encodes brackets notation).
+
+                  elsif Src (P) /= '['
+                    and then Is_Start_Of_Wide_Char (Src, P)
+                  then
+                     Skip_Wide (Src, P);
+                     Write_Char (' ');
+
+                  --  Normal non-wide character case (or bracket)
+
+                  else
+                     P := P + 1;
+                     Write_Char (' ');
+                  end if;
+               end loop;
+
+               --  Output flag (unless already output, this happens if more
+               --  than one error message occurs at the same flag position).
+
+               if P = Errors.Table (T).Sptr then
+                  if (Flag_Num = 1 and then not Mult_Flags)
+                    or else Flag_Num > 9
+                  then
+                     Write_Char ('|');
+                  else
+                     Write_Char
+                       (Character'Val (Character'Pos ('0') + Flag_Num));
+                  end if;
+
+                  --  Skip past the corresponding source text character
+
+                  --  Horizontal tab case, we output a flag at the tab position
+                  --  so now we output a tab to match up with the text.
+
+                  if Src (P) = ASCII.HT then
+                     Write_Char (ASCII.HT);
+                     P := P + 1;
+
+                  --  Skip wide character other than left bracket
+
+                  elsif Src (P) /= '['
+                    and then Is_Start_Of_Wide_Char (Src, P)
+                  then
+                     Skip_Wide (Src, P);
+
+                  --  Skip normal non-wide character case (or bracket)
+
+                  else
+                     P := P + 1;
+                  end if;
+               end if;
+            end;
 
             Set_Next_Non_Deleted_Msg (T);
             Flag_Num := Flag_Num + 1;
index 9344e40aad8060515b3c97eb2d0214a3421c3a16..703a4279d482e6ab6a98f04670123963fb839abe 100644 (file)
@@ -2106,7 +2106,7 @@ package body Exp_Ch6 is
 
          Append_To (Extra_Actuals,
            Make_Parameter_Association (Loc,
-             Selector_Name             => Make_Identifier (Loc, Chars (EF)),
+             Selector_Name             => New_Occurrence_Of (EF, Loc),
              Explicit_Actual_Parameter => Expr));
 
          Analyze_And_Resolve (Expr, Etype (EF));
index 6b8079c9de6d35dc87a156dca466fb1940e38acd..b4a7025fcfcd688626b5f4dc3f7d6ee7803c7297 100644 (file)
@@ -1378,7 +1378,8 @@ of the compiler (@pxref{Character Set Control}).
 @menu
 * Latin-1::
 * Other 8-Bit Codes::
-* Wide Character Encodings::
+* Wide_Character Encodings::
+* Wide_Wide_Character Encodings::
 @end menu
 
 @node Latin-1
@@ -1471,8 +1472,8 @@ equivalences that are recognized, see the file @file{csets.adb} in
 the GNAT compiler sources. You will need to obtain a full source release
 of GNAT to obtain this file.
 
-@node Wide Character Encodings
-@subsection Wide Character Encodings
+@node Wide_Character Encodings
+@subsection Wide_Character Encodings
 
 @noindent
 GNAT allows wide character codes to appear in character and string
@@ -1545,8 +1546,9 @@ where the @var{xxx} bits correspond to the left-padded bits of the
 are represented as ASCII bytes and all upper half characters and
 other wide characters are represented as sequences of upper-half
 (The full UTF-8 scheme allows for encoding 31-bit characters as
-6-byte sequences, but in this implementation, all UTF-8 sequences
-of four or more bytes length will be treated as illegal).
+6-byte sequences, and in the following section on wide wide
+characters, the use of these sequences is documented).
+
 @item Brackets Coding
 In this encoding, a wide character is represented by the following eight
 character sequence:
@@ -1564,8 +1566,8 @@ Brackets coding for upper half characters. For example, the code
 @code{16#A3#} can be represented as @code{[``A3'']}.
 
 This scheme is compatible with use of the full Wide_Character set,
-and is also the method used for wide character encoding in the standard
-ACVC (Ada Compiler Validation Capability) test suite distributions.
+and is also the method used for wide character encoding in some standard
+ACATS (Ada Conformity Assessment Test Suite) test suite distributions.
 
 @end table
 
@@ -1574,6 +1576,60 @@ Note: Some of these coding schemes do not permit the full use of the
 Ada character set. For example, neither Shift JIS, nor EUC allow the
 use of the upper half of the Latin-1 set.
 
+@node Wide_Wide_Character Encodings
+@subsection Wide_Wide_Character Encodings
+
+@noindent
+GNAT allows wide wide character codes to appear in character and string
+literals, and also optionally in identifiers, by means of the following
+possible encoding schemes:
+
+@table @asis
+
+@item UTF-8 Coding
+A wide character is represented using
+UCS Transformation Format 8 (UTF-8) as defined in Annex R of ISO
+10646-1/Am.2. Depending on the character value, the representation
+of character codes with values greater than 16#FFFF# is a
+is a four, five, or six byte sequence:
+
+@smallexample
+@iftex
+@leftskip=.7cm
+@end iftex
+16#01_0000#-16#10_FFFF#:     11110xxx 10xxxxxx 10xxxxxx
+                             10xxxxxx
+16#0020_0000#-16#03FF_FFFF#: 111110xx 10xxxxxx 10xxxxxx
+                             10xxxxxx 10xxxxxx
+16#0400_0000#-16#7FFF_FFFF#: 1111110x 10xxxxxx 10xxxxxx
+                             10xxxxxx 10xxxxxx 10xxxxxx
+@end smallexample
+
+@noindent
+where the @var{xxx} bits correspond to the left-padded bits of the
+32-bit character value.
+
+@item Brackets Coding
+In this encoding, a wide wide character is represented by the following ten or
+twelve byte character sequence:
+
+@smallexample
+[ " a b c d e f " ]
+[ " a b c d e f g h " ]
+@end smallexample
+
+@noindent
+Where @code{a-h} are the six or eight hexadecimal
+characters (using uppercase letters) of the wide wide character code. For
+example, ["1F4567"] is used to represent the wide wide character with code
+@code{16#001F_4567#}.
+
+This scheme is compatible with use of the full Wide_Wide_Character set,
+and is also the method used for wide wide character encoding in some standard
+ACATS (Ada Conformity Assessment Test Suite) test suite distributions.
+
+@end table
+
 @node File Naming Rules
 @section File Naming Rules
 
@@ -7222,7 +7278,7 @@ UTF-8 encoding (brackets encoding also recognized)
 Brackets encoding only (default value)
 @end table
 For full details on these encoding
-methods see @ref{Wide Character Encodings}.
+methods see @ref{Wide_Character Encodings}.
 Note that brackets coding is always accepted, even if one of the other
 options is specified, so for example @option{-gnatW8} specifies that both
 brackets and UTF-8 encodings will be recognized. The units that are
index 3d6161b2165959a8ac10ecedadd3fcfb5d35d9e9..1bad0054b094863de3fd8a79f602a648be316587 100644 (file)
@@ -3930,6 +3930,7 @@ package body Ch3 is
       Access_Loc       : constant Source_Ptr := Token_Ptr;
       Prot_Flag        : Boolean;
       Not_Null_Present : Boolean := False;
+      Not_Null_Subtype : Boolean := False;
       Type_Def_Node    : Node_Id;
       Result_Not_Null  : Boolean;
       Result_Node      : Node_Id;
@@ -3964,8 +3965,16 @@ package body Ch3 is
 
    begin
       if not Header_Already_Parsed then
-         Not_Null_Present := P_Null_Exclusion;         --  Ada 2005 (AI-231)
+
+         --  not null access .. is a common form of access definition
+         --  access non null ..  is certainly rare, but syntactically legal.
+         --  not null access not null .. is rarer yet, and also legal.
+         --  The last two cases are only meaningful if the following subtype
+         --  indication denotes an access type (semantic check).
+
+         Not_Null_Present := P_Null_Exclusion;     --  Ada 2005 (AI-231)
          Scan; -- past ACCESS
+         Not_Null_Subtype := P_Null_Exclusion;     --  Might also appear.
       end if;
 
       if Token_Name = Name_Protected then
@@ -4040,6 +4049,7 @@ package body Ch3 is
          Type_Def_Node :=
            New_Node (N_Access_To_Object_Definition, Access_Loc);
          Set_Null_Exclusion_Present (Type_Def_Node, Not_Null_Present);
+         Set_Null_Excluding_Subtype (Type_Def_Node, Not_Null_Subtype);
 
          if Token = Tok_All or else Token = Tok_Constant then
             if Ada_Version = Ada_83 then
index a2aeaf96c4ca3b290a6f121d6a288c3c9cb429df..e93230ae2bcc3392ea18ce92f52612cd6c9379eb 100644 (file)
@@ -1337,6 +1337,34 @@ package body Sem_Ch3 is
               Process_Subtype (S, P, T, 'P'));
          end if;
 
+         --  If the access definition is of the form : access not null ..
+         --  the subtype indication must be of an access type. Create
+         --  a null-excluding subtype of it.
+
+         if Null_Excluding_Subtype (Def) then
+            if not Is_Access_Type (Entity (S)) then
+               Error_Msg_N ("null exclusion must apply to access type", Def);
+
+            else
+               declare
+                  Loc  : constant Source_Ptr := Sloc (S);
+                  Decl : Node_Id;
+                  Nam  : constant Entity_Id := Make_Temporary (Loc, 'S');
+
+               begin
+                  Decl :=
+                    Make_Subtype_Declaration (Loc,
+                      Defining_Identifier => Nam,
+                      Subtype_Indication =>
+                        New_Occurrence_Of (Entity (S), Loc));
+                  Set_Null_Exclusion_Present (Decl);
+                  Insert_Before (Parent (Def), Decl);
+                  Analyze (Decl);
+                  Set_Entity (S, Nam);
+               end;
+            end if;
+         end if;
+
       else
          Set_Directly_Designated_Type (T,
            Process_Subtype (S, P, T, 'P'));
index 66b5640bf1fee2dd6f8ca9f02ffff51f71bedabf..208a9541d25ee17ce7bb6d6f2c6a5935805ed09d 100644 (file)
@@ -11019,8 +11019,13 @@ package body Sem_Prag is
             --  integer address values. If Address is not private (e.g. on
             --  VMS, where it is an integer type), then this pragma has no
             --  purpose, so it is simply ignored.
+            --  If Allow_Integer_Address is already set do nothing, otherwise
+            --  calling RTE on RE_Address would cause a crash when loading
+            --  system.ads.
 
-            if Is_Private_Type (RTE (RE_Address)) then
+            if not Opt.Allow_Integer_Address
+              and then Is_Private_Type (RTE (RE_Address))
+            then
                Opt.Allow_Integer_Address := True;
             end if;
 
index 232e0bc1ebb64754d42a334511a6645de37a6a33..3ea385c3877c6254fd1442f675128408ae6baaed 100644 (file)
@@ -2382,6 +2382,14 @@ package body Sinfo is
       return Flag13 (N);
    end Null_Present;
 
+   function Null_Excluding_Subtype
+      (N : Node_Id) return Boolean is
+   begin
+      pragma Assert (False
+        or else NT (N).Nkind = N_Access_To_Object_Definition);
+      return Flag16 (N);
+   end Null_Excluding_Subtype;
+
    function Null_Exclusion_Present
       (N : Node_Id) return Boolean is
    begin
@@ -5565,6 +5573,14 @@ package body Sinfo is
       Set_Flag13 (N, Val);
    end Set_Null_Present;
 
+   procedure Set_Null_Excluding_Subtype
+      (N : Node_Id; Val : Boolean := True) is
+   begin
+      pragma Assert (False
+        or else NT (N).Nkind = N_Access_To_Object_Definition);
+      Set_Flag16 (N, Val);
+   end Set_Null_Excluding_Subtype;
+
    procedure Set_Null_Exclusion_Present
       (N : Node_Id; Val : Boolean := True) is
    begin
index 1fb1acfb57c5275beda7f739fc6b7fa9ffed0a06..1b2ae3ea2d61851458136e7a0d905143dc61e7e1 100644 (file)
@@ -3369,6 +3369,7 @@ package Sinfo is
       --  Sloc points to ACCESS
       --  All_Present (Flag15)
       --  Null_Exclusion_Present (Flag11)
+      --  Null_Excluding_Subtype (Flag16)
       --  Subtype_Indication (Node5)
       --  Constant_Present (Flag17)
 
@@ -9363,6 +9364,9 @@ package Sinfo is
    function Null_Present
      (N : Node_Id) return Boolean;    -- Flag13
 
+   function Null_Excluding_Subtype
+     (N : Node_Id) return Boolean;    -- Flag16
+
    function Null_Exclusion_Present
      (N : Node_Id) return Boolean;    -- Flag11
 
@@ -10377,6 +10381,9 @@ package Sinfo is
    procedure Set_Null_Present
      (N : Node_Id; Val : Boolean := True);    -- Flag13
 
+   procedure Set_Null_Excluding_Subtype
+     (N : Node_Id; Val : Boolean := True);    -- Flag16
+
    procedure Set_Null_Exclusion_Present
      (N : Node_Id; Val : Boolean := True);    -- Flag11
 
@@ -12652,6 +12659,7 @@ package Sinfo is
    pragma Inline (No_Truncation);
    pragma Inline (Non_Aliased_Prefix);
    pragma Inline (Null_Present);
+   pragma Inline (Null_Excluding_Subtype);
    pragma Inline (Null_Exclusion_Present);
    pragma Inline (Null_Exclusion_In_Return_Present);
    pragma Inline (Null_Record_Present);
@@ -12985,6 +12993,7 @@ package Sinfo is
    pragma Inline (Set_No_Minimize_Eliminate);
    pragma Inline (Set_No_Truncation);
    pragma Inline (Set_Non_Aliased_Prefix);
+   pragma Inline (Set_Null_Excluding_Subtype);
    pragma Inline (Set_Null_Exclusion_Present);
    pragma Inline (Set_Null_Exclusion_In_Return_Present);
    pragma Inline (Set_Null_Present);
index dac8dd809a890ebce9e4d08b19d88ad5b2a3a333..70d44816f94938da5e1f93183107a3813302771f 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 1992-2013, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2014, 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- --
@@ -331,11 +331,22 @@ package body Sinput is
          while S < P loop
             if Src (S) = HT then
                C := (C - 1) / 8 * 8 + (8 + 1);
+               S := S + 1;
+
+            --  Deal with wide character case, but don't include brackets
+            --  notation in this circuit, since we know that this will
+            --  display unencoded (no one encodes brackets notation).
+
+            elsif Src (S) /= '[' and then Is_Start_Of_Wide_Char (Src, S) then
+               C := C + 1;
+               Skip_Wide (Src, S);
+
+            --  Normal (non-wide) character case or brackets sequence
+
             else
                C := C + 1;
+               S := S + 1;
             end if;
-
-            S := S + 1;
          end loop;
 
          return C;