On Fri, Mar 18, 2011 at 13:59, Nicola Pero <nicola.p...@meta-innovation.com> wrote: > >> The Obj-C++ FE is kind of weird as it shares files from cp/ and objc/, >> so I'm missing some other connection I need to make to fix this. >> >> Any ideas? > > As far as I can see, the problem is that header files (such as cp/parser.h) > generate GC stuff that gets put into gtype-{lang}.h, where {lang} is > determined > by looking at the directory where the file is (eg, if it's in the cp/ > directory, > then {lang} is cp) ... unless you override this with a custom hardcoded rule > in > gengtype.c.
Oh! That's what I was missing. Thanks for the fix. > > It seems that all files that are shared between ObjC or C++ and ObjC++ have > custom > hardcoded rules in gengtype.c. The cp/parser.h file you added didn't, and > without > it, every time it is processed, the results are stored in gtype-cp.h even if > the > file is processed for ObjC++. :-( Ugh. > This all looks ugly. Anyhow, until someone refactors everything, the > following > patch fixes ObjC++ bootstrap in trunk by processing cp/parser.h in the same > way > as the other C++ headers are processed. :-) > > Ok to commit ? > > Thanks > > Index: gcc/gengtype.c > =================================================================== > --- gcc/gengtype.c (revision 171155) > +++ gcc/gengtype.c (working copy) > @@ -1761,6 +1761,12 @@ > matters, so change with extreme care! */ > > struct file_rule_st files_rules[] = { > + /* The general rule assumes that files in subdirectories belong to a > + particular front-end, and files not in subdirectories are shared. > + The following rules deal with exceptions - files that are in > + subdirectories and yet are shared, and files that are top-level, > + but are not shared. */ > + > /* the c-family/ source directory is special. */ > { DIR_PREFIX_REGEX "c-family/([[:alnum:]_-]*)\\.c$", > REG_EXTENDED, NULL_REGEX, > @@ -1792,7 +1798,12 @@ > REG_EXTENDED, NULL_REGEX, > "gt-cp-name-lookup.h", "cp/name-lookup.c", NULL_FRULACT }, > > - /* objc/objc-act.h fives gt-objc-objc-act.h for objc/objc-act.c ! */ > + /* cp/parser.h gives gt-cp-parser.h for cp/parser.c ! */ > + { DIR_PREFIX_REGEX "cp/parser\\.h$", > + REG_EXTENDED, NULL_REGEX, > + "gt-cp-parser.h", "cp/parser.c", NULL_FRULACT }, But cp/parser.c also gets its own gt-cp-parser.h. Won't they conflict? Doesn't this mean that cp/parser.h should be renamed to something else? (say cp/cp-parser.h). Other than that, it looks fine. Diego.