This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: GTY / gengtype question - adding a new header file
- From: Georg-Johann Lay <avr at gjlay dot de>
- To: Steve Ellcey <sellcey at imgtec dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: Tue, 01 Sep 2015 10:13:29 +0200
- Subject: Re: GTY / gengtype question - adding a new header file
- Authentication-results: sourceware.org; auth=none
- References: <57fd9168-0c14-4556-8790-17d7695c8752 at BAMAIL02 dot ba dot imgtec dot org>
Steve Ellcey schrieb:
I have a question about gengtype and GTY. I was looking at adding some
code to mips.c and it occurred to me that that file was getting very
large (19873 lines). So I wanted to add a new .c file instead but that
file needed some types that were defined in mips.c and not in a header file.
Specifically it needed the MIPS specific machine_function structure that
is defined in mips.c with:
struct GTY(()) machine_function {....
I think I could just move this to mips.h and things would be fine but
I didn't want to do that because mips.h is included in tm.h and is visible
to the generic GCC code. Currently machine_function is not visible to the
generic GCC code and so I wanted to put machine_function in a header file
that could only be seen/used by mips specific code. So I created
mips-private.h and added it to extra_headers in config.gcc.
The problem is that if I include mips-private.h in mips.c instead of
having the actual definition of machine_function in mips.c then my
build fails and I think it is due to how and where gengtype scans for GTY
uses.
Shouldn't it be enough to add the file to config.gcc:target_gtfiles ?
...and of course including the respective gt-*.h at the bottom of the
cxx source.
I couldn't find an example of a platform that has a machine specific header
file that was not visible to the generic GCC code and that has GTY types
in it so I am not sure what I need to do to get gengtype to scan
mips-private.h or if this is even possible (or wise).
I'd have a look at what BEs are using non-default target_gtfiles.
Johann