summaryrefslogtreecommitdiffstats
path: root/contrib/gcc/doc
diff options
context:
space:
mode:
authorpfg <pfg@FreeBSD.org>2014-01-05 00:43:28 +0000
committerpfg <pfg@FreeBSD.org>2014-01-05 00:43:28 +0000
commit9c8bbe68490d277cf64459b3390cf48e2a09ddf6 (patch)
treefffd69b9133b091a53ee14b3de5fd5006d53f92a /contrib/gcc/doc
parentc5e9a8143da358a2c480a64c9782d5eedda3b002 (diff)
downloadFreeBSD-src-9c8bbe68490d277cf64459b3390cf48e2a09ddf6.zip
FreeBSD-src-9c8bbe68490d277cf64459b3390cf48e2a09ddf6.tar.gz
gcc: Add support for Apple's Block extension
Block objects [1] are a C-level syntactic and runtime feature. They are similar to standard C functions, but in addition to executable code they may also contain variable bindings to automatic (stack) or managed (heap) memory. A block can therefore maintain a set of state (data) that it can use to impact behavior when executed. This port is based on Apple's GCC 5646 with some bugfixes from Apple GCC 5666.3. It has some small differences with the support in clang, which remains the recommended compiler. Perhaps the most notable difference is that in GCC that __block is not actually a keyword, but a macro. There will be workaround for this issue in a near future. Other issues can be consulted in the clang documentation [2] For better compatiblity with Apple's GCC and llvm-gcc some related fixes and features from Apple have been included. Support for the non-standard nested functions in GCC is now off by default. No effort was made to update the ObjC support since FreeBSD doesn't carry ObjC in the base system, but some of the code crept in and was more difficult to remove than to adjust. Reference: [1] https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/Blocks/Articles/00_Introduction.html [2] http://clang.llvm.org/compatibility.html#block-variable-initialization Obtained from: Apple GCC 4.2 MFC after: 3 weeks
Diffstat (limited to 'contrib/gcc/doc')
-rw-r--r--contrib/gcc/doc/extend.texi41
-rw-r--r--contrib/gcc/doc/invoke.texi22
2 files changed, 59 insertions, 4 deletions
diff --git a/contrib/gcc/doc/extend.texi b/contrib/gcc/doc/extend.texi
index db6f1bd..caf0be0 100644
--- a/contrib/gcc/doc/extend.texi
+++ b/contrib/gcc/doc/extend.texi
@@ -85,6 +85,8 @@ extensions, accepted by GCC in C89 mode and in C++.
* Unnamed Fields:: Unnamed struct/union fields within structs/unions.
* Thread-Local:: Per-thread variables.
* Binary constants:: Binary constants using the @samp{0b} prefix.
+@c APPLE LOCAL blocks 7205047 5811887
+* Blocks:: Anonymous functions (closures).
@end menu
@node Statement Exprs
@@ -378,9 +380,14 @@ allows the data to be read-only.
@cindex thunks
A @dfn{nested function} is a function defined inside another function.
-(Nested functions are not supported for GNU C++.) The nested function's
-name is local to the block where it is defined. For example, here we
-define a nested function named @code{square}, and call it twice:
+@c APPLE LOCAL begin nested functions 4357979
+Nested functions are not supported for GNU C++ and are disable by
+default on FreeBSD. The @option{-fnested-functions} and
+@option{-fno-nested-functions} options can be used to enable and
+disable nested function suppport. The nested function's name is local
+to the block where it is defined. For example, here we define a
+nested function named @code{square}, and call it twice:
+@c APPLE LOCAL end nested functions 4357979
@smallexample
@group
@@ -3786,6 +3793,22 @@ and caught in another, the class must have default visibility.
Otherwise the two shared objects will be unable to use the same
typeinfo node and exception handling will break.
+@c APPLE LOCAL begin weak types 5954418
+@item weak
+In C++, attribute weak can be applied to a class to ensure that all
+non-hidden instances of the type are treated as the same type across
+shared library boundaries on platforms (such as darwin and arm aapcs)
+that can emit vtables and the type info meta data as non-comdat
+symbols. This is useful when the class has a key method and the
+translation unit that contains the key method is used in more than one
+shared library or in a shared library and the application. Doing this
+results in more expensive startup times. This attribute is inherited
+by subclasses, so it is only necessary to mark a base type. The
+typical use would be to mark any types used for throwing across shared
+library boundaries or those used in dynamic_cast operations across a
+shared library boundary.
+@c APPLE LOCAL end weak types 5954418
+
@subsection ARM Type Attributes
On those ARM targets that support @code{dllimport} (such as Symbian
@@ -10534,6 +10557,18 @@ Non-@code{static} members shall not be @code{__thread}.
@end quotation
@end itemize
+@c APPLE LOCAL begin blocks 7205047 5811887
+@node Blocks
+@section Blocks
+@cindex Blocks
+@cindex __block
+
+Blocks is a language feature that allows one to create anonymous
+functions. The feature is also known as lambdas or closures in other
+languages. The feature is controlled by @option{-fblocks}.
+See @uref{http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/Blocks/Articles/00_Introduction.html} for additional details.
+@c APPLE LOCAL end blocks 7205047 5811887
+
@node Binary constants
@section Binary constants using the @samp{0b} prefix
@cindex Binary constants using the @samp{0b} prefix
diff --git a/contrib/gcc/doc/invoke.texi b/contrib/gcc/doc/invoke.texi
index dd9a367..0eaf2e3 100644
--- a/contrib/gcc/doc/invoke.texi
+++ b/contrib/gcc/doc/invoke.texi
@@ -164,10 +164,13 @@ in the following sections.
@xref{C Dialect Options,,Options Controlling C Dialect}.
@gccoptlist{-ansi -std=@var{standard} -fgnu89-inline @gol
-aux-info @var{filename} @gol
--fno-asm -fno-builtin -fno-builtin-@var{function} @gol
+@c APPLE LOCAL blocks 7205047 5811887
+-fno-asm -fno-blocks -fno-builtin -fno-builtin-@var{function} @gol
-fhosted -ffreestanding -fopenmp -fms-extensions @gol
-trigraphs -no-integrated-cpp -traditional -traditional-cpp @gol
-fallow-single-precision -fcond-mismatch -flax-vector-conversions @gol
+@c APPLE LOCAL nested functions 4357979 */
+-fno-nested-functions @gol
-fsigned-bitfields -fsigned-char @gol
@c APPLE LOCAL -Wnewline-eof 2001-08-23 --sts **
-Wnewline-eof (Apple compatible) @gol
@@ -1230,6 +1233,16 @@ effect. In C99 mode (@option{-std=c99} or @option{-std=gnu99}), this
switch only affects the @code{asm} and @code{typeof} keywords, since
@code{inline} is a standard keyword in ISO C99.
+@c APPLE LOCAL begin blocks 7205047 5811887
+@item -fno-blocks
+@opindex fno-blocks
+Disable the use of blocks. In @option{-std=c99} mode, blocks are
+turned off by default. @option{-fblocks} can be used to re-enable the
+feature, if off. Runtime support for blocks first appeared in Mac OS
+X 10.6. When targeting 10.6 (see @option{-mmacosx-version-min}) and
+later, the extension is on by default.
+@c APPLE LOCAL end blocks 7205047 5811887
+
@item -fno-builtin
@itemx -fno-builtin-@var{function}
@opindex fno-builtin
@@ -1336,6 +1349,13 @@ C compiler. They are now only supported with the @option{-E} switch.
The preprocessor continues to support a pre-standard mode. See the GNU
CPP manual for details.
+@c APPLE LOCAL begin nested functions 4357979
+@item -fno-nested-functions
+@opindex fno-nested-functions
+Disable nested functions. This option is not supported for C++ or
+Objective-C++. On FreeBSD, nested functions are disabled by default.
+@c APPLE LOCAL end nested functions 4357979
+
@item -fcond-mismatch
@opindex fcond-mismatch
Allow conditional expressions with mismatched types in the second and
OpenPOWER on IntegriCloud