Option-file-format.html 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240
  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-2017 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 5.2, http://www.gnu.org/software/texinfo/ -->
  18. <head>
  19. <title>GNU Compiler Collection (GCC) Internals: Option file format</title>
  20. <meta name="description" content="GNU Compiler Collection (GCC) Internals: Option file format">
  21. <meta name="keywords" content="GNU Compiler Collection (GCC) Internals: Option file format">
  22. <meta name="resource-type" content="document">
  23. <meta name="distribution" content="global">
  24. <meta name="Generator" content="makeinfo">
  25. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  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="Options.html#Options" rel="up" title="Options">
  30. <link href="Option-properties.html#Option-properties" rel="next" title="Option properties">
  31. <link href="Options.html#Options" rel="prev" title="Options">
  32. <style type="text/css">
  33. <!--
  34. a.summary-letter {text-decoration: none}
  35. blockquote.smallquotation {font-size: smaller}
  36. div.display {margin-left: 3.2em}
  37. div.example {margin-left: 3.2em}
  38. div.indentedblock {margin-left: 3.2em}
  39. div.lisp {margin-left: 3.2em}
  40. div.smalldisplay {margin-left: 3.2em}
  41. div.smallexample {margin-left: 3.2em}
  42. div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
  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.nocodebreak {white-space:nowrap}
  54. span.nolinebreak {white-space:nowrap}
  55. span.roman {font-family:serif; font-weight:normal}
  56. span.sansserif {font-family:sans-serif; font-weight:normal}
  57. ul.no-bullet {list-style: none}
  58. -->
  59. </style>
  60. </head>
  61. <body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
  62. <a name="Option-file-format"></a>
  63. <div class="header">
  64. <p>
  65. Next: <a href="Option-properties.html#Option-properties" accesskey="n" rel="next">Option properties</a>, Up: <a href="Options.html#Options" accesskey="u" rel="up">Options</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>
  66. </div>
  67. <hr>
  68. <a name="Option-file-format-1"></a>
  69. <h3 class="section">8.1 Option file format</h3>
  70. <p>Option files are a simple list of records in which each field occupies
  71. its own line and in which the records themselves are separated by
  72. blank lines. Comments may appear on their own line anywhere within
  73. the file and are preceded by semicolons. Whitespace is allowed before
  74. the semicolon.
  75. </p>
  76. <p>The files can contain the following types of record:
  77. </p>
  78. <ul>
  79. <li> A language definition record. These records have two fields: the
  80. string &lsquo;<samp>Language</samp>&rsquo; and the name of the language. Once a language
  81. has been declared in this way, it can be used as an option property.
  82. See <a href="Option-properties.html#Option-properties">Option properties</a>.
  83. </li><li> A target specific save record to save additional information. These
  84. records have two fields: the string &lsquo;<samp>TargetSave</samp>&rsquo;, and a
  85. declaration type to go in the <code>cl_target_option</code> structure.
  86. </li><li> A variable record to define a variable used to store option
  87. information. These records have two fields: the string
  88. &lsquo;<samp>Variable</samp>&rsquo;, and a declaration of the type and name of the
  89. variable, optionally with an initializer (but without any trailing
  90. &lsquo;<samp>;</samp>&rsquo;). These records may be used for variables used for many
  91. options where declaring the initializer in a single option definition
  92. record, or duplicating it in many records, would be inappropriate, or
  93. for variables set in option handlers rather than referenced by
  94. <code>Var</code> properties.
  95. </li><li> A variable record to define a variable used to store option
  96. information. These records have two fields: the string
  97. &lsquo;<samp>TargetVariable</samp>&rsquo;, and a declaration of the type and name of the
  98. variable, optionally with an initializer (but without any trailing
  99. &lsquo;<samp>;</samp>&rsquo;). &lsquo;<samp>TargetVariable</samp>&rsquo; is a combination of &lsquo;<samp>Variable</samp>&rsquo;
  100. and &lsquo;<samp>TargetSave</samp>&rsquo; records in that the variable is defined in the
  101. <code>gcc_options</code> structure, but these variables are also stored in
  102. the <code>cl_target_option</code> structure. The variables are saved in the
  103. target save code and restored in the target restore code.
  104. </li><li> A variable record to record any additional files that the
  105. <samp>options.h</samp> file should include. This is useful to provide
  106. enumeration or structure definitions needed for target variables.
  107. These records have two fields: the string &lsquo;<samp>HeaderInclude</samp>&rsquo; and the
  108. name of the include file.
  109. </li><li> A variable record to record any additional files that the
  110. <samp>options.c</samp> or <samp>options-save.c</samp> file should include. This
  111. is useful to provide
  112. inline functions needed for target variables and/or <code>#ifdef</code>
  113. sequences to properly set up the initialization. These records have
  114. two fields: the string &lsquo;<samp>SourceInclude</samp>&rsquo; and the name of the
  115. include file.
  116. </li><li> An enumeration record to define a set of strings that may be used as
  117. arguments to an option or options. These records have three fields:
  118. the string &lsquo;<samp>Enum</samp>&rsquo;, a space-separated list of properties and help
  119. text used to describe the set of strings in <samp>--help</samp> output.
  120. Properties use the same format as option properties; the following are
  121. valid:
  122. <dl compact="compact">
  123. <dt><code>Name(<var>name</var>)</code></dt>
  124. <dd><p>This property is required; <var>name</var> must be a name (suitable for use
  125. in C identifiers) used to identify the set of strings in <code>Enum</code>
  126. option properties.
  127. </p>
  128. </dd>
  129. <dt><code>Type(<var>type</var>)</code></dt>
  130. <dd><p>This property is required; <var>type</var> is the C type for variables set
  131. by options using this enumeration together with <code>Var</code>.
  132. </p>
  133. </dd>
  134. <dt><code>UnknownError(<var>message</var>)</code></dt>
  135. <dd><p>The message <var>message</var> will be used as an error message if the
  136. argument is invalid; for enumerations without <code>UnknownError</code>, a
  137. generic error message is used. <var>message</var> should contain a single
  138. &lsquo;<samp>%qs</samp>&rsquo; format, which will be used to format the invalid argument.
  139. </p></dd>
  140. </dl>
  141. </li><li> An enumeration value record to define one of the strings in a set
  142. given in an &lsquo;<samp>Enum</samp>&rsquo; record. These records have two fields: the
  143. string &lsquo;<samp>EnumValue</samp>&rsquo; and a space-separated list of properties.
  144. Properties use the same format as option properties; the following are
  145. valid:
  146. <dl compact="compact">
  147. <dt><code>Enum(<var>name</var>)</code></dt>
  148. <dd><p>This property is required; <var>name</var> says which &lsquo;<samp>Enum</samp>&rsquo; record
  149. this &lsquo;<samp>EnumValue</samp>&rsquo; record corresponds to.
  150. </p>
  151. </dd>
  152. <dt><code>String(<var>string</var>)</code></dt>
  153. <dd><p>This property is required; <var>string</var> is the string option argument
  154. being described by this record.
  155. </p>
  156. </dd>
  157. <dt><code>Value(<var>value</var>)</code></dt>
  158. <dd><p>This property is required; it says what value (representable as
  159. <code>int</code>) should be used for the given string.
  160. </p>
  161. </dd>
  162. <dt><code>Canonical</code></dt>
  163. <dd><p>This property is optional. If present, it says the present string is
  164. the canonical one among all those with the given value. Other strings
  165. yielding that value will be mapped to this one so specs do not need to
  166. handle them.
  167. </p>
  168. </dd>
  169. <dt><code>DriverOnly</code></dt>
  170. <dd><p>This property is optional. If present, the present string will only
  171. be accepted by the driver. This is used for cases such as
  172. <samp>-march=native</samp> that are processed by the driver so that
  173. &lsquo;<samp>gcc -v</samp>&rsquo; shows how the options chosen depended on the system on
  174. which the compiler was run.
  175. </p></dd>
  176. </dl>
  177. </li><li> An option definition record. These records have the following fields:
  178. <ol>
  179. <li> the name of the option, with the leading &ldquo;-&rdquo; removed
  180. </li><li> a space-separated list of option properties (see <a href="Option-properties.html#Option-properties">Option properties</a>)
  181. </li><li> the help text to use for <samp>--help</samp> (omitted if the second field
  182. contains the <code>Undocumented</code> property).
  183. </li></ol>
  184. <p>By default, all options beginning with &ldquo;f&rdquo;, &ldquo;W&rdquo; or &ldquo;m&rdquo; are
  185. implicitly assumed to take a &ldquo;no-&rdquo; form. This form should not be
  186. listed separately. If an option beginning with one of these letters
  187. does not have a &ldquo;no-&rdquo; form, you can use the <code>RejectNegative</code>
  188. property to reject it.
  189. </p>
  190. <p>The help text is automatically line-wrapped before being displayed.
  191. Normally the name of the option is printed on the left-hand side of
  192. the output and the help text is printed on the right. However, if the
  193. help text contains a tab character, the text to the left of the tab is
  194. used instead of the option&rsquo;s name and the text to the right of the
  195. tab forms the help text. This allows you to elaborate on what type
  196. of argument the option takes.
  197. </p>
  198. </li><li> A target mask record. These records have one field of the form
  199. &lsquo;<samp>Mask(<var>x</var>)</samp>&rsquo;. The options-processing script will automatically
  200. allocate a bit in <code>target_flags</code> (see <a href="Run_002dtime-Target.html#Run_002dtime-Target">Run-time Target</a>) for
  201. each mask name <var>x</var> and set the macro <code>MASK_<var>x</var></code> to the
  202. appropriate bitmask. It will also declare a <code>TARGET_<var>x</var></code>
  203. macro that has the value 1 when bit <code>MASK_<var>x</var></code> is set and
  204. 0 otherwise.
  205. <p>They are primarily intended to declare target masks that are not
  206. associated with user options, either because these masks represent
  207. internal switches or because the options are not available on all
  208. configurations and yet the masks always need to be defined.
  209. </p></li></ul>
  210. <hr>
  211. <div class="header">
  212. <p>
  213. Next: <a href="Option-properties.html#Option-properties" accesskey="n" rel="next">Option properties</a>, Up: <a href="Options.html#Options" accesskey="u" rel="up">Options</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>
  214. </div>
  215. </body>
  216. </html>