SEC6.hss 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  1. [Main]
  2. Title=Options Controlling C Dialect
  3. [Top]
  4. The following options control the dialect of C that the compiler accepts:
  5. <DL>
  6. <DT><B>-ansi</B>
  7. <DD>Support all ISO C89 programs.
  8. This turns off certain features of GCC that are incompatible with ISO C89,
  9. such as the <CODE>asm</CODE> and <CODE>typeof</CODE> keywords, and
  10. some predefined macros that identify the
  11. type of system you are using. It also enables the undesirable and
  12. rarely used ISO trigraph feature, and disables recognition of C++ style
  13. <CODE>//</CODE> comments as well as the <CODE>inline</CODE> keyword.
  14. <BR><BR>
  15. The alternate keywords <CODE>__asm__</CODE>, <CODE>__extension__</CODE>,
  16. <CODE>__inline__</CODE> and <CODE>__typeof__</CODE> continue to work despite
  17. <B>'-ansi'</B>. You would not want to use them in an ISO C program, of
  18. course, but it is useful to put them in header files that might be included
  19. in compilations done with <B>'-ansi'</B>. Alternate predefined macros
  20. such as <CODE>__unix__</CODE> are also available, with or
  21. without <B>'-ansi'</B>.
  22. <BR><BR>
  23. The <B>'-ansi'</B> option does not cause non-ISO programs to be
  24. rejected gratuitously. For that, <B>'-pedantic'</B> is required in
  25. addition to <B>'-ansi'</B>. See <A HREF="$$LINK(SEC8)">Warning Options</A>.
  26. <BR><BR>
  27. The macro <CODE>__STRICT_ANSI__</CODE> is predefined when the <B>'-ansi'</B>
  28. option is used. Some header files may notice this macro and refrain
  29. from declaring certain functions or defining certain macros that the
  30. ISO standard doesn't call for; this is to avoid interfering with any
  31. programs that might use these names for other things.
  32. <BR><BR>
  33. Functions which would normally be built in but do not have semantics
  34. defined by ISO C (such as <A HREF="$$LINK(alloc.h/alloca)">alloca</A>) are not built-in
  35. functions with <B>'-ansi'</B> is used. See <A HREF="$$INFOLINK(gnuexts/SEC104)">Other
  36. built-in functions provided by GCC</A> for details of the functions
  37. affected.
  38. <BR><BR>
  39. <B>Note:</B> At the moment, the TIGCC library depends heavily on GNU C extensions,
  40. so you cannot use the <B>'-ansi'</B> switch in TIGCC.
  41. <BR><BR>
  42. <DT><B>-std=<I>standard</I></B>
  43. <DD>Determine the language standard. A value for <I>standard</I> must be provided;
  44. provided; possible values are
  45. <BR><BR><DL>
  46. <DT><B>c89</B>
  47. <BR><B>iso9899:1990</B>
  48. <DD>ISO C90 (same as <B>'-ansi'</B>).
  49. <BR><BR>
  50. <DT><B>iso9899:199409</B>
  51. <DD>ISO C90 as modified in amendment 1.
  52. <BR><BR>
  53. <DT><B>c99</B>
  54. <BR><B>c9x</B>
  55. <BR><B>iso9899:1999</B>
  56. <BR><B>iso9899:199x</B>
  57. <DD>ISO C99. Note that this standard is not yet fully supported; see
  58. <A HREF="http://gcc.gnu.org/gcc-3.3/c99status.html">http://gcc.gnu.org/gcc-3.3/c99status.html</A> for more information. The
  59. names <CODE>c9x</CODE> and <CODE>iso9899:199x</CODE> are deprecated.
  60. <BR><BR>
  61. <DT><B>gnu89</B>
  62. <DD>Default, ISO C90 plus GNU extensions (including some C99 features).
  63. <BR><BR>
  64. <DT><B>gnu99</B>
  65. <BR><B>gnu9x</B>
  66. <DD>ISO C99 plus GNU extensions. When ISO C99 is fully implemented in GCC,
  67. this will become the default. The name <CODE>gnu9x</CODE> is deprecated.
  68. </DL><BR>
  69. Even when this option is not specified, you can still use some of the
  70. features of newer standards in so far as they do not conflict with
  71. previous C standards. For example, you may use <CODE>__restrict__</CODE> even
  72. when <B>'-std=c99'</B> is not specified.
  73. <BR><BR>
  74. The <B>'-std'</B> options specifying some version of ISO C have the same
  75. effects as <B>'-ansi'</B>, except that features that were not in ISO C90
  76. but are in the specified version (for example, <CODE>//</CODE> comments and
  77. the <CODE>inline</CODE> keyword in ISO C99) are not disabled.
  78. <BR><BR>
  79. <DT><B>-aux-info <I>filename</I></B>
  80. <DD>Output to the given filename prototyped declarations for all functions
  81. declared and/or defined in a translation unit, including those in header
  82. files. This option is silently ignored in any language other than C.
  83. <BR><BR>
  84. Besides declarations, the file indicates, in comments, the origin of
  85. each declaration (source file and line), whether the declaration was
  86. implicit, prototyped or unprototyped (<CODE>I</CODE>, <CODE>N</CODE> for new or
  87. <CODE>O</CODE> for old, respectively, in the first character after the line
  88. number and the colon), and whether it came from a declaration or a
  89. definition (<CODE>C</CODE> or <CODE>F</CODE>, respectively, in the following
  90. character). In the case of function definitions, a K&amp;R-style list of
  91. arguments followed by their declarations is also provided, inside
  92. comments, after the declaration.
  93. <BR><BR>
  94. <DT><B>-fno-asm</B>
  95. <DD>Do not recognize <CODE>asm</CODE>, <CODE>inline</CODE> or <CODE>typeof</CODE> as a
  96. keyword, so that code can use these words as identifiers. You can use
  97. the keywords <CODE>__asm__</CODE>, <CODE>__inline__</CODE> and <CODE>__typeof__</CODE>
  98. instead. <B>'-ansi'</B> implies <B>'-fno-asm'</B>.
  99. <BR><BR>
  100. <DT><B>-fno-builtin</B>
  101. <BR><B>-fno-builtin-<I>function</I></B>
  102. <DD>Don't recognize built-in functions that do not begin with
  103. <CODE>__builtin_</CODE> as prefix. See <A HREF="$$INFOLINK(gnuexts/SEC104)">Other built-in
  104. functions provided by GCC</A> for details of the functions affected,
  105. including those which are not built-in functions when <B>'-ansi'</B> or
  106. <B>'-std'</B> options for strict ISO C conformance are used because they
  107. do not have an ISO standard meaning.
  108. <BR><BR>
  109. GCC normally generates special code to handle certain built-in functions
  110. more efficiently; for instance, calls to <A HREF="$$LINK(alloc.h/alloca)">alloca</A> may become single
  111. instructions that adjust the stack directly. The resulting code is often both smaller
  112. and faster, but since the function calls no longer appear as such, you
  113. cannot set a breakpoint on those calls, nor can you change the behavior
  114. of the functions by linking with a different library.
  115. <BR><BR>
  116. With the <B>'-fno-builtin-<I>function</I>'</B> option,
  117. only the built-in function <I>function</I> is
  118. disabled. <I>function</I> must not begin with <CODE>__builtin_</CODE>. If a
  119. function is named this is not built-in in this version of GCC, this
  120. option is ignored. There is no corresponding
  121. <B>'-fbuiltin-<I>function</I>'</B> option; if you wish to enable
  122. built-in functions selectively when using <B>'-fno-builtin'</B> or
  123. <B>'-ffreestanding'</B>, you may define macros such as:
  124. <PRE>#define abs(n) __builtin_abs ((n))
  125. #define strcpy(d, s) __builtin_strcpy ((d), (s))
  126. </PRE>
  127. <DT><B>-fhosted</B>
  128. <DD>Assert that compilation takes place in a hosted environment. This implies
  129. <B>'-fbuiltin'</B>. A hosted environment is one in which the
  130. entire standard library is available, and in which <CODE>main</CODE> has a return
  131. type of <CODE>int</CODE>. Examples are nearly everything except a kernel.
  132. This is equivalent to <B>'-fno-freestanding'</B>.
  133. <BR><BR>
  134. Although TI calculators are not really hosted environments, <B>'-fhosted'</B>
  135. is kept as the default.
  136. <BR><BR>
  137. <DT><B>-ffreestanding</B>
  138. <DD>Assert that compilation takes place in a freestanding environment. This
  139. implies <B>'-fno-builtin'</B>. A freestanding environment
  140. is one in which the standard library may not exist, and program startup may
  141. not necessarily be at <CODE>main</CODE>. The most obvious example is an OS kernel.
  142. This is equivalent to <B>'-fno-hosted'</B>.
  143. <BR><BR>
  144. <DT><B>-fms-extensions</B>
  145. <DD>Accept some non-standard constructs used in Microsoft header files.
  146. <BR><BR>
  147. <DT><B>-trigraphs</B>
  148. <DD>Support ISO C trigraphs. The <B>'-ansi'</B> option (and <B>'-std'</B>
  149. options for strict ISO C conformance) implies <B>'-trigraphs'</B>.
  150. See <A HREF="$$LINK(SEC11)">Options Controlling the Preprocessor</A> for more information.
  151. <BR><BR>
  152. <DT><B>-no-integrated-cpp</B>
  153. <DD>Performs a compilation in two passes: preprocessing and compiling. This
  154. option allows a user supplied &quot;cc1&quot; via the
  155. <B>'-B'</B> option. The user supplied compilation step can then add in
  156. an additional preprocessing step after normal preprocessing but before
  157. compiling. The default is to use the integrated preprocessor.
  158. <BR><BR>
  159. The semantics of this option will change if &quot;cc1&quot;, &quot;cc1plus&quot;, and
  160. &quot;cc1obj&quot; are merged.
  161. <BR><BR>
  162. <DT><B>-traditional</B>
  163. <BR><B>-traditional-cpp</B>
  164. <DD>Formerly, these options caused GCC to attempt to emulate a pre-standard
  165. C compiler. They are now only supported with the <B>'-E'</B> switch.
  166. The preprocessor continues to support a <A HREF="$$INFOLINK(CPP/SEC70)">pre-standard mode</A>.
  167. <BR><BR>
  168. <DT><B>-fcond-mismatch</B>
  169. <DD>Allow conditional expressions with mismatched types in the second and
  170. third arguments. The value of such an expression is void.
  171. <BR><BR>
  172. <DT><B>-funsigned-char</B>
  173. <DD>Let the type <CODE><A HREF="$$INFOLINK(keywords/char)">char</A></CODE> be unsigned, like <CODE>unsigned&nbsp;char</CODE>.
  174. In TIGCC, the default is <CODE>signed char</CODE>.
  175. <BR><BR>
  176. Ideally, a portable program should always use <CODE>signed&nbsp;char</CODE> or
  177. <CODE>unsigned&nbsp;char</CODE> when it depends on the signedness of an object.
  178. But many programs have been written to use plain <CODE>char</CODE> and
  179. expect it to be signed, or expect it to be unsigned, depending on the
  180. machines they were written for. This option, and its inverse, let you
  181. make such a program work with the opposite default.
  182. <BR><BR>
  183. The type <CODE>char</CODE> is always a distinct type from each of
  184. <CODE>signed&nbsp;char</CODE> or <CODE>unsigned&nbsp;char</CODE>, even though its behavior
  185. is always just like one of those two.
  186. <BR><BR>
  187. <DT><B>-fsigned-char</B>
  188. <DD>Let the type <CODE><A HREF="$$INFOLINK(keywords/char)">char</A></CODE> be signed, like <CODE>signed&nbsp;char</CODE>.
  189. <BR><BR>
  190. Note that this is equivalent to <B>'-fno-unsigned-char'</B>, which is
  191. the negative form of <B>'-funsigned-char'</B>. Likewise, the option
  192. <B>'-fno-signed-char'</B> is equivalent to <B>'-funsigned-char'</B>.
  193. <BR><BR>
  194. <DT><B>-fsigned-bitfields</B>
  195. <BR><B>-funsigned-bitfields</B>
  196. <BR><B>-fno-signed-bitfields</B>
  197. <BR><B>-fno-unsigned-bitfields</B>
  198. <DD>These options control whether a bit-field is signed or unsigned, when the
  199. declaration does not use either <CODE>signed</CODE> or <CODE>unsigned</CODE>. By
  200. default, such a bit-field is signed, because this is consistent: the
  201. basic integer types such as <CODE>int</CODE> are signed types.
  202. <BR><BR>
  203. <DT><B>-fwritable-strings</B>
  204. <DD>Store string constants in the writable data segment and don't uniquize
  205. them. This is for compatibility with old programs which assume they can
  206. write into string constants.
  207. <BR><BR>
  208. Writing into string constants is a very bad idea; &quot;constants&quot; should
  209. be constant.
  210. </DL>