diff options
author | Anders Carlsson <andersca@mac.com> | 2010-10-20 02:31:43 +0000 |
---|---|---|
committer | Anders Carlsson <andersca@mac.com> | 2010-10-20 02:31:43 +0000 |
commit | cae5095c116c29a4e52c91fa0ad88df09dd2b45f (patch) | |
tree | 0edd3015a3b1a42dc4e51ce7e1c565924b880597 /docs/LanguageExtensions.html | |
parent | 06ff47b0bbd6d311745010bf4d83ff394502ac0e (diff) |
Add a __has_attribute macro that works much like __has_feature and __has_builtin.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116906 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'docs/LanguageExtensions.html')
-rw-r--r-- | docs/LanguageExtensions.html | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/docs/LanguageExtensions.html b/docs/LanguageExtensions.html index 27d90c5cd3..f27a570539 100644 --- a/docs/LanguageExtensions.html +++ b/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> <!-- ======================================================================= --> |