Commit b7db1149 by Robert Dewar Committed by Arnaud Charlet

sem_prag.adb (Process_Import_Or_Interface): Warn if used in Pure unit.

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.

From-SVN: r220287
parent 1db700c3
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> 2015-01-30 Gary Dismukes <dismukes@adacore.com>
* errout.ads: Minor reformatting. * errout.ads: Minor reformatting.
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- S p e c -- -- 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 -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -65,13 +65,32 @@ package System.Val_LLU is ...@@ -65,13 +65,32 @@ package System.Val_LLU is
-- seem to imply that for a case like -- seem to imply that for a case like
-- --
-- 8#12345670009# -- 8#12345670009#
--
-- the pointer should be left at the first # having scanned out the longest -- 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 -- 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 -- past the final # and Constraint_Error is raised. This is the behavior
-- reading of the RM require unlimited backup, which is unreasonable, but -- expected for Text_IO and enforced by the ACATS tests.
-- in addition, the intepretation as given here is the one expected 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 -- 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 -- special case of an all-blank string, and Ptr is unchanged, and hence
......
...@@ -3169,7 +3169,7 @@ package body Sem_Prag is ...@@ -3169,7 +3169,7 @@ package body Sem_Prag is
-- Common processing for Share_Generic and Inline_Generic -- Common processing for Share_Generic and Inline_Generic
procedure Process_Import_Or_Interface; procedure Process_Import_Or_Interface;
-- Common processing for Import of Interface -- Common processing for Import or Interface
procedure Process_Import_Predefined_Type; procedure Process_Import_Predefined_Type;
-- Processing for completing a type with pragma Import. This is used -- Processing for completing a type with pragma Import. This is used
...@@ -7742,6 +7742,8 @@ package body Sem_Prag is ...@@ -7742,6 +7742,8 @@ package body Sem_Prag is
Note_Possible_Modification (Get_Pragma_Arg (Arg2), Sure => False); Note_Possible_Modification (Get_Pragma_Arg (Arg2), Sure => False);
end if; end if;
-- Various error checks
if Ekind_In (Def_Id, E_Variable, E_Constant) then if Ekind_In (Def_Id, E_Variable, E_Constant) then
-- We do not permit Import to apply to a renaming declaration -- We do not permit Import to apply to a renaming declaration
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment