gccint: Files
1
1 23.5 Source Files Containing Type Information
1 =============================================
1
1 Whenever you add 'GTY' markers to a source file that previously had
1 none, or create a new source file containing 'GTY' markers, there are
1 three things you need to do:
1
1 1. You need to add the file to the list of source files the type
1 machinery scans. There are four cases:
1
1 a. For a back-end file, this is usually done automatically; if
1 not, you should add it to 'target_gtfiles' in the appropriate
1 port's entries in 'config.gcc'.
1
1 b. For files shared by all front ends, add the filename to the
1 'GTFILES' variable in 'Makefile.in'.
1
1 c. For files that are part of one front end, add the filename to
1 the 'gtfiles' variable defined in the appropriate
1 'config-lang.in'. Headers should appear before non-headers in
1 this list.
1
1 d. For files that are part of some but not all front ends, add
1 the filename to the 'gtfiles' variable of _all_ the front ends
1 that use it.
1
1 2. If the file was a header file, you'll need to check that it's
1 included in the right place to be visible to the generated files.
1 For a back-end header file, this should be done automatically. For
1 a front-end header file, it needs to be included by the same file
1 that includes 'gtype-LANG.h'. For other header files, it needs to
1 be included in 'gtype-desc.c', which is a generated file, so add it
1 to 'ifiles' in 'open_base_file' in 'gengtype.c'.
1
1 For source files that aren't header files, the machinery will
1 generate a header file that should be included in the source file
1 you just changed. The file will be called 'gt-PATH.h' where PATH
1 is the pathname relative to the 'gcc' directory with slashes
1 replaced by -, so for example the header file to be included in
1 'cp/parser.c' is called 'gt-cp-parser.c'. The generated header
1 file should be included after everything else in the source file.
1 Don't forget to mention this file as a dependency in the
1 'Makefile'!
1
1 For language frontends, there is another file that needs to be included
1 somewhere. It will be called 'gtype-LANG.h', where LANG is the name of
1 the subdirectory the language is contained in.
1
1 Plugins can add additional root tables. Run the 'gengtype' utility in
1 plugin mode as 'gengtype -P pluginout.h SOURCE-DIR FILE-LIST PLUGIN*.C'
1 with your plugin files PLUGIN*.C using 'GTY' to generate the PLUGINOUT.H
1 file. The GCC build tree is needed to be present in that mode.
1