diff options
| author | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-06-24 09:51:10 +0000 |
|---|---|---|
| committer | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-06-24 09:51:10 +0000 |
| commit | 4c49dbaaab6c74c6f8aea2def876f27d5d6ff5b0 (patch) | |
| tree | 302f9917f523557d4447920d10b89efa055cc1fc | |
| parent | 983b1ca857786f66942e4dcf59199f054c5f761f (diff) | |
| download | ppe42-gcc-4c49dbaaab6c74c6f8aea2def876f27d5d6ff5b0.tar.gz ppe42-gcc-4c49dbaaab6c74c6f8aea2def876f27d5d6ff5b0.zip | |
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 '.'.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@148903 138bc75d-0d04-0410-961f-82ee72b054a4
| -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 ea3a5d0c0c6..56425086041 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 0fda13b57c5..7898e5e63cd 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 ce5f233f6e8..2bd72bf1e40 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; |

