Ralf Wildenhues wrote:
Hello Basile,

* Basile STARYNKEVITCH wrote on Fri, Jul 03, 2009 at 12:10:17PM CEST:
It would be much easier for plugins if gtyp-input.list contained
only absolute paths. In my case, (AMD64/Debian/Sid), it contains
only two relative filepaths: auto-host.h & options.h

Over here it contains only relative paths.  I build GCC using a relative
srcdir:
  ../gcc/configure

as opposed to
  /path/to/gcc/configure

If gtyp-input.list contained only absolute path, plugins wanting
gengtype could use that very list. Otherwise, they have to hack it
to replace relative file paths (relative to the build directory) by
absolute ones.

I cannot judge whether using absolute paths in this file is a problem or
not.
It should not be a problem, since this file is only used by gengtype, as a list of files to process (and AFAIK, gengtype only fopen-s them). It also contains language specific tags like [c] or [ada]. Because of that, I would imagine that GCC could not be built with relative directories (for source or build tree) starting with a bracket, but that is not a common situation, and I believe we should not bother.


One issue with your change is that it drops the [ada] and other language
tags that $(GTFILES) contains.
This is indeed the issue.

The patch below solves the issue, but the generated gtype-input.list contains too much empty blank lines. Any suggestions on how to solve this?

#################
Index: gcc/Makefile.in
===================================================================
--- gcc/Makefile.in    (revision 149204)
+++ gcc/Makefile.in    (working copy)
@@ -3409,6 +3409,10 @@
  $(srcdir)/tree-ssa-alias.h \
  @all_gtfiles@

+
+## compute the realpath of above GTFILES - keeping language tags as before
+REALGTFILES = $(foreach f, $(GTFILES), $(if $(patsubst [%],,$f), $(realpath $f), $f))
+
# Compute the list of GT header files from the corresponding C sources,
# possibly nested within config or language subdirectories. Match gengtype's # behavior in this respect: gt-LANG-file.h for "file" anywhere within a LANG
@@ -3432,7 +3436,7 @@

gtyp-input.list: s-gtyp-input ; @true
s-gtyp-input: Makefile
-    @: $(call write_entries_to_file,$(GTFILES),tmp-gi.list)
+    @: $(call write_entries_to_file,$(REALGTFILES),tmp-gi.list)
    $(SHELL) $(srcdir)/../move-if-change tmp-gi.list gtyp-input.list
    $(STAMP) s-gtyp-input
###########################

Comments are welcome. I know it is not good enough to be proposed as a true patch (because of the white lines).


I also believe the plugin mode of gengtype could be unsufficient when the plugins has complex GTY-ed types, in particular unions. Apparently in that case, the file gtype-desc.h should also be generated, but that also triggers different issues (mostly PCH related. The more I think about it, the more I believe that precompiled headers and plugins are not compatible).

Regards.
Regards.

--
Basile STARYNKEVITCH         http://starynkevitch.net/Basile/
email: basile<at>starynkevitch<dot>net mobile: +33 6 8501 2359
8, rue de la Faiencerie, 92340 Bourg La Reine, France
*** opinions {are only mines, sont seulement les miennes} ***

Reply via email to