summaryrefslogtreecommitdiffstats
path: root/clang/docs/LanguageExtensions.html
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2010-10-20 02:31:43 +0000
committerAnders Carlsson <andersca@mac.com>2010-10-20 02:31:43 +0000
commit274a70ed7f4315c83273173fce4c3b0e097958d6 (patch)
treefccdd5042be19eff3d1c109477cdf047af8c70b8 /clang/docs/LanguageExtensions.html
parent23c8341c3dfbb9b453cc3857eabc2405207887cf (diff)
downloadbcm5719-llvm-274a70ed7f4315c83273173fce4c3b0e097958d6.tar.gz
bcm5719-llvm-274a70ed7f4315c83273173fce4c3b0e097958d6.zip
Add a __has_attribute macro that works much like __has_feature and __has_builtin.
llvm-svn: 116906
Diffstat (limited to 'clang/docs/LanguageExtensions.html')
-rw-r--r--clang/docs/LanguageExtensions.html24
1 files changed, 24 insertions, 0 deletions
diff --git a/clang/docs/LanguageExtensions.html b/clang/docs/LanguageExtensions.html
index 27d90c5cd3c..f27a5705398 100644
--- a/clang/docs/LanguageExtensions.html
+++ b/clang/docs/LanguageExtensions.html
@@ -136,6 +136,30 @@ can be used like this:</p>
<p>The feature tag is described along with the language feature below.</p>
<!-- ======================================================================= -->
+<h3 id="__has_attribute">__has_attribute</h3>
+<!-- ======================================================================= -->
+
+<p>This function-like macro takes a single identifier argument that is the name
+of an attribute. It evaluates to 1 if the attribute is supported or 0 if not. It
+can be used like this:</p>
+
+<blockquote>
+<pre>
+#ifndef __has_attribute // Optional of course.
+ #define __has_attribute(x) 0 // Compatibility with non-clang compilers.
+#endif
+
+...
+#if __has_attribute(override) || \
+#define OVERRIDE __attribute__((override))
+#else
+#define OVERRIDE
+#endif
+...
+</pre>
+</blockquote>
+
+<!-- ======================================================================= -->
<h2 id="has_include">Include File Checking Macros</h2>
<!-- ======================================================================= -->
OpenPOWER on IntegriCloud