diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2013-02-14 00:13:34 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2013-02-14 00:13:34 +0000 |
commit | 6f488191a3a82b19e5854b15b0d56e5a5fb6cf80 (patch) | |
tree | 394850284248762f223afc8e35193c42991d7798 | |
parent | 8c42a67645145a7673d0313da7dcbab2b66f5611 (diff) |
Document Clang's support for [[gnu::...]] attributes.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175110 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | docs/LanguageExtensions.rst | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/docs/LanguageExtensions.rst b/docs/LanguageExtensions.rst index f32c46bf43..b069144bfc 100644 --- a/docs/LanguageExtensions.rst +++ b/docs/LanguageExtensions.rst @@ -1488,8 +1488,8 @@ C11's ``<stdatomic.h>`` header. These builtins provide the semantics of the Non-standard C++11 Attributes ============================= -Clang supports one non-standard C++11 attribute. It resides in the ``clang`` -attribute namespace. +Clang's non-standard C++11 attributes live in the ``clang`` attribute +namespace. The ``clang::fallthrough`` attribute ------------------------------------ @@ -1536,6 +1536,28 @@ Here is an example: r(); } +``gnu::`` attributes +-------------------- + +Clang also supports GCC's ``gnu`` attribute namespace. All GCC attributes which +are accepted with the ``__attribute__((foo))`` syntax are also accepted as +``[[gnu::foo]]``. This only extends to attributes which are specified by GCC +(see the list of `GCC function attributes +<http://gcc.gnu.org/onlinedocs/gcc/Function-Attributes.html>`_, `GCC variable +attributes <http://gcc.gnu.org/onlinedocs/gcc/Variable-Attributes.html>`_, and +`GCC type attributes +<http://gcc.gnu.org/onlinedocs/gcc/Type-Attributes.html>`_. As with the GCC +implementation, these attributes must appertain to the *declarator-id* in a +declaration, which means they must go either at the start of the declaration or +immediately after the name being declared. + +For example, this applies the GNU ``unused`` attribute to ``a`` and ``f``, and +also applies the GNU ``noreturn`` attribute to ``f``. + +.. code-block:: c++ + + [[gnu::unused]] int a, f [[gnu::noreturn]] (); + Target-Specific Extensions ========================== |