Commit 3eb532e6 by Robert Dewar Committed by Arnaud Charlet

gnat_rm.texi: Document s-ststop.ads

2009-07-15  Robert Dewar  <dewar@adacore.com>

	* gnat_rm.texi: Document s-ststop.ads

	* impunit.ad: (Map_Array): New table of alternative names
	(Get_Kind_Of_Unit): Return possible suggested alternative name

	* impunit.ads (Get_Kind_Of_Unit): Return possible suggested
	alternative name.

	* sem_ch10.adb (Analalyze_With_Clause): Add name of possible
	alternative unit if an implementation unit is with'ed.

From-SVN: r149685
parent 4cd029c7
2009-07-15 Robert Dewar <dewar@adacore.com> 2009-07-15 Robert Dewar <dewar@adacore.com>
* gnat_rm.texi: Document s-ststop.ads
* impunit.ad: (Map_Array): New table of alternative names
(Get_Kind_Of_Unit): Return possible suggested alternative name
* impunit.ads (Get_Kind_Of_Unit): Return possible suggested
alternative name.
* sem_ch10.adb (Analalyze_With_Clause): Add name of possible
alternative unit if an implementation unit is with'ed.
2009-07-15 Robert Dewar <dewar@adacore.com>
* gnat_ugn.texi: Minor updates. * gnat_ugn.texi: Minor updates.
* snames.ads-tmpl: Minor comment updates for Ada 2005 fully implemented * snames.ads-tmpl: Minor comment updates for Ada 2005 fully implemented
......
...@@ -409,6 +409,7 @@ The GNAT Library ...@@ -409,6 +409,7 @@ The GNAT Library
* System.Pool_Local (s-pooloc.ads):: * System.Pool_Local (s-pooloc.ads)::
* System.Restrictions (s-restri.ads):: * System.Restrictions (s-restri.ads)::
* System.Rident (s-rident.ads):: * System.Rident (s-rident.ads)::
* System.Strings.Stream_Ops (s-ststop.ads)::
* System.Task_Info (s-tasinf.ads):: * System.Task_Info (s-tasinf.ads)::
* System.Wch_Cnv (s-wchcnv.ads):: * System.Wch_Cnv (s-wchcnv.ads)::
* System.Wch_Con (s-wchcon.ads):: * System.Wch_Con (s-wchcon.ads)::
...@@ -13597,6 +13598,7 @@ of GNAT, and will generate a warning message. ...@@ -13597,6 +13598,7 @@ of GNAT, and will generate a warning message.
* System.Pool_Local (s-pooloc.ads):: * System.Pool_Local (s-pooloc.ads)::
* System.Restrictions (s-restri.ads):: * System.Restrictions (s-restri.ads)::
* System.Rident (s-rident.ads):: * System.Rident (s-rident.ads)::
* System.Strings.Stream_Ops (s-ststop.ads)::
* System.Task_Info (s-tasinf.ads):: * System.Task_Info (s-tasinf.ads)::
* System.Wch_Cnv (s-wchcnv.ads):: * System.Wch_Cnv (s-wchcnv.ads)::
* System.Wch_Con (s-wchcon.ads):: * System.Wch_Con (s-wchcon.ads)::
...@@ -14939,6 +14941,18 @@ It is not normally necessary to @code{with} this generic package ...@@ -14939,6 +14941,18 @@ It is not normally necessary to @code{with} this generic package
since the necessary instantiation is included in since the necessary instantiation is included in
package System.Restrictions. package System.Restrictions.
@node System.Strings.Stream_Ops (s-ststop.ads)
@section @code{System.Strings.Stream_Ops} (@file{s-ststop.ads})
@cindex @code{System.Strings.Stream_Ops} (@file{s-ststop.ads})
@cindex Stream operations
@cindex String stream operations
@noindent
This package provides a set of stream subprograms for standard string types.
It is intended primarily to support implicit use of such subprograms when
stream attributes are applied to string types, but the subprograms in this
package can be used directly by application programs.
@node System.Task_Info (s-tasinf.ads) @node System.Task_Info (s-tasinf.ads)
@section @code{System.Task_Info} (@file{s-tasinf.ads}) @section @code{System.Task_Info} (@file{s-tasinf.ads})
@cindex @code{System.Task_Info} (@file{s-tasinf.ads}) @cindex @code{System.Task_Info} (@file{s-tasinf.ads})
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
with Atree; use Atree; with Atree; use Atree;
with Errout; use Errout;
with Sinfo; use Sinfo; with Sinfo; use Sinfo;
with Fname.UF; use Fname.UF; with Fname.UF; use Fname.UF;
with Lib; use Lib; with Lib; use Lib;
...@@ -471,6 +472,42 @@ package body Impunit is ...@@ -471,6 +472,42 @@ package body Impunit is
"g-zspche", -- GNAT.Wide_Wide_Spelling_Checker "g-zspche", -- GNAT.Wide_Wide_Spelling_Checker
"g-zstspl"); -- GNAT.Wide_Wide_String_Split "g-zstspl"); -- GNAT.Wide_Wide_String_Split
-----------------------
-- Alternative Units --
-----------------------
-- For some implementation units, there is a unit in the GNAT library
-- that has identical functionality that is usable. If we have such a
-- case we record the appropriate Unit name in Error_Msg_String.
type Aunit_Record is record
Fname : String (1 .. 6);
Aname : String_Ptr;
end record;
-- Array of alternative unit names
Scasuti : aliased String := "GNAT.Case_Util";
Sos_lib : aliased String := "GNAT.OS_Lib";
Sregexp : aliased String := "GNAT.Regexp";
Sregpat : aliased String := "GNAT.Regpat";
Sstring : aliased String := "GNAT.Strings";
Sstusta : aliased String := "GNAT.Task_Stack_Usage";
Stasloc : aliased String := "GNAT.Task_Lock";
Sutf_32 : aliased String := "GNAT.UTF_32";
-- Array giving mapping
Map_Array : constant array (1 .. 8) of Aunit_Record := (
("casuti", Scasuti'Access),
("os_lib", Sos_lib'Access),
("regexp", Sregexp'Access),
("regpat", Sregpat'Access),
("string", Sstring'Access),
("stusta", Sstusta'Access),
("tasloc", Stasloc'Access),
("utf_32", Sutf_32'Access));
---------------------- ----------------------
-- Get_Kind_Of_Unit -- -- Get_Kind_Of_Unit --
---------------------- ----------------------
...@@ -479,6 +516,8 @@ package body Impunit is ...@@ -479,6 +516,8 @@ package body Impunit is
Fname : constant File_Name_Type := Unit_File_Name (U); Fname : constant File_Name_Type := Unit_File_Name (U);
begin begin
Error_Msg_Strlen := 0;
-- If length of file name is greater than 12, not predefined. -- If length of file name is greater than 12, not predefined.
-- The value 12 here is an 8 char name with extension .ads. -- The value 12 here is an 8 char name with extension .ads.
...@@ -559,7 +598,23 @@ package body Impunit is ...@@ -559,7 +598,23 @@ package body Impunit is
return Ada_95_Unit; return Ada_95_Unit;
end if; end if;
-- All tests failed, this is definitely an implementation unit -- All tests failed, this is definitely an implementation unit. See if
-- we have an alternative name.
Get_Name_String (Fname);
if Name_Len = 12
and then Name_Buffer (1 .. 2) = "s-"
and then Name_Buffer (9 .. 12) = ".ads"
then
for J in Map_Array'Range loop
if Name_Buffer (3 .. 8) = Map_Array (J).Fname then
Error_Msg_Strlen := Map_Array (J).Aname'Length;
Error_Msg_String (1 .. Error_Msg_Strlen) :=
Map_Array (J).Aname.all;
end if;
end loop;
end if;
return Implementation_Unit; return Implementation_Unit;
end Get_Kind_Of_Unit; end Get_Kind_Of_Unit;
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- S p e c -- -- S p e c --
-- -- -- --
-- Copyright (C) 2000-2007, Free Software Foundation, Inc. -- -- Copyright (C) 2000-2009, 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- --
...@@ -55,7 +55,11 @@ package Impunit is ...@@ -55,7 +55,11 @@ package Impunit is
function Get_Kind_Of_Unit (U : Unit_Number_Type) return Kind_Of_Unit; function Get_Kind_Of_Unit (U : Unit_Number_Type) return Kind_Of_Unit;
-- Given the unit number of a unit, this function determines the type -- Given the unit number of a unit, this function determines the type
-- of the unit, as defined above. -- of the unit, as defined above. If the result is Implementation_Unit,
-- then the name of a possible atlernative equivalent unit is placed in
-- Error_Msg_String/Slen on return. If there is no alternative name, or
-- if the result is not Implementation_Unit, then Error_Msg_Slen is zero
-- on return, indicating that no alternative name was found.
function Is_Known_Unit (Nam : Node_Id) return Boolean; function Is_Known_Unit (Nam : Node_Id) return Boolean;
-- Nam is the possible name of a child unit, represented as a selected -- Nam is the possible name of a child unit, represented as a selected
......
...@@ -2334,12 +2334,10 @@ package body Sem_Ch10 is ...@@ -2334,12 +2334,10 @@ package body Sem_Ch10 is
end if; end if;
-- Check for inappropriate with of internal implementation unit if we -- Check for inappropriate with of internal implementation unit if we
-- are currently compiling the main unit and the main unit is itself -- are not compiling an internal unit. We do not issue this message
-- not an internal unit. We do not issue this message for implicit -- for implicit with's generated by the compiler itself.
-- with's generated by the compiler itself.
if Implementation_Unit_Warnings if Implementation_Unit_Warnings
and then Current_Sem_Unit = Main_Unit
and then not Intunit and then not Intunit
and then not Implicit_With (N) and then not Implicit_With (N)
then then
...@@ -2350,10 +2348,17 @@ package body Sem_Ch10 is ...@@ -2350,10 +2348,17 @@ package body Sem_Ch10 is
begin begin
if U_Kind = Implementation_Unit then if U_Kind = Implementation_Unit then
Error_Msg_F ("& is an internal 'G'N'A'T unit?", Name (N)); Error_Msg_F ("& is an internal 'G'N'A'T unit?", Name (N));
Error_Msg_F
("\use of this unit is non-portable " & -- Add alternative name if available, otherwise issue a
"and version-dependent?", -- general warning message.
Name (N));
if Error_Msg_Strlen /= 0 then
Error_Msg_F ("\use ""~"" instead", Name (N));
else
Error_Msg_F
("\use of this unit is non-portable " &
"and version-dependent?", Name (N));
end if;
elsif U_Kind = Ada_05_Unit elsif U_Kind = Ada_05_Unit
and then Ada_Version < Ada_05 and then Ada_Version < Ada_05
......
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