2015-01-30 Robert Dewar <dewar@adacore.com>
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 30 Jan 2015 15:23:22 +0000 (15:23 +0000)
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 30 Jan 2015 15:23:22 +0000 (15:23 +0000)
* sem_prag.adb (Process_Import_Or_Interface): Warn if used in
Pure unit.
* s-valllu.ads (Scan_Raw_Long_Long_Unsigned): Clarify
documentation for some special cases of invalid attempts at
based integers.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@220287 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ada/ChangeLog
gcc/ada/s-valllu.ads
gcc/ada/sem_prag.adb

index 8829a1f..f9cbac4 100644 (file)
@@ -1,3 +1,11 @@
+2015-01-30  Robert Dewar  <dewar@adacore.com>
+
+       * sem_prag.adb (Process_Import_Or_Interface): Warn if used in
+       Pure unit.
+       * s-valllu.ads (Scan_Raw_Long_Long_Unsigned): Clarify
+       documentation for some special cases of invalid attempts at
+       based integers.
+
 2015-01-30  Gary Dismukes  <dismukes@adacore.com>
 
        * errout.ads: Minor reformatting.
index 993ea8b..612004a 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 S p e c                                  --
 --                                                                          --
---          Copyright (C) 1992-2014, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2015, 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- --
@@ -65,13 +65,32 @@ package System.Val_LLU is
    --  seem to imply that for a case like
    --
    --    8#12345670009#
-
+   --
    --  the pointer should be left at the first # having scanned out the longest
    --  valid integer literal (8), but in fact in this case the pointer points
-   --  to the invalid based digit (9 in this case). Not only would the strict
-   --  reading of the RM require unlimited backup, which is unreasonable, but
-   --  in addition, the intepretation as given here is the one expected and
-   --  enforced by the ACATS tests.
+   --  past the final # and Constraint_Error is raised. This is the behavior
+   --  expected for Text_IO and enforced by the ACATS tests.
+   --
+   --  If a based literal is malformed in that a character other than a valid
+   --  hexadecimal digit is encountered during scanning out the digits after
+   --  the # (this includes the case of using the wrong terminator, : instead
+   --  of # or vice versa) there are two cases. If all the digits before the
+   --  non-digit are in range of the base, as in
+   --
+   --    8#100x00#
+   --    8#100:
+   --
+   --  then in this case, the "base" value before the initial # is returned as
+   --  the result, and the pointer points to the initial # character on return.
+   --
+   --  If an out of range digit has been detected before the invalid character,
+   --  as in:
+   --
+   --   8#900x00#
+   --   8#900:
+   --
+   --  then the pointer is also left at the initial # character, but constraint
+   --  error is raised reflecting the encounter of an out of range digit.
    --
    --  Note: if Str is empty, i.e. if Max is less than Ptr, then this is a
    --  special case of an all-blank string, and Ptr is unchanged, and hence
index 4a3bb21..bd236e5 100644 (file)
@@ -3169,7 +3169,7 @@ package body Sem_Prag is
       --  Common processing for Share_Generic and Inline_Generic
 
       procedure Process_Import_Or_Interface;
-      --  Common processing for Import of Interface
+      --  Common processing for Import or Interface
 
       procedure Process_Import_Predefined_Type;
       --  Processing for completing a type with pragma Import. This is used
@@ -7742,6 +7742,8 @@ package body Sem_Prag is
             Note_Possible_Modification (Get_Pragma_Arg (Arg2), Sure => False);
          end if;
 
+         --  Various error checks
+
          if Ekind_In (Def_Id, E_Variable, E_Constant) then
 
             --  We do not permit Import to apply to a renaming declaration