]> granicus.if.org Git - clang/commitdiff
Update cf_returns_retained/ns_returns_retained examples to use __has_feature.
authorTed Kremenek <kremenek@apple.com>
Fri, 17 Jul 2009 00:25:49 +0000 (00:25 +0000)
committerTed Kremenek <kremenek@apple.com>
Fri, 17 Jul 2009 00:25:49 +0000 (00:25 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76130 91177308-0d34-0410-b5e6-96231b3b80d8

www/analyzer/annotations.html

index e49c327edd28e2f9fd342f863eb87663d7e83d83..819886e822cfe309d34bbcf754cc262570d36d52 100644 (file)
@@ -152,8 +152,12 @@ use 'cf_returns_retained'.</p>
 <span class="command">$ cat test.m</span>
 #import &lt;Foundation/Foundation.h&gt;
 
+#ifndef __has_feature      // Optional.
+#define __has_feature(x) 0 // Compatibility with non-clang compilers.
+#endif
+
 #ifndef NS_RETURNS_RETAINED
-#if __clang__
+#if __has_feature(attribute_ns_returns_retained)
 <span class="code_highlight">#define NS_RETURNS_RETAINED __attribute__((ns_returns_retained))</span>
 #else
 #define NS_RETURNS_RETAINED
@@ -226,8 +230,12 @@ collection (<tt>-fobjc-gc-only</tt>).</p>
 $ cat test.m
 #import &lt;Cocoa/Cocoa.h&gt;
 
+#ifndef __has_feature      // Optional.
+#define __has_feature(x) 0 // Compatibility with non-clang compilers.
+#endif
+
 #ifndef CF_RETURNS_RETAINED
-#if __clang__
+#if __has_feature(attribute_cf_returns_retained)
 <span class="code_highlight">#define CF_RETURNS_RETAINED __attribute__((cf_returns_retained))</span>
 #else
 #define CF_RETURNS_RETAINED