diff options
author | Emmanuel Briot <briot@adacore.com> | 2009-06-24 09:51:10 +0000 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2009-06-24 11:51:10 +0200 |
commit | 2b426674815acc4d32ef39140e531f92cbf20e14 (patch) | |
tree | 302f9917f523557d4447920d10b89efa055cc1fc | |
parent | 95cd3246e62ebeafa33bd25cec72f04912e2e5cc (diff) | |
download | gcc-2b426674815acc4d32ef39140e531f92cbf20e14.zip gcc-2b426674815acc4d32ef39140e531f92cbf20e14.tar.gz gcc-2b426674815acc4d32ef39140e531f92cbf20e14.tar.bz2 |
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
-rw-r--r-- | gcc/ada/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/ada/gnat_ugn.texi | 18 | ||||
-rw-r--r-- | gcc/ada/prj-nmsc.adb | 14 |
3 files changed, 32 insertions, 5 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index ea3a5d0..5642508 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,8 @@ +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> * prj-nmsc.adb (Check): A project declared abstract is legal if no diff --git a/gcc/ada/gnat_ugn.texi b/gcc/ada/gnat_ugn.texi index 0fda13b..7898e5e 100644 --- a/gcc/ada/gnat_ugn.texi +++ b/gcc/ada/gnat_ugn.texi @@ -12572,10 +12572,12 @@ The current list of qualifiers is: @itemize @bullet @item -@code{abstract}: qualify a project with no sources. An abstract project must -have a declaration specifying that there are no sources in the project, and, -if it extends another project, the project it extends must also be a qualified -abstract project. +@code{abstract}: qualify a project with no sources. A qualified abstract +project must either have no declaration of attributes @code{Source_Dirs}, +@code{Source_Files}, @code{Languages} or @code{Source_List_File}, or one of +@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 @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 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 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 @code{"^.adb^.ADB^"}. diff --git a/gcc/ada/prj-nmsc.adb b/gcc/ada/prj-nmsc.adb index ce5f233..2bd72bf 100644 --- a/gcc/ada/prj-nmsc.adb +++ b/gcc/ada/prj-nmsc.adb @@ -628,6 +628,7 @@ package body Prj.Nmsc is (Filename : String; Suffix : File_Name_Type) return Boolean is + Min_Prefix_Length : Natural := 0; begin if Suffix = No_File or else Suffix = Empty_File then return False; @@ -636,7 +637,18 @@ package body Prj.Nmsc is declare Suf : constant String := Get_Name_String (Suffix); 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 (Filename'Last - Suf'Length + 1 .. Filename'Last) = Suf; end; |