summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2013-01-16 01:12:31 +0000
committerDouglas Gregor <dgregor@apple.com>2013-01-16 01:12:31 +0000
commit250ee635157a7682878e37d77974719c16fa69b7 (patch)
tree36a7412179e61e57fdaa1f86ef29ea61ed6b689d
parent43dc0c7d60c4aec6b2fee9f9b8bc5baf77d90841 (diff)
downloadbcm5719-llvm-250ee635157a7682878e37d77974719c16fa69b7.tar.gz
bcm5719-llvm-250ee635157a7682878e37d77974719c16fa69b7.zip
Document the redeclaration and overriding restrictions on the
availability attribute. llvm-svn: 172587
-rw-r--r--clang/docs/LanguageExtensions.rst29
1 files changed, 28 insertions, 1 deletions
diff --git a/clang/docs/LanguageExtensions.rst b/clang/docs/LanguageExtensions.rst
index 16af7e30991..c985b7567bf 100644
--- a/clang/docs/LanguageExtensions.rst
+++ b/clang/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
=====================================
OpenPOWER on IntegriCloud