Mercurial > hg > CbC > CbC_gcc
diff gcc/doc/objc.texi @ 111:04ced10e8804
gcc 7
author | kono |
---|---|
date | Fri, 27 Oct 2017 22:46:09 +0900 |
parents | f6334be47118 |
children | 84e7813d76e9 |
line wrap: on
line diff
--- a/gcc/doc/objc.texi Sun Aug 21 07:07:55 2011 +0900 +++ b/gcc/doc/objc.texi Fri Oct 27 22:46:09 2017 +0900 @@ -1,13 +1,11 @@ -@c Copyright (C) 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, -@c 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2010 -@c Free Software Foundation, Inc. +@c Copyright (C) 1988-2017 Free Software Foundation, Inc. @c This is part of the GCC manual. @c For copying conditions, see the file gcc.texi. @node Objective-C @comment node-name, next, previous, up -@chapter GNU Objective-C features +@chapter GNU Objective-C Features This document is meant to describe some of the GNU Objective-C features. It is not intended to teach you Objective-C. There are @@ -28,7 +26,7 @@ @c ========================================================================= @node GNU Objective-C runtime API -@section GNU Objective-C runtime API +@section GNU Objective-C Runtime API This section is specific for the GNU Objective-C runtime. If you are using a different runtime, you can skip it. @@ -52,7 +50,7 @@ @c ========================================================================= @node Modern GNU Objective-C runtime API -@subsection Modern GNU Objective-C runtime API +@subsection Modern GNU Objective-C Runtime API The GNU Objective-C runtime provides an API which is similar to the one provided by the ``Objective-C 2.0'' Apple/NeXT Objective-C @@ -111,7 +109,7 @@ @c ========================================================================= @node Traditional GNU Objective-C runtime API -@subsection Traditional GNU Objective-C runtime API +@subsection Traditional GNU Objective-C Runtime API The GNU Objective-C runtime used to provide a different API, which we call the ``traditional'' GNU Objective-C runtime API. Functions @@ -121,28 +119,12 @@ API). Software using this API includes the file @file{objc/objc-api.h} where it is declared. -The traditional API is deprecated but it is still supported in this -release of the runtime; you can access it as usual by including -@file{objc/objc-api.h}. - -If you are using the traditional API you are urged to upgrade your -software to use the modern API because the traditional API requires -access to private runtime internals to do anything serious with it; -for this reason, there is no guarantee that future releases of the GNU -Objective-C runtime library will be able to provide a fully compatible -@file{objc/objc-api.h} as the private runtime internals change. It is -expected that the next release will hide a number of runtime internals -making the traditional API nominally supported but fairly useless -beyond very simple use cases. - -Finally, you can not include both @file{objc/objc-api.h} and -@file{objc/runtime.h} at the same time. The traditional and modern -APIs unfortunately have some conflicting declarations (such as the one -for @code{Method}) and can not be used at the same time. +Starting with GCC 4.7.0, the traditional GNU runtime API is no longer +available. @c ========================================================================= @node Executing code before main -@section @code{+load}: Executing code before main +@section @code{+load}: Executing Code before @code{main} This section is specific for the GNU Objective-C runtime. If you are using a different runtime, you can skip it. @@ -226,7 +208,7 @@ @node What you can and what you cannot do in +load -@subsection What you can and what you cannot do in @code{+load} +@subsection What You Can and Cannot Do in @code{+load} @code{+load} is to be used only as a last resort. Because it is executed very early, most of the Objective-C runtime machinery will @@ -297,7 +279,7 @@ @node Type encoding -@section Type encoding +@section Type Encoding This is an advanced section. Type encodings are used extensively by the compiler and by the runtime, but you generally do not need to know @@ -399,7 +381,7 @@ @sp 1 -@multitable @columnfractions .25 .75 +@multitable @columnfractions .60 .40 @item Objective-C type @tab Compiler encoding @item @@ -422,7 +404,7 @@ @smallexample int a __attribute__ ((vector_size (16))); @end smallexample -@tab @code{![16,16i]} (alignment would depend on the machine) +@tab @code{![16,16i]} (alignment depends on the machine) @end multitable @sp 1 @@ -505,7 +487,7 @@ @end menu @node Legacy type encoding -@subsection Legacy type encoding +@subsection Legacy Type Encoding Unfortunately, historically GCC used to have a number of bugs in its encoding code. The NeXT runtime expects GCC to emit type encodings in @@ -536,7 +518,7 @@ a bit offset or the underlying field type. @node @@encode -@subsection @@encode +@subsection @code{@@encode} GNU Objective-C supports the @code{@@encode} syntax that allows you to create a type encoding from a C/Objective-C type. For example, @@ -548,7 +530,7 @@ invalid and will cause a compilation error. @node Method signatures -@subsection Method signatures +@subsection Method Signatures This section documents the encoding of method types, which is rarely needed to use Objective-C. You should skip it at a first reading; the @@ -651,7 +633,8 @@ + (void)initialize @{ - class_ivar_set_gcinvisible (self, "weakPointer", YES); + if (self == objc_lookUpClass ("WeakPointer")) + class_ivar_set_gcinvisible (self, "weakPointer", YES); @} - initWithPointer:(const void*)p @@ -677,7 +660,7 @@ @c ========================================================================= @node Constant string objects -@section Constant string objects +@section Constant String Objects GNU Objective-C provides constant string objects that are generated directly by the compiler. You declare a constant string object by @@ -738,7 +721,7 @@ @c ========================================================================= @node compatibility_alias -@section compatibility_alias +@section @code{compatibility_alias} The keyword @code{@@compatibility_alias} allows you to define a class name as equivalent to another class name. For example: @@ -875,7 +858,7 @@ @c ========================================================================= @node Fast enumeration -@section Fast enumeration +@section Fast Enumeration @menu * Using fast enumeration:: @@ -886,7 +869,7 @@ @c ================================ @node Using fast enumeration -@subsection Using fast enumeration +@subsection Using Fast Enumeration GNU Objective-C provides support for the fast enumeration syntax: @@ -926,7 +909,7 @@ @c ================================ @node c99-like fast enumeration syntax -@subsection c99-like fast enumeration syntax +@subsection C99-Like Fast Enumeration Syntax A c99-like declaration syntax is also allowed: @@ -960,7 +943,7 @@ @c ================================ @node Fast enumeration details -@subsection Fast enumeration details +@subsection Fast Enumeration Details Here is a more technical description with the gory details. Consider the code @@ -1023,13 +1006,13 @@ @c ================================ @node Fast enumeration protocol -@subsection Fast enumeration protocol +@subsection Fast Enumeration Protocol If you want your own collection object to be usable with fast enumeration, you need to have it implement the method @smallexample -- (unsigned long) countByEnumeratingWithState: (NSFastEnumerationState *)state +- (unsigned long) countByEnumeratingWithState: (NSFastEnumerationState *)state objects: (id *)objects count: (unsigned long)len; @end smallexample @@ -1093,7 +1076,7 @@ @c ========================================================================= @node Messaging with the GNU Objective-C runtime -@section Messaging with the GNU Objective-C runtime +@section Messaging with the GNU Objective-C Runtime This section is specific for the GNU Objective-C runtime. If you are using a different runtime, you can skip it. @@ -1124,7 +1107,7 @@ @c ========================================================================= @node Dynamically registering methods -@subsection Dynamically registering methods +@subsection Dynamically Registering Methods If @code{objc_msg_lookup()} does not find a suitable method implementation, because the receiver does not implement the required @@ -1138,7 +1121,7 @@ + (BOOL) resolveInstanceMethod: (SEL)selector; @end smallexample -in the case of an instance method, or +in the case of an instance method, or @smallexample + (BOOL) resolveClassMethod: (SEL)selector; @@ -1170,17 +1153,17 @@ @c ========================================================================= @node Forwarding hook -@subsection Forwarding hook +@subsection Forwarding Hook The GNU Objective-C runtime provides a hook, called @code{__objc_msg_forward2}, which is called by -@code{objc_msg_lookup()} when it can't find a method implementation in +@code{objc_msg_lookup()} when it cannot find a method implementation in the runtime tables and after calling @code{+resolveInstanceMethod:} and @code{+resolveClassMethod:} has been attempted and did not succeed in dynamically registering the method. To configure the hook, you set the global variable -@code{__objc_msg_foward2} to a function with the same argument and +@code{__objc_msg_forward2} to a function with the same argument and return types of @code{objc_msg_lookup()}. When @code{objc_msg_lookup()} can not find a method implementation, it invokes the hook function you provided to get a method implementation