diff options
author | Douglas Gregor <dgregor@apple.com> | 2013-01-16 01:12:31 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2013-01-16 01:12:31 +0000 |
commit | 52fb37a52c73d16f129b3f3bda698cda087f9b93 (patch) | |
tree | 74a11d52a1b657b6cc571d975c9c4de28bf31b2c /docs | |
parent | 72daa3f2de226952825f19d7e60a3e9d77ea8c81 (diff) |
Document the redeclaration and overriding restrictions on the
availability attribute.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172587 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'docs')
-rw-r--r-- | docs/LanguageExtensions.rst | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/docs/LanguageExtensions.rst b/docs/LanguageExtensions.rst index 16af7e3099..c985b7567b 100644 --- a/docs/LanguageExtensions.rst +++ b/docs/LanguageExtensions.rst @@ -439,7 +439,7 @@ succeeds but Clang emits a warning specifying that the function is deprecated. Finally, if Clang is instructed to compile code for Mac OS X 10.7, the call fails because ``f()`` is no longer available. -The availablility attribute is a comma-separated list starting with the +The availability attribute is a comma-separated list starting with the platform name and then including clauses specifying important milestones in the declaration's lifetime (in any order) along with additional information. Those clauses can be: @@ -488,6 +488,33 @@ weakly-linked declaration may or may not be present a run-time, and a program can determine whether the declaration is present by checking whether the address of that declaration is non-NULL. +If there a multiple declarations of the same entity, the availability +attributes must either match on a per-platform basis or later +declarations must not have availability attributes for that +platform. For example: + +.. code-block:: c + + void g(void) __attribute__((availability(macosx,introduced=10.4))); + void g(void) __attribute__((availability(macosx,introduced=10.4))); // okay, matches + void g(void) __attribute__((availability(ios,introduced=4.0))); // okay, adds a new platform + void g(void); // okay, inherits both macosx and ios availability from above. + void g(void) __attribute__((availability(macosx,introduced=10.5))); // error: mismatch + +When one method overrides another, the overriding method can be more widely available than the overridden method, e.g.,: + +.. code-block:: objc + + @interface A + - (id)method __attribute__((availability(macosx,introduced=10.4))); + - (id)method2 __attribute__((availability(macosx,introduced=10.4))); + @end + + @interface B : A + - (id)method __attribute__((availability(macosx,introduced=10.3))); // okay: method moved into base class later + - (id)method __attribute__((availability(macosx,introduced=10.5))); // error: this method was available via the base class in 10.4 + @end + Checks for Standard Language Features ===================================== |