diff options
-rw-r--r-- | clang/docs/LanguageExtensions.rst | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/clang/docs/LanguageExtensions.rst b/clang/docs/LanguageExtensions.rst index 54f67ce2801..928b09524b2 100644 --- a/clang/docs/LanguageExtensions.rst +++ b/clang/docs/LanguageExtensions.rst @@ -159,12 +159,16 @@ include paths, or 0 otherwise: # include "myinclude.h" #endif +To test for this feature, use ``#if defined(__has_include)``: + +.. code-block:: c++ + // To avoid problem with non-clang compilers not having this macro. - #if defined(__has_include) && __has_include("myinclude.h") + #if defined(__has_include) + #if __has_include("myinclude.h") # include "myinclude.h" #endif - -To test for this feature, use ``#if defined(__has_include)``. + #endif .. _langext-__has_include_next: @@ -185,9 +189,11 @@ or 0 otherwise: #endif // To avoid problem with non-clang compilers not having this macro. - #if defined(__has_include_next) && __has_include_next("myinclude.h") + #if defined(__has_include_next) + #if __has_include_next("myinclude.h") # include_next "myinclude.h" #endif + #endif Note that ``__has_include_next``, like the GNU extension ``#include_next`` directive, is intended for use in headers only, and will issue a warning if @@ -1695,7 +1701,7 @@ are accepted with the ``__attribute__((foo))`` syntax are also accepted as <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 +<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. |