Commit 2b426674 by Emmanuel Briot Committed by Arnaud Charlet

gnat_ugn.texi, [...] (Suffix_Matches): A suffix can also match the full base…

gnat_ugn.texi, [...] (Suffix_Matches): A suffix can also match the full base name of the file when...

2009-06-24  Emmanuel Briot  <briot@adacore.com>

	* gnat_ugn.texi, prj-nmsc.adb (Suffix_Matches): A suffix can also match
	the full base name of the file when the suffix doesn't start with a '.'.

From-SVN: r148903
parent 95cd3246
2009-06-24 Emmanuel Briot <briot@adacore.com>
* gnat_ugn.texi, prj-nmsc.adb (Suffix_Matches): A suffix can also match
the full base name of the file when the suffix doesn't start with a '.'.
2009-06-24 Vincent Celier <celier@adacore.com> 2009-06-24 Vincent Celier <celier@adacore.com>
* prj-nmsc.adb (Check): A project declared abstract is legal if no * prj-nmsc.adb (Check): A project declared abstract is legal if no
......
...@@ -12572,10 +12572,12 @@ The current list of qualifiers is: ...@@ -12572,10 +12572,12 @@ The current list of qualifiers is:
@itemize @bullet @itemize @bullet
@item @item
@code{abstract}: qualify a project with no sources. An abstract project must @code{abstract}: qualify a project with no sources. A qualified abstract
have a declaration specifying that there are no sources in the project, and, project must either have no declaration of attributes @code{Source_Dirs},
if it extends another project, the project it extends must also be a qualified @code{Source_Files}, @code{Languages} or @code{Source_List_File}, or one of
abstract project. @code{Source_Dirs}, @code{Source_Files}, or @code{Languages} must be declared
as empty. If it extends another project, the project it extends must also be a
qualified abstract project.
@item @item
@code{standard}: a standard project is a non library project with sources. @code{standard}: a standard project is a non library project with sources.
...@@ -13870,6 +13872,14 @@ same string, then a file name that ends with the longest of these two suffixes ...@@ -13870,6 +13872,14 @@ same string, then a file name that ends with the longest of these two suffixes
will be a body if the longest suffix is @code{Body_Suffix ("Ada")} or a spec will be a body if the longest suffix is @code{Body_Suffix ("Ada")} or a spec
if the longest suffix is @code{Spec_Suffix ("Ada")}. if the longest suffix is @code{Spec_Suffix ("Ada")}.
If the suffix does not start with a '.', a file with a name exactly equal
to the suffix will also be part of the project (for instance if you define
the suffix as @code{Makefile}, a file called @file{Makefile} will be part
of the project. This is not interesting in general when using projects to
compile. However, it might become useful when a project is also used to
find the list of source files in an editor, like the GNAT Programming System
(GPS).
If @code{Body_Suffix ("Ada")} is not specified, then the default is If @code{Body_Suffix ("Ada")} is not specified, then the default is
@code{"^.adb^.ADB^"}. @code{"^.adb^.ADB^"}.
...@@ -628,6 +628,7 @@ package body Prj.Nmsc is ...@@ -628,6 +628,7 @@ package body Prj.Nmsc is
(Filename : String; (Filename : String;
Suffix : File_Name_Type) return Boolean Suffix : File_Name_Type) return Boolean
is is
Min_Prefix_Length : Natural := 0;
begin begin
if Suffix = No_File or else Suffix = Empty_File then if Suffix = No_File or else Suffix = Empty_File then
return False; return False;
...@@ -636,7 +637,18 @@ package body Prj.Nmsc is ...@@ -636,7 +637,18 @@ package body Prj.Nmsc is
declare declare
Suf : constant String := Get_Name_String (Suffix); Suf : constant String := Get_Name_String (Suffix);
begin begin
return Filename'Length > Suf'Length
-- The file name must end with the suffix (which is not an extension)
-- For instance a suffix "configure.in" must match a file with the
-- same name. To avoid dummy cases, though, a suffix starting with
-- '.' requires a file that is at least one character longer ('.cpp'
-- should not match a file with the same name)
if Suf (Suf'First) = '.' then
Min_Prefix_Length := 1;
end if;
return Filename'Length >= Suf'Length + Min_Prefix_Length
and then Filename and then Filename
(Filename'Last - Suf'Length + 1 .. Filename'Last) = Suf; (Filename'Last - Suf'Length + 1 .. Filename'Last) = Suf;
end; end;
......
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