diff options
Diffstat (limited to 'docs/LanguageExtensions.html')
-rw-r--r-- | docs/LanguageExtensions.html | 392 |
1 files changed, 356 insertions, 36 deletions
diff --git a/docs/LanguageExtensions.html b/docs/LanguageExtensions.html index 7ee8f010a32b..c4a8047f1f48 100644 --- a/docs/LanguageExtensions.html +++ b/docs/LanguageExtensions.html @@ -4,7 +4,7 @@ <html> <head> <META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> - <title>Clang LanguageExtensions</title> + <title>Clang Language Extensions</title> <link type="text/css" rel="stylesheet" href="../menu.css"> <link type="text/css" rel="stylesheet" href="../content.css"> <style type="text/css"> @@ -38,29 +38,41 @@ <ul> <li><a href="#cxx0x">C++0x</a> <ul> - <li><a href="#cxx_decltype">C++0x <tt>decltype()</tt></a></li> - <li><a href="#cxx_access_control_sfinae">C++0x SFINAE includes access control</a></li> + <li><a href="#cxx_access_control_sfinae">C++0x SFINAE includes access control</a></li> <li><a href="#cxx_alias_templates">C++0x alias templates</a></li> + <li><a href="#cxx_alignas">C++0x alignment specifiers</a></li> <li><a href="#cxx_attributes">C++0x attributes</a></li> + <li><a href="#cxx_constexpr">C++0x generalized constant expressions</a></li> + <li><a href="#cxx_decltype">C++0x <tt>decltype()</tt></a></li> <li><a href="#cxx_default_function_template_args">C++0x default template arguments in function templates</a></li> <li><a href="#cxx_delegating_constructor">C++0x delegating constructors</a></li> <li><a href="#cxx_deleted_functions">C++0x deleted functions</a></li> + <li><a href="#cxx_explicit_conversions">C++0x explicit conversion functions</a></li> + <li><a href="#cxx_generalized_initializers">C++0x generalized initializers</a></li> + <li><a href="#cxx_implicit_moves">C++0x implicit move constructors/assignment operators</a></li> + <li><a href="#cxx_inheriting_constructors">C++0x inheriting constructors</a></li> + <li><a href="#cxx_inline_namespaces">C++0x inline namespaces</a></li> <li><a href="#cxx_lambdas">C++0x lambdas</a></li> + <li><a href="#cxx_noexcept">C++0x noexcept specification</a></li> + <li><a href="#cxx_nonstatic_member_init">C++0x in-class non-static data member initialization</a></li> <li><a href="#cxx_nullptr">C++0x nullptr</a></li> <li><a href="#cxx_override_control">C++0x override control</a></li> <li><a href="#cxx_range_for">C++0x range-based for loop</a></li> + <li><a href="#cxx_raw_string_literals">C++0x raw string literals</a></li> <li><a href="#cxx_rvalue_references">C++0x rvalue references</a></li> <li><a href="#cxx_reference_qualified_functions">C++0x reference-qualified functions</a></li> <li><a href="#cxx_static_assert">C++0x <tt>static_assert()</tt></a></li> <li><a href="#cxx_auto_type">C++0x type inference</a></li> - <li><a href="#cxx_variadic_templates">C++0x variadic templates</a></li> - <li><a href="#cxx_inline_namespaces">C++0x inline namespaces</a></li> - <li><a href="#cxx_strong_enums">C++0x strongly-typed enumerations</a></li> + <li><a href="#cxx_strong_enums">C++0x strongly-typed enumerations</a></li> <li><a href="#cxx_trailing_return">C++0x trailing return type</a></li> - <li><a href="#cxx_noexcept">C++0x noexcept specification</a></li> - </ul></li> + <li><a href="#cxx_unicode_literals">C++0x Unicode string literals</a></li> + <li><a href="#cxx_unrestricted_unions">C++0x unrestricted unions</a></li> + <li><a href="#cxx_user_literals">C++0x user-defined literals</a></li> + <li><a href="#cxx_variadic_templates">C++0x variadic templates</a></li> + </ul></li> <li><a href="#c1x">C1X</a> <ul> + <li><a href="#c_alignas">C1X alignment specifiers</a></li> <li><a href="#c_generic_selections">C1X generic selections</a></li> <li><a href="#c_static_assert">C1X <tt>_Static_assert()</tt></a></li> </ul></li> @@ -71,9 +83,11 @@ <ul> <li><a href="#objc_instancetype">Related result types</a></li> <li><a href="#objc_arc">Automatic reference counting</a></li> + <li><a href="#objc_fixed_enum">Enumerations with a fixed underlying type</a></li> </ul> </li> <li><a href="#overloading-in-c">Function Overloading in C</a></li> +<li><a href="#complex-list-init">Initializer lists for complex numbers in C</a></li> <li><a href="#builtins">Builtin Functions</a> <ul> <li><a href="#__builtin_shufflevector">__builtin_shufflevector</a></li> @@ -87,6 +101,27 @@ </ul> </li> <li><a href="#analyzerspecific">Static Analysis-Specific Extensions</a></li> +<li><a href="#threadsafety">Thread Safety Annotation Checking</a></li> + <ul> + <li><a href="#ts_noanal"><tt>no_thread_safety_analysis</tt></a></li> + <li><a href="#ts_lockable"><tt>lockable</tt></a></li> + <li><a href="#ts_scopedlockable"><tt>scoped_lockable</tt></a></li> + <li><a href="#ts_guardedvar"><tt>guarded_var</tt></a></li> + <li><a href="#ts_ptguardedvar"><tt>pt_guarded_var</tt></a></li> + <li><a href="#ts_guardedby"><tt>guarded_by(l)</tt></a></li> + <li><a href="#ts_ptguardedby"><tt>pt_guarded_by(l)</tt></a></li> + <li><a href="#ts_acquiredbefore"><tt>acquired_before(...)</tt></a></li> + <li><a href="#ts_acquiredafter"><tt>acquired_after(...)</tt></a></li> + <li><a href="#ts_elf"><tt>exclusive_lock_function(...)</tt></a></li> + <li><a href="#ts_slf"><tt>shared_lock_function(...)</tt></a></li> + <li><a href="#ts_etf"><tt>exclusive_trylock_function(...)</tt></a></li> + <li><a href="#ts_stf"><tt>shared_trylock_function(...)</tt></a></li> + <li><a href="#ts_uf"><tt>unlock_function(...)</tt></a></li> + <li><a href="#ts_lr"><tt>lock_returned(l)</tt></a></li> + <li><a href="#ts_le"><tt>locks_excluded(...)</tt></a></li> + <li><a href="#ts_elr"><tt>exclusive_locks_required(...)</tt></a></li> + <li><a href="#ts_slr"><tt>shared_locks_required(...)</tt></a></li> + </ul> </ul> <!-- ======================================================================= --> @@ -267,6 +302,23 @@ and will issue a warning if used in the top-level compilation file. A warning will also be issued if an absolute path is used in the file argument.</p> + +<!-- ======================================================================= --> +<h3><a name="__has_warning">__has_warning</a></h3> +<!-- ======================================================================= --> + +<p>This function-like macro takes a string literal that represents a command + line option for a warning and returns true if that is a valid warning + option.</p> + +<blockquote> +<pre> +#if __has_warning("-Wformat") +... +#endif +</pre> +</blockquote> + <!-- ======================================================================= --> <h2 id="builtinmacros">Builtin Macros</h2> <!-- ======================================================================= --> @@ -416,12 +468,6 @@ noted.</p> C++0x standard. As a result, all these features are enabled with the <tt>-std=c++0x</tt> option when compiling C++ code.</p> -<h4 id="cxx_decltype">C++0x <tt>decltype()</tt></h4> - -<p>Use <tt>__has_feature(cxx_decltype)</tt> or -<tt>__has_extension(cxx_decltype)</tt> to determine if support for the -<tt>decltype()</tt> specifier is enabled.</p> - <h4 id="cxx_access_control_sfinae">C++0x SFINAE includes access control</h4> <p>Use <tt>__has_feature(cxx_access_control_sfinae)</tt> or <tt>__has_extension(cxx_access_control_sfinae)</tt> to determine whether access-control errors (e.g., calling a private constructor) are considered to be template argument deduction errors (aka SFINAE errors), per <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#1170">C++ DR1170</a>.</p> @@ -432,12 +478,30 @@ with the <tt>-std=c++0x</tt> option when compiling C++ code.</p> <tt>__has_extension(cxx_alias_templates)</tt> to determine if support for C++0x's alias declarations and alias templates is enabled.</p> +<h4 id="cxx_alignas">C++0x alignment specifiers</h4> + +<p>Use <tt>__has_feature(cxx_alignas)</tt> or +<tt>__has_extension(cxx_alignas)</tt> to determine if support for alignment +specifiers using <tt>alignas</tt> is enabled.</p> + <h4 id="cxx_attributes">C++0x attributes</h4> <p>Use <tt>__has_feature(cxx_attributes)</tt> or <tt>__has_extension(cxx_attributes)</tt> to determine if support for attribute parsing with C++0x's square bracket notation is enabled.</p> +<h4 id="cxx_constexpr">C++0x generalized constant expressions</h4> + +<p>Use <tt>__has_feature(cxx_constexpr)</tt> to determine if support +for generalized constant expressions (e.g., <tt>constexpr</tt>) is +enabled. Clang does not currently implement this feature.</p> + +<h4 id="cxx_decltype">C++0x <tt>decltype()</tt></h4> + +<p>Use <tt>__has_feature(cxx_decltype)</tt> or +<tt>__has_extension(cxx_decltype)</tt> to determine if support for the +<tt>decltype()</tt> specifier is enabled.</p> + <h4 id="cxx_default_function_template_args">C++0x default template arguments in function templates</h4> <p>Use <tt>__has_feature(cxx_default_function_template_args)</tt> or @@ -455,11 +519,46 @@ support for delegating constructors is enabled.</p> <tt>__has_extension(cxx_deleted_functions)</tt> to determine if support for deleted function definitions (with <tt>= delete</tt>) is enabled.</p> +<h4 id="cxx_explicit_conversions">C++0x explicit conversion functions</h3> +<p>Use <tt>__has_feature(cxx_explicit_conversions)</tt> to determine if support for <tt>explicit</tt> conversion functions is enabled.</p> + +<h4 id="cxx_generalized_initializers">C++0x generalized initializers</h4> + +<p>Use <tt>__has_feature(cxx_generalized_initializers)</tt> to determine if +support for generalized initializers (using braced lists and +<tt>std::initializer_list</tt>) is enabled. Clang does not currently implement +this feature.</p> + +<h4 id="cxx_implicit_moves">C++0x implicit move constructors/assignment operators</h4> + +<p>Use <tt>__has_feature(cxx_implicit_moves)</tt> to determine if Clang will +implicitly generate move constructors and move assignment operators where needed.</p> + +<h4 id="cxx_inheriting_constructors">C++0x inheriting constructors</h4> + +<p>Use <tt>__has_feature(cxx_inheriting_constructors)</tt> to determine if support for inheriting constructors is enabled. Clang does not currently implement this feature.</p> + +<h4 id="cxx_inline_namespaces">C++0x inline namespaces</h4> + +<p>Use <tt>__has_feature(cxx_inline_namespaces)</tt> or +<tt>__has_extension(cxx_inline_namespaces)</tt> to determine if support for +inline namespaces is enabled.</p> + <h4 id="cxx_lambdas">C++0x lambdas</h4> <p>Use <tt>__has_feature(cxx_lambdas)</tt> or <tt>__has_extension(cxx_lambdas)</tt> to determine if support for lambdas -is enabled. clang does not currently implement this feature.</p> +is enabled. Clang does not currently implement this feature.</p> + +<h4 id="cxx_noexcept">C++0x noexcept</h4> + +<p>Use <tt>__has_feature(cxx_noexcept)</tt> or +<tt>__has_extension(cxx_noexcept)</tt> to determine if support for noexcept +exception specifications is enabled.</p> + +<h4 id="cxx_nonstatic_member_init">C++0x in-class non-static data member initialization</h4> + +<p>Use <tt>__has_feature(cxx_nonstatic_member_init)</tt> to determine whether in-class initialization of non-static data members is enabled.</p> <h4 id="cxx_nullptr">C++0x <tt>nullptr</tt></h4> @@ -486,6 +585,9 @@ is enabled.</p> <tt>__has_extension(cxx_range_for)</tt> to determine if support for the range-based for loop is enabled. </p> +<h4 id="cxx_raw_string_literals">C++0x raw string literals</h4> +<p>Use <tt>__has_feature(cxx_raw_string_literals)</tt> to determine if support for raw string literals (e.g., <tt>R"foo\bar"</tt>) is enabled.</p> + <h4 id="cxx_rvalue_references">C++0x rvalue references</h4> <p>Use <tt>__has_feature(cxx_rvalue_references)</tt> or @@ -505,17 +607,11 @@ compile-time assertions using <tt>static_assert</tt> is enabled.</p> supported using the <tt>auto</tt> specifier. If this is disabled, <tt>auto</tt> will instead be a storage class specifier, as in C or C++98.</p> -<h4 id="cxx_variadic_templates">C++0x variadic templates</h4> - -<p>Use <tt>__has_feature(cxx_variadic_templates)</tt> or -<tt>__has_extension(cxx_variadic_templates)</tt> to determine if support -for variadic templates is enabled.</p> - -<h4 id="cxx_inline_namespaces">C++0x inline namespaces</h4> +<h4 id="cxx_strong_enums">C++0x strongly typed enumerations</h4> -<p>Use <tt>__has_feature(cxx_inline_namespaces)</tt> or -<tt>__has_extension(cxx_inline_namespaces)</tt> to determine if support for -inline namespaces is enabled.</p> +<p>Use <tt>__has_feature(cxx_strong_enums)</tt> or +<tt>__has_extension(cxx_strong_enums)</tt> to determine if support for +strongly typed, scoped enumerations is enabled.</p> <h4 id="cxx_trailing_return">C++0x trailing return type</h4> @@ -523,17 +619,23 @@ inline namespaces is enabled.</p> <tt>__has_extension(cxx_trailing_return)</tt> to determine if support for the alternate function declaration syntax with trailing return type is enabled.</p> -<h4 id="cxx_noexcept">C++0x noexcept</h4> +<h4 id="cxx_unicode_literals">C++0x Unicode string literals</h4> +<p>Use <tt>__has_feature(cxx_unicode_literals)</tt> to determine if +support for Unicode string literals is enabled.</p> -<p>Use <tt>__has_feature(cxx_noexcept)</tt> or -<tt>__has_extension(cxx_noexcept)</tt> to determine if support for noexcept -exception specifications is enabled.</p> +<h4 id="cxx_unrestricted_unions">C++0x unrestricted unions</h4> -<h4 id="cxx_strong_enums">C++0x strongly typed enumerations</h4> +<p>Use <tt>__has_feature(cxx_unrestricted_unions)</tt> to determine if support for unrestricted unions is enabled. Clang does not currently support this feature.</p> -<p>Use <tt>__has_feature(cxx_strong_enums)</tt> or -<tt>__has_extension(cxx_strong_enums)</tt> to determine if support for -strongly typed, scoped enumerations is enabled.</p> +<h4 id="cxx_user_literals">C++0x user-defined literals</h4> + +<p>Use <tt>__has_feature(cxx_user_literals)</tt> to determine if support for user-defined literals is enabled. Clang does not currently support this feature.</p> + +<h4 id="cxx_variadic_templates">C++0x variadic templates</h4> + +<p>Use <tt>__has_feature(cxx_variadic_templates)</tt> or +<tt>__has_extension(cxx_variadic_templates)</tt> to determine if support +for variadic templates is enabled.</p> <h3 id="c1x">C1X</h3> @@ -541,6 +643,12 @@ strongly typed, scoped enumerations is enabled.</p> C1X standard. As a result, all these features are enabled with the <tt>-std=c1x</tt> option when compiling C code.</p> +<h4 id="c_alignas">C1X alignment specifiers</h4> + +<p>Use <tt>__has_feature(c_alignas)</tt> or <tt>__has_extension(c_alignas)</tt> +to determine if support for alignment specifiers using <tt>_Alignas</tt> +is enabled.</p> + <h4 id="c_generic_selections">C1X generic selections</h4> <p>Use <tt>__has_feature(c_generic_selections)</tt> or @@ -599,6 +707,7 @@ struct is_convertible_to { <li><code>__is_polymorphic</code> (GNU, Microsoft)</li> <li><code>__is_union</code> (GNU, Microsoft)</li> <li><code>__is_literal(type)</code>: Determines whether the given type is a literal type</li> + <li><code>__underlying_type(type)</code>: Retrieves the underlying type for a given <code>enum</code> type. This trait is required to implement the C++0x standard library.</li> </ul> <!-- ======================================================================= --> @@ -648,7 +757,19 @@ related result type. Similarly, the type of the expression <code>init</code> has a related result type and its receiver is known to have the type <code>NSArray *</code>. If neither <code>alloc</code> nor <code>init</code> had a related result type, the expressions would have had type <code>id</code>, as declared in the method signature.</p> -<p>To determine whether a method has a related result type, the first +<p>A method with a related result type can be declared by using the +type <tt>instancetype</tt> as its result type. <tt>instancetype</tt> +is a contextual keyword that is only permitted in the result type of +an Objective-C method, e.g.</p> + +<pre> +@interface A ++ (<b>instancetype</b>)constructAnA; +@end +</pre> + +<p>The related result type can also be inferred for some methods. +To determine whether a method has an inferred related result type, the first word in the camel-case selector (e.g., "init" in "initWithObjects") is considered, and the method will a related result type if its return type is compatible with the type of its class and if</p> @@ -677,8 +798,11 @@ with the subclass type. For example:</p> <p>Related result types only affect the type of a message send or property access via the given method. In all other respects, a method -with a related result type is treated the same way as method without a -related result type.</p> +with a related result type is treated the same way as method that +returns <tt>id</tt>.</p> + +<p>Use <tt>__has_feature(objc_instancetype)</tt> to determine whether +the <tt>instancetype</tt> contextual keyword is available.</p> <!-- ======================================================================= --> <h2 id="objc_arc">Automatic reference counting </h2> @@ -687,6 +811,24 @@ related result type.</p> <p>Clang provides support for <a href="AutomaticReferenceCounting.html">automated reference counting</a> in Objective-C, which eliminates the need for manual retain/release/autorelease message sends. There are two feature macros associated with automatic reference counting: <code>__has_feature(objc_arc)</code> indicates the availability of automated reference counting in general, while <code>__has_feature(objc_arc_weak)</code> indicates that automated reference counting also includes support for <code>__weak</code> pointers to Objective-C objects.</p> <!-- ======================================================================= --> +<h2 id="objc_fixed_enum">Enumerations with a fixed underlying type</h2> +<!-- ======================================================================= --> + +<p>Clang provides support for C++0x enumerations with a fixed +underlying type within Objective-C. For example, one can write an +enumeration type as:</p> + +<pre> +typedef enum : unsigned char { Red, Green, Blue } Color; +</pre> + +<p>This specifies that the underlying type, which is used to store the +enumeration value, is <tt>unsigned char</tt>.</p> + +<p>Use <tt>__has_feature(objc_fixed_enum)</tt> to determine whether +support for fixed underlying types is available in Objective-C.</p> + +<!-- ======================================================================= --> <h2 id="overloading-in-c">Function Overloading in C</h2> <!-- ======================================================================= --> @@ -786,6 +928,41 @@ caveats to this use of name mangling:</p> <p>Query for this feature with __has_extension(attribute_overloadable).</p> +<!-- ======================================================================= --> +<h2 id="complex-list-init">Initializer lists for complex numbers in C</h2> +<!-- ======================================================================= --> + +<p>clang supports an extension which allows the following in C:</p> + +<blockquote> +<pre> +#include <math.h> +#include <complex.h> +complex float x = { 1.0f, INFINITY }; // Init to (1, Inf) +</pre> +</blockquote> + +<p>This construct is useful because there is no way to separately +initialize the real and imaginary parts of a complex variable in +standard C, given that clang does not support <code>_Imaginary</code>. +(clang also supports the <code>__real__</code> and <code>__imag__</code> +extensions from gcc, which help in some cases, but are not usable in +static initializers.) + +<p>Note that this extension does not allow eliding the braces; the +meaning of the following two lines is different:</p> + +<blockquote> +<pre> +complex float x[] = { { 1.0f, 1.0f } }; // [0] = (1, 1) +complex float x[] = { 1.0f, 1.0f }; // [0] = (1, 0), [1] = (1, 0) +</pre> +</blockquote> + +<p>This extension also works in C++ mode, as far as that goes, but does not + apply to the C++ <code>std::complex</code>. (In C++11, list + initialization allows the same syntax to be used with + <code>std::complex</code> with the same meaning.) <!-- ======================================================================= --> <h2 id="builtins">Builtin Functions</h2> @@ -1087,6 +1264,149 @@ balance in some way.</p> <p>Query for these features with <tt>__has_attribute(ns_consumed)</tt>, <tt>__has_attribute(ns_returns_retained)</tt>, etc.</p> + +<!-- ======================================================================= --> +<h2 id="threadsafety">Thread-Safety Annotation Checking</h2> +<!-- ======================================================================= --> + +<p>Clang supports additional attributes for checking basic locking policies in +multithreaded programs. +Clang currently parses the following list of attributes, although +<b>the implementation for these annotations is currently in development.</b> +For more details, see the +<a href="http://gcc.gnu.org/wiki/ThreadSafetyAnnotation">GCC implementation</a>. +</p> + +<h4 id="ts_noanal">no_thread_safety_analysis</h4> + +<p>Use <tt>__attribute__((no_thread_safety_analysis))</tt> on a function +declaration to specify that the thread safety analysis should not be run on that +function. This attribute provides an escape hatch (e.g. for situations when it +is difficult to annotate the locking policy). </p> + +<h4 id="ts_lockable">lockable</h4> + +<p>Use <tt>__attribute__((lockable))</tt> on a class definition to specify +that it has a lockable type (e.g. a Mutex class). This annotation is primarily +used to check consistency.</p> + +<h4 id="ts_scopedlockable">scoped_lockable</h4> + +<p>Use <tt>__attribute__((scoped_lockable))</tt> on a class definition to +specify that it has a "scoped" lockable type. Objects of this type will acquire +the lock upon construction and release it upon going out of scope. + This annotation is primarily used to check +consistency.</p> + +<h4 id="ts_guardedvar">guarded_var</h4> + +<p>Use <tt>__attribute__((guarded_var))</tt> on a variable declaration to +specify that the variable must be accessed while holding some lock.</p> + +<h4 id="ts_ptguardedvar">pt_guarded_var</h4> + +<p>Use <tt>__attribute__((pt_guarded_var))</tt> on a pointer declaration to +specify that the pointer must be dereferenced while holding some lock.</p> + +<h4 id="ts_guardedby">guarded_by(l)</h4> + +<p>Use <tt>__attribute__((guarded_by(l)))</tt> on a variable declaration to +specify that the variable must be accessed while holding lock <tt>l</tt>.</p> + +<h4 id="ts_ptguardedby">pt_guarded_by(l)</h4> + +<p>Use <tt>__attribute__((pt_guarded_by(l)))</tt> on a pointer declaration to +specify that the pointer must be dereferenced while holding lock <tt>l</tt>.</p> + +<h4 id="ts_acquiredbefore">acquired_before(...)</h4> + +<p>Use <tt>__attribute__((acquired_before(...)))</tt> on a declaration +of a lockable variable to specify that the lock must be acquired before all +attribute arguments. Arguments must be lockable type, and there must be at +least one argument.</p> + +<h4 id="ts_acquiredafter">acquired_after(...)</h4> + +<p>Use <tt>__attribute__((acquired_after(...)))</tt> on a declaration +of a lockable variable to specify that the lock must be acquired after all +attribute arguments. Arguments must be lockable type, and there must be at +least one argument.</p> + +<h4 id="ts_elf">exclusive_lock_function(...)</h4> + +<p>Use <tt>__attribute__((exclusive_lock_function(...)))</tt> on a function +declaration to specify that the function acquires all listed locks +exclusively. This attribute takes zero or more arguments: either of lockable +type or integers indexing into function parameters of lockable type. If no +arguments are given, the acquired lock is implicitly <tt>this</tt> of the +enclosing object.</p> + +<h4 id="ts_slf">shared_lock_function(...)</h4> + +<p>Use <tt>__attribute__((shared_lock_function(...)))</tt> on a function +declaration to specify that the function acquires all listed locks, although + the locks may be shared (e.g. read locks). This attribute takes zero or more +arguments: either of lockable type or integers indexing into function +parameters of lockable type. If no arguments are given, the acquired lock is +implicitly <tt>this</tt> of the enclosing object.</p> + +<h4 id="ts_etf">exclusive_trylock_function(...)</h4> + +<p>Use <tt>__attribute__((exclusive_lock_function(...)))</tt> on a function +declaration to specify that the function will try (without blocking) to acquire +all listed locks exclusively. This attribute takes one or more arguments. The +first argument is an integer or boolean value specifying the return value of a +successful lock acquisition. The remaining arugments are either of lockable type +or integers indexing into function parameters of lockable type. If only one +argument is given, the acquired lock is implicitly <tt>this</tt> of the +enclosing object.</p> + +<h4 id="ts_stf">shared_trylock_function(...)</h4> + +<p>Use <tt>__attribute__((shared_lock_function(...)))</tt> on a function +declaration to specify that the function will try (without blocking) to acquire +all listed locks, although the locks may be shared (e.g. read locks). This +attribute takes one or more arguments. The first argument is an integer or +boolean value specifying the return value of a successful lock acquisition. The +remaining arugments are either of lockable type or integers indexing into +function parameters of lockable type. If only one argument is given, the +acquired lock is implicitly <tt>this</tt> of the enclosing object.</p> + +<h4 id="ts_uf">unlock_function(...)</h4> + +<p>Use <tt>__attribute__((unlock_function(...)))</tt> on a function +declaration to specify that the function release all listed locks. This +attribute takes zero or more arguments: either of lockable type or integers +indexing into function parameters of lockable type. If no arguments are given, +the acquired lock is implicitly <tt>this</tt> of the enclosing object.</p> + +<h4 id="ts_lr">lock_returned(l)</h4> + +<p>Use <tt>__attribute__((lock_returned(l)))</tt> on a function +declaration to specify that the function returns lock <tt>l</tt> (<tt>l</tt> +must be of lockable type). This annotation is used to aid in resolving lock +expressions.</p> + +<h4 id="ts_le">locks_excluded(...)</h4> + +<p>Use <tt>__attribute__((locks_excluded(...)))</tt> on a function declaration +to specify that the function must not be called with the listed locks. Arguments +must be lockable type, and there must be at least one argument.</p> + +<h4 id="ts_elr">exclusive_locks_required(...)</h4> + +<p>Use <tt>__attribute__((exclusive_locks_required(...)))</tt> on a function +declaration to specify that the function must be called while holding the listed +exclusive locks. Arguments must be lockable type, and there must be at +least one argument.</p> + +<h4 id="ts_slr">shared_locks_required(...)</h4> + +<p>Use <tt>__attribute__((shared_locks_required(...)))</tt> on a function +declaration to specify that the function must be called while holding the listed +shared locks. Arguments must be lockable type, and there must be at +least one argument.</p> + </div> </body> </html> |