This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] allow front-end/gcc interface files in lang subdir


Hello,

This is a ping/followup on the patch suggestion at

  http://gcc.gnu.org/ml/gcc-patches/2007-11/msg01000.html

The idea is to allow front-ends to locate their GCC interfacing
support files (for compiler internals and build infrastructure)
within a subdirectory of their current language dir.

While we are specifically interested in this for Ada to help our
maintainership activities, these are common bits which could benefit
other languages. In addition to offering the relocation option, the
attached patch clarifies a couple of gengtype's internal functions and
fixes a bug in the GTFILES_H computation. Details below.

Ada wise, this is preparatory work for a real move of the build plus
gigi files, which we have done internally and are planning to propagate
soon.

--

There were two parts to the initial submission:

  >   1) Add a new "gcc_subdir" variable in config-lang.in. [...]

This was approved for 4.4 at

  http://gcc.gnu.org/ml/gcc-patches/2008-01/msg00278.html

I have just retested on x86_64-suse-linux and I'm about to commit.
 
>   2) adjust gengtype not to reflect the extra subdir in the names of
>      the files it generates.

This piece is attached again here.

In addition to the intended functional change for files in language
subdirs, the patch clarifies a couple of internals, factorizing
repeated processing in functions and expanding some comments.

It also introduces a slight behavior modification which I think is OK:
We now have

    /* For F a filename, return the relative path to F from $(srcdir) if the
       latter is a prefix in F, or the real basename of F otherwise.  */
    get_file_basename [...]

and the function really does what the comment says. This used to be

   /* Determine the pathname to F relative to $(srcdir).  */
   get_file_basename [...]

which looks pretty close, eventhough imprecise about non "srcdir"
relative inputs (probably expected never to show up).

The original function was however returning the srcdir relative path
only for langdir relative inputs (cp/..., ada/..., etc), and the
difference of behavior compared to the new function is visible for
inputs like

   src/gcc/config/i386/i386.c

The original function returned "i386.c" and the modified version
returns "config/i386/i386.c". I think this is OK and even an
improvement:

   * This looks fine with respect to the current uses of the
   function (examined them all),

   * There used to be a discrepency between the code and the head
   comment. There isn't any more,

   * Bootstrap and regression testing on x86_64 linux went fine,

   * Comparing the set of gt-*.h generated files before and after the
   change on this target reveals a single difference:

        --- ref/bld/stage1-gcc/gt-i386.h
        +++ new/bld/stage1-gcc/gt-i386.h
        @@ -1,4 +1,4 @@
        -/* Type information for i386.c.
        +/* Type information for config/i386/i386.c.

   ... certainly not a problem.

Extensive testing on heavily parallel bootstraps (-j12 on a
bi-quadcore) exposed the need to adjust the GTFILES_H computation in
Makefile.in accordingly, which in turn identified a currently
mishandled case:

For "gcc/config/i386/i386.c", gengtype generates "gt-i386.h", included
as such, and the current Makefile produces a "gt-config-i386-i386.h"
dependency.

The Makefile.in piece of the attached patch address that by adding a
bit of simple extra filtering.

Bootstrapped and regression tested on x86_64-suse-linux.

Thanks in advance,

Olivier

--

2008-05-14  Olivier Hainque  <hainque@adacore.com>
            Nicolas Roche  <roche@adacore.com>

	* gengtype.c (srcdir_len): size_t instead of int.
	(get_file_realbasename): New function.  For F a filename, the real
	basename of F, with all the path components stripped.
	(get_file_srcdir_relative_path): New function.  For F a filename, the
	relative path to F from $(srcdir).
	(get_file_basename): Rewrite using get_file_srcdir_relative_path and
	get_file_realbasename.  Adjust the head comment.
	(get_prefix_langdir_index): New function. For F a filename, return the
	lang_dir_names[] relative index of the language directory that is
	a prefix in F.
	(get_file_langdir): For F a filename, return the name of the language
	directory where F is located.
	(get_file_gtfilename): New function. The gt- output file name for an
	input filename F.
	(get_output_file_with_visibility): Replace in-line computations with
	uses of get_file_gtfilename and get_prefix_langdir_index.
	* Makefile.in (GTFILES_H): Adjust to match what gengtype generates.




Attachment: gtype-subdir.dif
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]