⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 objective-c-dialect-options.html

📁 gcc手册
💻 HTML
字号:
<html lang="en">

<head>

<title>Using the GNU Compiler Collection (GCC)</title>

<meta http-equiv="Content-Type" content="text/html">

<meta name="description" content="Using the GNU Compiler Collection (GCC)">

<meta name="generator" content="makeinfo 4.3">

<link href="http://www.gnu.org/software/texinfo/" rel="generator-home">

<!--

Copyright &copy; 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,

1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.



   <p>Permission is granted to copy, distribute and/or modify this document

under the terms of the GNU Free Documentation License, Version 1.2 or

any later version published by the Free Software Foundation; with the

Invariant Sections being "GNU General Public License" and "Funding

Free Software", the Front-Cover texts being (a) (see below), and with

the Back-Cover Texts being (b) (see below).  A copy of the license is

included in the section entitled "GNU Free Documentation License".



   <p>(a) The FSF's Front-Cover Text is:



   <p>A GNU Manual



   <p>(b) The FSF's Back-Cover Text is:



   <p>You have freedom to copy and modify this GNU Manual, like GNU

     software.  Copies published by the Free Software Foundation raise

     funds for GNU development.-->

</head>

<body>

<div class="node">

<p>

Node:<a name="Objective-C%20Dialect%20Options">Objective-C Dialect Options</a>,

Next:<a rel="next" accesskey="n" href="Language-Independent-Options.html#Language%20Independent%20Options">Language Independent Options</a>,

Previous:<a rel="previous" accesskey="p" href="C---Dialect-Options.html#C++%20Dialect%20Options">C++ Dialect Options</a>,

Up:<a rel="up" accesskey="u" href="Invoking-GCC.html#Invoking%20GCC">Invoking GCC</a>

<hr><br>

</div>



<h3 class="section">Options Controlling Objective-C Dialect</h3>



   <p>This section describes the command-line options that are only meaningful

for Objective-C programs; but you can also use most of the GNU compiler

options regardless of what language your program is in.  For example,

you might compile a file <code>some_class.m</code> like this:



<pre class="example">     gcc -g -fgnu-runtime -O -c some_class.m

     </pre>



<p>In this example, only <code>-fgnu-runtime</code> is an option meant only for

Objective-C programs; you can use the other options with any language

supported by GCC.



   <p>Here is a list of options that are <em>only</em> for compiling Objective-C

programs:



     <dl>

<dt><code>-fconstant-string-class=</code><var>class-name</var><code></code>

     <dd>Use <var>class-name</var> as the name of the class to instantiate for each

literal string specified with the syntax <code>@"..."</code>.  The default

class name is <code>NXConstantString</code>.



     <br><dt><code>-fgnu-runtime</code>

     <dd>Generate object code compatible with the standard GNU Objective-C

runtime.  This is the default for most types of systems.



     <br><dt><code>-fnext-runtime</code>

     <dd>Generate output compatible with the NeXT runtime.  This is the default

for NeXT-based systems, including Darwin and Mac OS X.  The macro

<code>__NEXT_RUNTIME__</code> is predefined if (and only if) this option is

used.



     <br><dt><code>-gen-decls</code>

     <dd>Dump interface declarations for all classes seen in the source file to a

file named <code></code><var>sourcename</var><code>.decl</code>.



     <br><dt><code>-Wno-protocol</code>

     <dd>If a class is declared to implement a protocol, a warning is issued for

every method in the protocol that is not implemented by the class.  The

default behavior is to issue a warning for every method not explicitly

implemented in the class, even if a method implementation is inherited

from the superclass.  If you use the <code>-Wno-protocol</code> option, then

methods inherited from the superclass are considered to be implemented,

and no warning is issued for them.



     <br><dt><code>-Wselector</code>

     <dd>Warn if multiple methods of different types for the same selector are

found during compilation.  The check is performed on the list of methods

in the final stage of compilation.  Additionally, a check is performed

that for each selector appearing in a <code>@selector(...)</code>

expression, a corresponding method with that selector has been found

during compilation.  Because these checks scan the method table only at

the end of compilation, these warnings are not produced if the final

stage of compilation is not reached, for example because an error is

found during compilation, or because the <code>-fsyntax-only</code> option is

being used.



     <br><dt><code>-Wundeclared-selector</code>

     <dd>Warn if a <code>@selector(...)</code> expression referring to an

undeclared selector is found.  A selector is considered undeclared if no

method with that name has been declared (explicitly, in an

<code>@interface</code> or <code>@protocol</code> declaration, or implicitly, in

an <code>@implementation</code> section) before the

<code>@selector(...)</code> expression.  This option always performs its

checks as soon as a <code>@selector(...)</code> expression is found

(while <code>-Wselector</code> only performs its checks in the final stage of

compilation), and so additionally enforces the coding style convention

that methods and selectors must be declared before being used.



   </dl>



   </body></html>



⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -