[multiple changes]
2011-09-02 Vincent Celier <celier@adacore.com> * prj-nmsc.db: (Check_Stand_Alone_Library): For SALs, allow only library names with the syntax of Ada identifiers, to avoid errors when compiling the binder generated files. * projects.texi: Document restriction on SAL library names 2011-09-02 Thomas Quinot <quinot@adacore.com> * a-chtgbo.adb: Minor comment fix. From-SVN: r178455
This commit is contained in:
parent
439b6dfab1
commit
7a0ddd20bc
@ -1,3 +1,14 @@
|
||||
2011-09-02 Vincent Celier <celier@adacore.com>
|
||||
|
||||
* prj-nmsc.db: (Check_Stand_Alone_Library): For SALs, allow
|
||||
only library names with the syntax of Ada identifiers, to avoid errors
|
||||
when compiling the binder generated files.
|
||||
* projects.texi: Document restriction on SAL library names
|
||||
|
||||
2011-09-02 Thomas Quinot <quinot@adacore.com>
|
||||
|
||||
* a-chtgbo.adb: Minor comment fix.
|
||||
|
||||
2011-09-02 Robert Dewar <dewar@adacore.com>
|
||||
|
||||
* lib-xref.adb: Minor reformatting
|
||||
|
@ -144,7 +144,7 @@ package body Ada.Containers.Hash_Tables.Generic_Bounded_Operations is
|
||||
-- value 0 as an error. The precondition was weakened, so that index
|
||||
-- value 0 is now allowed, and this value is interpreted to mean "do
|
||||
-- nothing". This makes its behavior analogous to the behavior of
|
||||
-- Ada.Unchecked_Conversion, and allows callers to avoid having to add
|
||||
-- Ada.Unchecked_Deallocation, and allows callers to avoid having to add
|
||||
-- special-case checks at the point of call.
|
||||
|
||||
if X = 0 then
|
||||
|
@ -82,8 +82,7 @@ package body Prj.Nmsc is
|
||||
Hash => Hash,
|
||||
Equal => "=");
|
||||
-- File name information found in string list attribute (Source_Files or
|
||||
-- Source_List_File). Except is set to True if source is a naming exception
|
||||
-- in the project. Used to check that all referenced files were indeed
|
||||
-- Source_List_File). Used to check that all referenced files were indeed
|
||||
-- found on the disk.
|
||||
|
||||
type Unit_Exception is record
|
||||
@ -4302,6 +4301,12 @@ package body Prj.Nmsc is
|
||||
is
|
||||
Shared : constant Shared_Project_Tree_Data_Access := Data.Tree.Shared;
|
||||
|
||||
Lib_Name : constant Prj.Variable_Value :=
|
||||
Prj.Util.Value_Of
|
||||
(Snames.Name_Library_Name,
|
||||
Project.Decl.Attributes,
|
||||
Shared);
|
||||
|
||||
Lib_Interfaces : constant Prj.Variable_Value :=
|
||||
Prj.Util.Value_Of
|
||||
(Snames.Name_Library_Interface,
|
||||
@ -4353,6 +4358,44 @@ package body Prj.Nmsc is
|
||||
-- Library_Interface is defined.
|
||||
|
||||
if not Lib_Interfaces.Default then
|
||||
|
||||
-- The name of a stand-alone library needs to have the syntax of an
|
||||
-- Ada identifier.
|
||||
|
||||
declare
|
||||
Name : constant String := Get_Name_String (Project.Library_Name);
|
||||
OK : Boolean := Is_Letter (Name (Name'First));
|
||||
Underline : Boolean := False;
|
||||
begin
|
||||
for J in Name'First + 1 .. Name'Last loop
|
||||
exit when not OK;
|
||||
|
||||
if Is_Alphanumeric (Name (J)) then
|
||||
Underline := False;
|
||||
|
||||
elsif Name (J) = '_' then
|
||||
if Underline then
|
||||
OK := False;
|
||||
else
|
||||
Underline := True;
|
||||
end if;
|
||||
|
||||
else
|
||||
OK := False;
|
||||
end if;
|
||||
end loop;
|
||||
|
||||
OK := OK and then not Underline;
|
||||
|
||||
if not OK then
|
||||
Error_Msg
|
||||
(Data.Flags,
|
||||
"Incorrect library name for a Stand-Alone Library",
|
||||
Lib_Name.Location, Project);
|
||||
return;
|
||||
end if;
|
||||
end;
|
||||
|
||||
declare
|
||||
Interfaces : String_List_Id := Lib_Interfaces.Values;
|
||||
Interface_ALIs : String_List_Id := Nil_String;
|
||||
|
@ -1,6 +1,7 @@
|
||||
@set gprconfig GPRconfig
|
||||
|
||||
@c ------ projects.texi
|
||||
@c Copyright (C) 2002-2011, Free Software Foundation, Inc.
|
||||
@c This file is shared between the GNAT user's guide and gprbuild. It is not
|
||||
@c compilable on its own, you should instead compile the other two manuals.
|
||||
@c For that reason, there is no toplevel @menu
|
||||
@ -1525,10 +1526,11 @@ front of the @code{project} keyword.
|
||||
@item @b{Library_Name}:
|
||||
@cindex @code{Library_Name}
|
||||
This attribute is the name of the library to be built. There is no
|
||||
restriction on the name of a library imposed by the project manager;
|
||||
however, there may be system specific restrictions on the name.
|
||||
In general, it is recommended to stick to alphanumeric characters
|
||||
(and possibly underscores) to help portability.
|
||||
restriction on the name of a library imposed by the project manager, except
|
||||
for stand-alone libraries whose names must follow the syntax of Ada
|
||||
identifiers; however, there may be system specific restrictions on the name.
|
||||
In general, it is recommended to stick to alphanumeric characters (and
|
||||
possibly single underscores) to help portability.
|
||||
|
||||
@item @b{Library_Dir}:
|
||||
@cindex @code{Library_Dir}
|
||||
@ -1749,6 +1751,9 @@ transparent. However, stand-alone libraries are also useful when the main is in
|
||||
Ada: they provide a means for minimizing relinking & redeployment of complex
|
||||
systems when localized changes are made.
|
||||
|
||||
The name of a stand-alone library, specified with attribute
|
||||
@code{Library_Name}, must have the syntax of an Ada identifier.
|
||||
|
||||
The most prominent characteristic of a stand-alone library is that it offers a
|
||||
distinction between interface units and implementation units. Only the former
|
||||
are visible to units outside the library. A stand-alone library project is thus
|
||||
|
Loading…
Reference in New Issue
Block a user