Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

631 Zeilen
29KB

  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>C Dialect Options (Using the GNU Compiler Collection (GCC))</title>
  21. <meta name="description" content="C Dialect Options (Using the GNU Compiler Collection (GCC))">
  22. <meta name="keywords" content="C Dialect Options (Using the GNU Compiler Collection (GCC))">
  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="Invoking-GCC.html#Invoking-GCC" rel="up" title="Invoking GCC">
  30. <link href="C_002b_002b-Dialect-Options.html#C_002b_002b-Dialect-Options" rel="next" title="C++ Dialect Options">
  31. <link href="Invoking-G_002b_002b.html#Invoking-G_002b_002b" rel="prev" title="Invoking G++">
  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="C-Dialect-Options"></a>
  62. <div class="header">
  63. <p>
  64. Next: <a href="C_002b_002b-Dialect-Options.html#C_002b_002b-Dialect-Options" accesskey="n" rel="next">C++ Dialect Options</a>, Previous: <a href="Invoking-G_002b_002b.html#Invoking-G_002b_002b" accesskey="p" rel="prev">Invoking G++</a>, Up: <a href="Invoking-GCC.html#Invoking-GCC" accesskey="u" rel="up">Invoking GCC</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="Options-Controlling-C-Dialect"></a>
  68. <h3 class="section">3.4 Options Controlling C Dialect</h3>
  69. <a name="index-dialect-options"></a>
  70. <a name="index-language-dialect-options"></a>
  71. <a name="index-options_002c-dialect"></a>
  72. <p>The following options control the dialect of C (or languages derived
  73. from C, such as C++, Objective-C and Objective-C++) that the compiler
  74. accepts:
  75. </p>
  76. <dl compact="compact">
  77. <dd><a name="index-ANSI-support"></a>
  78. <a name="index-ISO-support"></a>
  79. </dd>
  80. <dt><code>-ansi</code></dt>
  81. <dd><a name="index-ansi-1"></a>
  82. <p>In C mode, this is equivalent to <samp>-std=c90</samp>. In C++ mode, it is
  83. equivalent to <samp>-std=c++98</samp>.
  84. </p>
  85. <p>This turns off certain features of GCC that are incompatible with ISO
  86. C90 (when compiling C code), or of standard C++ (when compiling C++ code),
  87. such as the <code>asm</code> and <code>typeof</code> keywords, and
  88. predefined macros such as <code>unix</code> and <code>vax</code> that identify the
  89. type of system you are using. It also enables the undesirable and
  90. rarely used ISO trigraph feature. For the C compiler,
  91. it disables recognition of C++ style &lsquo;<samp>//</samp>&rsquo; comments as well as
  92. the <code>inline</code> keyword.
  93. </p>
  94. <p>The alternate keywords <code>__asm__</code>, <code>__extension__</code>,
  95. <code>__inline__</code> and <code>__typeof__</code> continue to work despite
  96. <samp>-ansi</samp>. You would not want to use them in an ISO C program, of
  97. course, but it is useful to put them in header files that might be included
  98. in compilations done with <samp>-ansi</samp>. Alternate predefined macros
  99. such as <code>__unix__</code> and <code>__vax__</code> are also available, with or
  100. without <samp>-ansi</samp>.
  101. </p>
  102. <p>The <samp>-ansi</samp> option does not cause non-ISO programs to be
  103. rejected gratuitously. For that, <samp>-Wpedantic</samp> is required in
  104. addition to <samp>-ansi</samp>. See <a href="Warning-Options.html#Warning-Options">Warning Options</a>.
  105. </p>
  106. <p>The macro <code>__STRICT_ANSI__</code> is predefined when the <samp>-ansi</samp>
  107. option is used. Some header files may notice this macro and refrain
  108. from declaring certain functions or defining certain macros that the
  109. ISO standard doesn&rsquo;t call for; this is to avoid interfering with any
  110. programs that might use these names for other things.
  111. </p>
  112. <p>Functions that are normally built in but do not have semantics
  113. defined by ISO C (such as <code>alloca</code> and <code>ffs</code>) are not built-in
  114. functions when <samp>-ansi</samp> is used. See <a href="Other-Builtins.html#Other-Builtins">Other
  115. built-in functions provided by GCC</a>, for details of the functions
  116. affected.
  117. </p>
  118. </dd>
  119. <dt><code>-std=</code></dt>
  120. <dd><a name="index-std-1"></a>
  121. <p>Determine the language standard. See <a href="Standards.html#Standards">Language Standards
  122. Supported by GCC</a>, for details of these standard versions. This option
  123. is currently only supported when compiling C or C++.
  124. </p>
  125. <p>The compiler can accept several base standards, such as &lsquo;<samp>c90</samp>&rsquo; or
  126. &lsquo;<samp>c++98</samp>&rsquo;, and GNU dialects of those standards, such as
  127. &lsquo;<samp>gnu90</samp>&rsquo; or &lsquo;<samp>gnu++98</samp>&rsquo;. When a base standard is specified, the
  128. compiler accepts all programs following that standard plus those
  129. using GNU extensions that do not contradict it. For example,
  130. <samp>-std=c90</samp> turns off certain features of GCC that are
  131. incompatible with ISO C90, such as the <code>asm</code> and <code>typeof</code>
  132. keywords, but not other GNU extensions that do not have a meaning in
  133. ISO C90, such as omitting the middle term of a <code>?:</code>
  134. expression. On the other hand, when a GNU dialect of a standard is
  135. specified, all features supported by the compiler are enabled, even when
  136. those features change the meaning of the base standard. As a result, some
  137. strict-conforming programs may be rejected. The particular standard
  138. is used by <samp>-Wpedantic</samp> to identify which features are GNU
  139. extensions given that version of the standard. For example
  140. <samp>-std=gnu90 -Wpedantic</samp> warns about C++ style &lsquo;<samp>//</samp>&rsquo;
  141. comments, while <samp>-std=gnu99 -Wpedantic</samp> does not.
  142. </p>
  143. <p>A value for this option must be provided; possible values are
  144. </p>
  145. <dl compact="compact">
  146. <dt>&lsquo;<samp>c90</samp>&rsquo;</dt>
  147. <dt>&lsquo;<samp>c89</samp>&rsquo;</dt>
  148. <dt>&lsquo;<samp>iso9899:1990</samp>&rsquo;</dt>
  149. <dd><p>Support all ISO C90 programs (certain GNU extensions that conflict
  150. with ISO C90 are disabled). Same as <samp>-ansi</samp> for C code.
  151. </p>
  152. </dd>
  153. <dt>&lsquo;<samp>iso9899:199409</samp>&rsquo;</dt>
  154. <dd><p>ISO C90 as modified in amendment 1.
  155. </p>
  156. </dd>
  157. <dt>&lsquo;<samp>c99</samp>&rsquo;</dt>
  158. <dt>&lsquo;<samp>c9x</samp>&rsquo;</dt>
  159. <dt>&lsquo;<samp>iso9899:1999</samp>&rsquo;</dt>
  160. <dt>&lsquo;<samp>iso9899:199x</samp>&rsquo;</dt>
  161. <dd><p>ISO C99. This standard is substantially completely supported, modulo
  162. bugs and floating-point issues
  163. (mainly but not entirely relating to optional C99 features from
  164. Annexes F and G). See
  165. <a href="http://gcc.gnu.org/c99status.html">http://gcc.gnu.org/c99status.html</a><!-- /@w --> for more information. The
  166. names &lsquo;<samp>c9x</samp>&rsquo; and &lsquo;<samp>iso9899:199x</samp>&rsquo; are deprecated.
  167. </p>
  168. </dd>
  169. <dt>&lsquo;<samp>c11</samp>&rsquo;</dt>
  170. <dt>&lsquo;<samp>c1x</samp>&rsquo;</dt>
  171. <dt>&lsquo;<samp>iso9899:2011</samp>&rsquo;</dt>
  172. <dd><p>ISO C11, the 2011 revision of the ISO C standard. This standard is
  173. substantially completely supported, modulo bugs, floating-point issues
  174. (mainly but not entirely relating to optional C11 features from
  175. Annexes F and G) and the optional Annexes K (Bounds-checking
  176. interfaces) and L (Analyzability). The name &lsquo;<samp>c1x</samp>&rsquo; is deprecated.
  177. </p>
  178. </dd>
  179. <dt>&lsquo;<samp>c17</samp>&rsquo;</dt>
  180. <dt>&lsquo;<samp>c18</samp>&rsquo;</dt>
  181. <dt>&lsquo;<samp>iso9899:2017</samp>&rsquo;</dt>
  182. <dt>&lsquo;<samp>iso9899:2018</samp>&rsquo;</dt>
  183. <dd><p>ISO C17, the 2017 revision of the ISO C standard
  184. (published in 2018). This standard is
  185. same as C11 except for corrections of defects (all of which are also
  186. applied with <samp>-std=c11</samp>) and a new value of
  187. <code>__STDC_VERSION__</code>, and so is supported to the same extent as C11.
  188. </p>
  189. </dd>
  190. <dt>&lsquo;<samp>c2x</samp>&rsquo;</dt>
  191. <dd><p>The next version of the ISO C standard, still under development. The
  192. support for this version is experimental and incomplete.
  193. </p>
  194. </dd>
  195. <dt>&lsquo;<samp>gnu90</samp>&rsquo;</dt>
  196. <dt>&lsquo;<samp>gnu89</samp>&rsquo;</dt>
  197. <dd><p>GNU dialect of ISO C90 (including some C99 features).
  198. </p>
  199. </dd>
  200. <dt>&lsquo;<samp>gnu99</samp>&rsquo;</dt>
  201. <dt>&lsquo;<samp>gnu9x</samp>&rsquo;</dt>
  202. <dd><p>GNU dialect of ISO C99. The name &lsquo;<samp>gnu9x</samp>&rsquo; is deprecated.
  203. </p>
  204. </dd>
  205. <dt>&lsquo;<samp>gnu11</samp>&rsquo;</dt>
  206. <dt>&lsquo;<samp>gnu1x</samp>&rsquo;</dt>
  207. <dd><p>GNU dialect of ISO C11.
  208. The name &lsquo;<samp>gnu1x</samp>&rsquo; is deprecated.
  209. </p>
  210. </dd>
  211. <dt>&lsquo;<samp>gnu17</samp>&rsquo;</dt>
  212. <dt>&lsquo;<samp>gnu18</samp>&rsquo;</dt>
  213. <dd><p>GNU dialect of ISO C17. This is the default for C code.
  214. </p>
  215. </dd>
  216. <dt>&lsquo;<samp>gnu2x</samp>&rsquo;</dt>
  217. <dd><p>The next version of the ISO C standard, still under development, plus
  218. GNU extensions. The support for this version is experimental and
  219. incomplete.
  220. </p>
  221. </dd>
  222. <dt>&lsquo;<samp>c++98</samp>&rsquo;</dt>
  223. <dt>&lsquo;<samp>c++03</samp>&rsquo;</dt>
  224. <dd><p>The 1998 ISO C++ standard plus the 2003 technical corrigendum and some
  225. additional defect reports. Same as <samp>-ansi</samp> for C++ code.
  226. </p>
  227. </dd>
  228. <dt>&lsquo;<samp>gnu++98</samp>&rsquo;</dt>
  229. <dt>&lsquo;<samp>gnu++03</samp>&rsquo;</dt>
  230. <dd><p>GNU dialect of <samp>-std=c++98</samp>.
  231. </p>
  232. </dd>
  233. <dt>&lsquo;<samp>c++11</samp>&rsquo;</dt>
  234. <dt>&lsquo;<samp>c++0x</samp>&rsquo;</dt>
  235. <dd><p>The 2011 ISO C++ standard plus amendments.
  236. The name &lsquo;<samp>c++0x</samp>&rsquo; is deprecated.
  237. </p>
  238. </dd>
  239. <dt>&lsquo;<samp>gnu++11</samp>&rsquo;</dt>
  240. <dt>&lsquo;<samp>gnu++0x</samp>&rsquo;</dt>
  241. <dd><p>GNU dialect of <samp>-std=c++11</samp>.
  242. The name &lsquo;<samp>gnu++0x</samp>&rsquo; is deprecated.
  243. </p>
  244. </dd>
  245. <dt>&lsquo;<samp>c++14</samp>&rsquo;</dt>
  246. <dt>&lsquo;<samp>c++1y</samp>&rsquo;</dt>
  247. <dd><p>The 2014 ISO C++ standard plus amendments.
  248. The name &lsquo;<samp>c++1y</samp>&rsquo; is deprecated.
  249. </p>
  250. </dd>
  251. <dt>&lsquo;<samp>gnu++14</samp>&rsquo;</dt>
  252. <dt>&lsquo;<samp>gnu++1y</samp>&rsquo;</dt>
  253. <dd><p>GNU dialect of <samp>-std=c++14</samp>.
  254. This is the default for C++ code.
  255. The name &lsquo;<samp>gnu++1y</samp>&rsquo; is deprecated.
  256. </p>
  257. </dd>
  258. <dt>&lsquo;<samp>c++17</samp>&rsquo;</dt>
  259. <dt>&lsquo;<samp>c++1z</samp>&rsquo;</dt>
  260. <dd><p>The 2017 ISO C++ standard plus amendments.
  261. The name &lsquo;<samp>c++1z</samp>&rsquo; is deprecated.
  262. </p>
  263. </dd>
  264. <dt>&lsquo;<samp>gnu++17</samp>&rsquo;</dt>
  265. <dt>&lsquo;<samp>gnu++1z</samp>&rsquo;</dt>
  266. <dd><p>GNU dialect of <samp>-std=c++17</samp>.
  267. The name &lsquo;<samp>gnu++1z</samp>&rsquo; is deprecated.
  268. </p>
  269. </dd>
  270. <dt>&lsquo;<samp>c++20</samp>&rsquo;</dt>
  271. <dt>&lsquo;<samp>c++2a</samp>&rsquo;</dt>
  272. <dd><p>The next revision of the ISO C++ standard, planned for
  273. 2020. Support is highly experimental, and will almost certainly
  274. change in incompatible ways in future releases.
  275. </p>
  276. </dd>
  277. <dt>&lsquo;<samp>gnu++20</samp>&rsquo;</dt>
  278. <dt>&lsquo;<samp>gnu++2a</samp>&rsquo;</dt>
  279. <dd><p>GNU dialect of <samp>-std=c++20</samp>. Support is highly experimental,
  280. and will almost certainly change in incompatible ways in future
  281. releases.
  282. </p></dd>
  283. </dl>
  284. </dd>
  285. <dt><code>-fgnu89-inline</code></dt>
  286. <dd><a name="index-fgnu89_002dinline"></a>
  287. <p>The option <samp>-fgnu89-inline</samp> tells GCC to use the traditional
  288. GNU semantics for <code>inline</code> functions when in C99 mode.
  289. See <a href="Inline.html#Inline">An Inline Function is As Fast As a Macro</a>.
  290. Using this option is roughly equivalent to adding the
  291. <code>gnu_inline</code> function attribute to all inline functions
  292. (see <a href="Function-Attributes.html#Function-Attributes">Function Attributes</a>).
  293. </p>
  294. <p>The option <samp>-fno-gnu89-inline</samp> explicitly tells GCC to use the
  295. C99 semantics for <code>inline</code> when in C99 or gnu99 mode (i.e., it
  296. specifies the default behavior).
  297. This option is not supported in <samp>-std=c90</samp> or
  298. <samp>-std=gnu90</samp> mode.
  299. </p>
  300. <p>The preprocessor macros <code>__GNUC_GNU_INLINE__</code> and
  301. <code>__GNUC_STDC_INLINE__</code> may be used to check which semantics are
  302. in effect for <code>inline</code> functions. See <a href="http://gcc.gnu.org/onlinedocs/cpp/Common-Predefined-Macros.html#Common-Predefined-Macros">Common Predefined
  303. Macros</a> in <cite>The C Preprocessor</cite>.
  304. </p>
  305. </dd>
  306. <dt><code>-fpermitted-flt-eval-methods=<var>style</var></code></dt>
  307. <dd><a name="index-fpermitted_002dflt_002deval_002dmethods"></a>
  308. <a name="index-fpermitted_002dflt_002deval_002dmethods_003dc11"></a>
  309. <a name="index-fpermitted_002dflt_002deval_002dmethods_003dts_002d18661_002d3"></a>
  310. <p>ISO/IEC TS 18661-3 defines new permissible values for
  311. <code>FLT_EVAL_METHOD</code> that indicate that operations and constants with
  312. a semantic type that is an interchange or extended format should be
  313. evaluated to the precision and range of that type. These new values are
  314. a superset of those permitted under C99/C11, which does not specify the
  315. meaning of other positive values of <code>FLT_EVAL_METHOD</code>. As such, code
  316. conforming to C11 may not have been written expecting the possibility of
  317. the new values.
  318. </p>
  319. <p><samp>-fpermitted-flt-eval-methods</samp> specifies whether the compiler
  320. should allow only the values of <code>FLT_EVAL_METHOD</code> specified in C99/C11,
  321. or the extended set of values specified in ISO/IEC TS 18661-3.
  322. </p>
  323. <p><var>style</var> is either <code>c11</code> or <code>ts-18661-3</code> as appropriate.
  324. </p>
  325. <p>The default when in a standards compliant mode (<samp>-std=c11</samp> or similar)
  326. is <samp>-fpermitted-flt-eval-methods=c11</samp>. The default when in a GNU
  327. dialect (<samp>-std=gnu11</samp> or similar) is
  328. <samp>-fpermitted-flt-eval-methods=ts-18661-3</samp>.
  329. </p>
  330. </dd>
  331. <dt><code>-aux-info <var>filename</var></code></dt>
  332. <dd><a name="index-aux_002dinfo"></a>
  333. <p>Output to the given filename prototyped declarations for all functions
  334. declared and/or defined in a translation unit, including those in header
  335. files. This option is silently ignored in any language other than C.
  336. </p>
  337. <p>Besides declarations, the file indicates, in comments, the origin of
  338. each declaration (source file and line), whether the declaration was
  339. implicit, prototyped or unprototyped (&lsquo;<samp>I</samp>&rsquo;, &lsquo;<samp>N</samp>&rsquo; for new or
  340. &lsquo;<samp>O</samp>&rsquo; for old, respectively, in the first character after the line
  341. number and the colon), and whether it came from a declaration or a
  342. definition (&lsquo;<samp>C</samp>&rsquo; or &lsquo;<samp>F</samp>&rsquo;, respectively, in the following
  343. character). In the case of function definitions, a K&amp;R-style list of
  344. arguments followed by their declarations is also provided, inside
  345. comments, after the declaration.
  346. </p>
  347. </dd>
  348. <dt><code>-fallow-parameterless-variadic-functions</code></dt>
  349. <dd><a name="index-fallow_002dparameterless_002dvariadic_002dfunctions"></a>
  350. <p>Accept variadic functions without named parameters.
  351. </p>
  352. <p>Although it is possible to define such a function, this is not very
  353. useful as it is not possible to read the arguments. This is only
  354. supported for C as this construct is allowed by C++.
  355. </p>
  356. </dd>
  357. <dt><code>-fno-asm</code></dt>
  358. <dd><a name="index-fno_002dasm"></a>
  359. <a name="index-fasm"></a>
  360. <p>Do not recognize <code>asm</code>, <code>inline</code> or <code>typeof</code> as a
  361. keyword, so that code can use these words as identifiers. You can use
  362. the keywords <code>__asm__</code>, <code>__inline__</code> and <code>__typeof__</code>
  363. instead. <samp>-ansi</samp> implies <samp>-fno-asm</samp>.
  364. </p>
  365. <p>In C++, this switch only affects the <code>typeof</code> keyword, since
  366. <code>asm</code> and <code>inline</code> are standard keywords. You may want to
  367. use the <samp>-fno-gnu-keywords</samp> flag instead, which has the same
  368. effect. In C99 mode (<samp>-std=c99</samp> or <samp>-std=gnu99</samp>), this
  369. switch only affects the <code>asm</code> and <code>typeof</code> keywords, since
  370. <code>inline</code> is a standard keyword in ISO C99.
  371. </p>
  372. </dd>
  373. <dt><code>-fno-builtin</code></dt>
  374. <dt><code>-fno-builtin-<var>function</var></code></dt>
  375. <dd><a name="index-fno_002dbuiltin"></a>
  376. <a name="index-fbuiltin"></a>
  377. <a name="index-built_002din-functions"></a>
  378. <p>Don&rsquo;t recognize built-in functions that do not begin with
  379. &lsquo;<samp>__builtin_</samp>&rsquo; as prefix. See <a href="Other-Builtins.html#Other-Builtins">Other built-in
  380. functions provided by GCC</a>, for details of the functions affected,
  381. including those which are not built-in functions when <samp>-ansi</samp> or
  382. <samp>-std</samp> options for strict ISO C conformance are used because they
  383. do not have an ISO standard meaning.
  384. </p>
  385. <p>GCC normally generates special code to handle certain built-in functions
  386. more efficiently; for instance, calls to <code>alloca</code> may become single
  387. instructions which adjust the stack directly, and calls to <code>memcpy</code>
  388. may become inline copy loops. The resulting code is often both smaller
  389. and faster, but since the function calls no longer appear as such, you
  390. cannot set a breakpoint on those calls, nor can you change the behavior
  391. of the functions by linking with a different library. In addition,
  392. when a function is recognized as a built-in function, GCC may use
  393. information about that function to warn about problems with calls to
  394. that function, or to generate more efficient code, even if the
  395. resulting code still contains calls to that function. For example,
  396. warnings are given with <samp>-Wformat</samp> for bad calls to
  397. <code>printf</code> when <code>printf</code> is built in and <code>strlen</code> is
  398. known not to modify global memory.
  399. </p>
  400. <p>With the <samp>-fno-builtin-<var>function</var></samp> option
  401. only the built-in function <var>function</var> is
  402. disabled. <var>function</var> must not begin with &lsquo;<samp>__builtin_</samp>&rsquo;. If a
  403. function is named that is not built-in in this version of GCC, this
  404. option is ignored. There is no corresponding
  405. <samp>-fbuiltin-<var>function</var></samp> option; if you wish to enable
  406. built-in functions selectively when using <samp>-fno-builtin</samp> or
  407. <samp>-ffreestanding</samp>, you may define macros such as:
  408. </p>
  409. <div class="smallexample">
  410. <pre class="smallexample">#define abs(n) __builtin_abs ((n))
  411. #define strcpy(d, s) __builtin_strcpy ((d), (s))
  412. </pre></div>
  413. </dd>
  414. <dt><code>-fgimple</code></dt>
  415. <dd><a name="index-fgimple"></a>
  416. <p>Enable parsing of function definitions marked with <code>__GIMPLE</code>.
  417. This is an experimental feature that allows unit testing of GIMPLE
  418. passes.
  419. </p>
  420. </dd>
  421. <dt><code>-fhosted</code></dt>
  422. <dd><a name="index-fhosted"></a>
  423. <a name="index-hosted-environment-1"></a>
  424. <p>Assert that compilation targets a hosted environment. This implies
  425. <samp>-fbuiltin</samp>. A hosted environment is one in which the
  426. entire standard library is available, and in which <code>main</code> has a return
  427. type of <code>int</code>. Examples are nearly everything except a kernel.
  428. This is equivalent to <samp>-fno-freestanding</samp>.
  429. </p>
  430. </dd>
  431. <dt><code>-ffreestanding</code></dt>
  432. <dd><a name="index-ffreestanding-1"></a>
  433. <a name="index-hosted-environment-2"></a>
  434. <p>Assert that compilation targets a freestanding environment. This
  435. implies <samp>-fno-builtin</samp>. A freestanding environment
  436. is one in which the standard library may not exist, and program startup may
  437. not necessarily be at <code>main</code>. The most obvious example is an OS kernel.
  438. This is equivalent to <samp>-fno-hosted</samp>.
  439. </p>
  440. <p>See <a href="Standards.html#Standards">Language Standards Supported by GCC</a>, for details of
  441. freestanding and hosted environments.
  442. </p>
  443. </dd>
  444. <dt><code>-fopenacc</code></dt>
  445. <dd><a name="index-fopenacc"></a>
  446. <a name="index-OpenACC-accelerator-programming"></a>
  447. <p>Enable handling of OpenACC directives <code>#pragma acc</code> in C/C++ and
  448. <code>!$acc</code> in Fortran. When <samp>-fopenacc</samp> is specified, the
  449. compiler generates accelerated code according to the OpenACC Application
  450. Programming Interface v2.6 <a href="https://www.openacc.org">https://www.openacc.org</a><!-- /@w -->. This option
  451. implies <samp>-pthread</samp>, and thus is only supported on targets that
  452. have support for <samp>-pthread</samp>.
  453. </p>
  454. </dd>
  455. <dt><code>-fopenacc-dim=<var>geom</var></code></dt>
  456. <dd><a name="index-fopenacc_002ddim"></a>
  457. <a name="index-OpenACC-accelerator-programming-1"></a>
  458. <p>Specify default compute dimensions for parallel offload regions that do
  459. not explicitly specify. The <var>geom</var> value is a triple of
  460. &rsquo;:&rsquo;-separated sizes, in order &rsquo;gang&rsquo;, &rsquo;worker&rsquo; and, &rsquo;vector&rsquo;. A size
  461. can be omitted, to use a target-specific default value.
  462. </p>
  463. </dd>
  464. <dt><code>-fopenmp</code></dt>
  465. <dd><a name="index-fopenmp"></a>
  466. <a name="index-OpenMP-parallel"></a>
  467. <p>Enable handling of OpenMP directives <code>#pragma omp</code> in C/C++ and
  468. <code>!$omp</code> in Fortran. When <samp>-fopenmp</samp> is specified, the
  469. compiler generates parallel code according to the OpenMP Application
  470. Program Interface v4.5 <a href="https://www.openmp.org">https://www.openmp.org</a><!-- /@w -->. This option
  471. implies <samp>-pthread</samp>, and thus is only supported on targets that
  472. have support for <samp>-pthread</samp>. <samp>-fopenmp</samp> implies
  473. <samp>-fopenmp-simd</samp>.
  474. </p>
  475. </dd>
  476. <dt><code>-fopenmp-simd</code></dt>
  477. <dd><a name="index-fopenmp_002dsimd"></a>
  478. <a name="index-OpenMP-SIMD"></a>
  479. <a name="index-SIMD"></a>
  480. <p>Enable handling of OpenMP&rsquo;s SIMD directives with <code>#pragma omp</code>
  481. in C/C++ and <code>!$omp</code> in Fortran. Other OpenMP directives
  482. are ignored.
  483. </p>
  484. </dd>
  485. <dt><code>-fgnu-tm</code></dt>
  486. <dd><a name="index-fgnu_002dtm"></a>
  487. <p>When the option <samp>-fgnu-tm</samp> is specified, the compiler
  488. generates code for the Linux variant of Intel&rsquo;s current Transactional
  489. Memory ABI specification document (Revision 1.1, May 6 2009). This is
  490. an experimental feature whose interface may change in future versions
  491. of GCC, as the official specification changes. Please note that not
  492. all architectures are supported for this feature.
  493. </p>
  494. <p>For more information on GCC&rsquo;s support for transactional memory,
  495. See <a href="../libitm/Enabling-libitm.html#Enabling-libitm">The GNU Transactional Memory Library</a> in <cite>GNU
  496. Transactional Memory Library</cite>.
  497. </p>
  498. <p>Note that the transactional memory feature is not supported with
  499. non-call exceptions (<samp>-fnon-call-exceptions</samp>).
  500. </p>
  501. </dd>
  502. <dt><code>-fms-extensions</code></dt>
  503. <dd><a name="index-fms_002dextensions"></a>
  504. <p>Accept some non-standard constructs used in Microsoft header files.
  505. </p>
  506. <p>In C++ code, this allows member names in structures to be similar
  507. to previous types declarations.
  508. </p>
  509. <div class="smallexample">
  510. <pre class="smallexample">typedef int UOW;
  511. struct ABC {
  512. UOW UOW;
  513. };
  514. </pre></div>
  515. <p>Some cases of unnamed fields in structures and unions are only
  516. accepted with this option. See <a href="Unnamed-Fields.html#Unnamed-Fields">Unnamed struct/union
  517. fields within structs/unions</a>, for details.
  518. </p>
  519. <p>Note that this option is off for all targets except for x86
  520. targets using ms-abi.
  521. </p>
  522. </dd>
  523. <dt><code>-fplan9-extensions</code></dt>
  524. <dd><a name="index-fplan9_002dextensions"></a>
  525. <p>Accept some non-standard constructs used in Plan 9 code.
  526. </p>
  527. <p>This enables <samp>-fms-extensions</samp>, permits passing pointers to
  528. structures with anonymous fields to functions that expect pointers to
  529. elements of the type of the field, and permits referring to anonymous
  530. fields declared using a typedef. See <a href="Unnamed-Fields.html#Unnamed-Fields">Unnamed
  531. struct/union fields within structs/unions</a>, for details. This is only
  532. supported for C, not C++.
  533. </p>
  534. </dd>
  535. <dt><code>-fcond-mismatch</code></dt>
  536. <dd><a name="index-fcond_002dmismatch"></a>
  537. <p>Allow conditional expressions with mismatched types in the second and
  538. third arguments. The value of such an expression is void. This option
  539. is not supported for C++.
  540. </p>
  541. </dd>
  542. <dt><code>-flax-vector-conversions</code></dt>
  543. <dd><a name="index-flax_002dvector_002dconversions"></a>
  544. <p>Allow implicit conversions between vectors with differing numbers of
  545. elements and/or incompatible element types. This option should not be
  546. used for new code.
  547. </p>
  548. </dd>
  549. <dt><code>-funsigned-char</code></dt>
  550. <dd><a name="index-funsigned_002dchar"></a>
  551. <p>Let the type <code>char</code> be unsigned, like <code>unsigned char</code>.
  552. </p>
  553. <p>Each kind of machine has a default for what <code>char</code> should
  554. be. It is either like <code>unsigned char</code> by default or like
  555. <code>signed char</code> by default.
  556. </p>
  557. <p>Ideally, a portable program should always use <code>signed char</code> or
  558. <code>unsigned char</code> when it depends on the signedness of an object.
  559. But many programs have been written to use plain <code>char</code> and
  560. expect it to be signed, or expect it to be unsigned, depending on the
  561. machines they were written for. This option, and its inverse, let you
  562. make such a program work with the opposite default.
  563. </p>
  564. <p>The type <code>char</code> is always a distinct type from each of
  565. <code>signed char</code> or <code>unsigned char</code>, even though its behavior
  566. is always just like one of those two.
  567. </p>
  568. </dd>
  569. <dt><code>-fsigned-char</code></dt>
  570. <dd><a name="index-fsigned_002dchar"></a>
  571. <p>Let the type <code>char</code> be signed, like <code>signed char</code>.
  572. </p>
  573. <p>Note that this is equivalent to <samp>-fno-unsigned-char</samp>, which is
  574. the negative form of <samp>-funsigned-char</samp>. Likewise, the option
  575. <samp>-fno-signed-char</samp> is equivalent to <samp>-funsigned-char</samp>.
  576. </p>
  577. </dd>
  578. <dt><code>-fsigned-bitfields</code></dt>
  579. <dt><code>-funsigned-bitfields</code></dt>
  580. <dt><code>-fno-signed-bitfields</code></dt>
  581. <dt><code>-fno-unsigned-bitfields</code></dt>
  582. <dd><a name="index-fsigned_002dbitfields"></a>
  583. <a name="index-funsigned_002dbitfields"></a>
  584. <a name="index-fno_002dsigned_002dbitfields"></a>
  585. <a name="index-fno_002dunsigned_002dbitfields"></a>
  586. <p>These options control whether a bit-field is signed or unsigned, when the
  587. declaration does not use either <code>signed</code> or <code>unsigned</code>. By
  588. default, such a bit-field is signed, because this is consistent: the
  589. basic integer types such as <code>int</code> are signed types.
  590. </p>
  591. </dd>
  592. <dt><code>-fsso-struct=<var>endianness</var></code></dt>
  593. <dd><a name="index-fsso_002dstruct"></a>
  594. <p>Set the default scalar storage order of structures and unions to the
  595. specified endianness. The accepted values are &lsquo;<samp>big-endian</samp>&rsquo;,
  596. &lsquo;<samp>little-endian</samp>&rsquo; and &lsquo;<samp>native</samp>&rsquo; for the native endianness of
  597. the target (the default). This option is not supported for C++.
  598. </p>
  599. <p><strong>Warning:</strong> the <samp>-fsso-struct</samp> switch causes GCC to generate
  600. code that is not binary compatible with code generated without it if the
  601. specified endianness is not the native endianness of the target.
  602. </p></dd>
  603. </dl>
  604. <hr>
  605. <div class="header">
  606. <p>
  607. Next: <a href="C_002b_002b-Dialect-Options.html#C_002b_002b-Dialect-Options" accesskey="n" rel="next">C++ Dialect Options</a>, Previous: <a href="Invoking-G_002b_002b.html#Invoking-G_002b_002b" accesskey="p" rel="prev">Invoking G++</a>, Up: <a href="Invoking-GCC.html#Invoking-GCC" accesskey="u" rel="up">Invoking GCC</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>
  608. </div>
  609. </body>
  610. </html>