From b7db11490f4928d6e15c7e2310e65b53225f0f21 Mon Sep 17 00:00:00 2001 From: Robert Dewar Date: Fri, 30 Jan 2015 15:23:22 +0000 Subject: [PATCH] sem_prag.adb (Process_Import_Or_Interface): Warn if used in Pure unit. 2015-01-30 Robert Dewar * 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. From-SVN: r220287 --- gcc/ada/ChangeLog | 8 ++++++++ gcc/ada/s-valllu.ads | 31 +++++++++++++++++++++++++------ gcc/ada/sem_prag.adb | 4 +++- 3 files changed, 36 insertions(+), 7 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 8829a1f707b..f9cbac4c1c1 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,11 @@ +2015-01-30 Robert Dewar + + * 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 * errout.ads: Minor reformatting. diff --git a/gcc/ada/s-valllu.ads b/gcc/ada/s-valllu.ads index 993ea8b0dd8..612004accb4 100644 --- a/gcc/ada/s-valllu.ads +++ b/gcc/ada/s-valllu.ads @@ -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 diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb index 4a3bb2172c5..bd236e5eee0 100644 --- a/gcc/ada/sem_prag.adb +++ b/gcc/ada/sem_prag.adb @@ -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 -- 2.30.2