You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

преди 3 години
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <html>
  3. <!-- Copyright (C) 1988-2020 Free Software Foundation, Inc.
  4. Permission is granted to copy, distribute and/or modify this document
  5. under the terms of the GNU Free Documentation License, Version 1.3 or
  6. any later version published by the Free Software Foundation; with the
  7. Invariant Sections being "Funding Free Software", the Front-Cover
  8. Texts being (a) (see below), and with the Back-Cover Texts being (b)
  9. (see below). A copy of the license is included in the section entitled
  10. "GNU Free Documentation License".
  11. (a) The FSF's Front-Cover Text is:
  12. A GNU Manual
  13. (b) The FSF's Back-Cover Text is:
  14. You have freedom to copy and modify this GNU Manual, like GNU
  15. software. Copies published by the Free Software Foundation raise
  16. funds for GNU development. -->
  17. <!-- Created by GNU Texinfo 6.5, http://www.gnu.org/software/texinfo/ -->
  18. <head>
  19. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  20. <title>Files (GNU Compiler Collection (GCC) Internals)</title>
  21. <meta name="description" content="Files (GNU Compiler Collection (GCC) Internals)">
  22. <meta name="keywords" content="Files (GNU Compiler Collection (GCC) Internals)">
  23. <meta name="resource-type" content="document">
  24. <meta name="distribution" content="global">
  25. <meta name="Generator" content="makeinfo">
  26. <link href="index.html#Top" rel="start" title="Top">
  27. <link href="Option-Index.html#Option-Index" rel="index" title="Option Index">
  28. <link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
  29. <link href="Type-Information.html#Type-Information" rel="up" title="Type Information">
  30. <link href="Invoking-the-garbage-collector.html#Invoking-the-garbage-collector" rel="next" title="Invoking the garbage collector">
  31. <link href="GGC-Roots.html#GGC-Roots" rel="prev" title="GGC Roots">
  32. <style type="text/css">
  33. <!--
  34. a.summary-letter {text-decoration: none}
  35. blockquote.indentedblock {margin-right: 0em}
  36. blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
  37. blockquote.smallquotation {font-size: smaller}
  38. div.display {margin-left: 3.2em}
  39. div.example {margin-left: 3.2em}
  40. div.lisp {margin-left: 3.2em}
  41. div.smalldisplay {margin-left: 3.2em}
  42. div.smallexample {margin-left: 3.2em}
  43. div.smalllisp {margin-left: 3.2em}
  44. kbd {font-style: oblique}
  45. pre.display {font-family: inherit}
  46. pre.format {font-family: inherit}
  47. pre.menu-comment {font-family: serif}
  48. pre.menu-preformatted {font-family: serif}
  49. pre.smalldisplay {font-family: inherit; font-size: smaller}
  50. pre.smallexample {font-size: smaller}
  51. pre.smallformat {font-family: inherit; font-size: smaller}
  52. pre.smalllisp {font-size: smaller}
  53. span.nolinebreak {white-space: nowrap}
  54. span.roman {font-family: initial; font-weight: normal}
  55. span.sansserif {font-family: sans-serif; font-weight: normal}
  56. ul.no-bullet {list-style: none}
  57. -->
  58. </style>
  59. </head>
  60. <body lang="en">
  61. <a name="Files"></a>
  62. <div class="header">
  63. <p>
  64. Next: <a href="Invoking-the-garbage-collector.html#Invoking-the-garbage-collector" accesskey="n" rel="next">Invoking the garbage collector</a>, Previous: <a href="GGC-Roots.html#GGC-Roots" accesskey="p" rel="prev">GGC Roots</a>, Up: <a href="Type-Information.html#Type-Information" accesskey="u" rel="up">Type Information</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Option-Index.html#Option-Index" title="Index" rel="index">Index</a>]</p>
  65. </div>
  66. <hr>
  67. <a name="Source-Files-Containing-Type-Information"></a>
  68. <h3 class="section">23.5 Source Files Containing Type Information</h3>
  69. <a name="index-generated-files"></a>
  70. <a name="index-files_002c-generated"></a>
  71. <p>Whenever you add <code>GTY</code> markers to a source file that previously
  72. had none, or create a new source file containing <code>GTY</code> markers,
  73. there are three things you need to do:
  74. </p>
  75. <ol>
  76. <li> You need to add the file to the list of source files the type
  77. machinery scans. There are four cases:
  78. <ol type="a" start="1">
  79. <li> For a back-end file, this is usually done
  80. automatically; if not, you should add it to <code>target_gtfiles</code> in
  81. the appropriate port&rsquo;s entries in <samp>config.gcc</samp>.
  82. </li><li> For files shared by all front ends, add the filename to the
  83. <code>GTFILES</code> variable in <samp>Makefile.in</samp>.
  84. </li><li> For files that are part of one front end, add the filename to the
  85. <code>gtfiles</code> variable defined in the appropriate
  86. <samp>config-lang.in</samp>.
  87. Headers should appear before non-headers in this list.
  88. </li><li> For files that are part of some but not all front ends, add the
  89. filename to the <code>gtfiles</code> variable of <em>all</em> the front ends
  90. that use it.
  91. </li></ol>
  92. </li><li> If the file was a header file, you&rsquo;ll need to check that it&rsquo;s included
  93. in the right place to be visible to the generated files. For a back-end
  94. header file, this should be done automatically. For a front-end header
  95. file, it needs to be included by the same file that includes
  96. <samp>gtype-<var>lang</var>.h</samp>. For other header files, it needs to be
  97. included in <samp>gtype-desc.c</samp>, which is a generated file, so add it to
  98. <code>ifiles</code> in <code>open_base_file</code> in <samp>gengtype.c</samp>.
  99. <p>For source files that aren&rsquo;t header files, the machinery will generate a
  100. header file that should be included in the source file you just changed.
  101. The file will be called <samp>gt-<var>path</var>.h</samp> where <var>path</var> is the
  102. pathname relative to the <samp>gcc</samp> directory with slashes replaced by
  103. <tt>-</tt>, so for example the header file to be included in
  104. <samp>cp/parser.c</samp> is called <samp>gt-cp-parser.c</samp>. The
  105. generated header file should be included after everything else in the
  106. source file. Don&rsquo;t forget to mention this file as a dependency in the
  107. <samp>Makefile</samp>!
  108. </p>
  109. </li></ol>
  110. <p>For language frontends, there is another file that needs to be included
  111. somewhere. It will be called <samp>gtype-<var>lang</var>.h</samp>, where
  112. <var>lang</var> is the name of the subdirectory the language is contained in.
  113. </p>
  114. <p>Plugins can add additional root tables. Run the <code>gengtype</code>
  115. utility in plugin mode as <code>gengtype -P pluginout.h <var>source-dir</var>
  116. <var>file-list</var> <var>plugin*.c</var></code> with your plugin files
  117. <var>plugin*.c</var> using <code>GTY</code> to generate the <var>pluginout.h</var> file.
  118. The GCC build tree is needed to be present in that mode.
  119. </p>
  120. <hr>
  121. <div class="header">
  122. <p>
  123. Next: <a href="Invoking-the-garbage-collector.html#Invoking-the-garbage-collector" accesskey="n" rel="next">Invoking the garbage collector</a>, Previous: <a href="GGC-Roots.html#GGC-Roots" accesskey="p" rel="prev">GGC Roots</a>, Up: <a href="Type-Information.html#Type-Information" accesskey="u" rel="up">Type Information</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Option-Index.html#Option-Index" title="Index" rel="index">Index</a>]</p>
  124. </div>
  125. </body>
  126. </html>