This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[wwwdocs] Document __has_attribute in /gcc-5/changes.html
- From: Jonathan Wakely <jwakely at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Cc: Ed Smith-Rowland <3dw4rd at verizon dot net>
- Date: Wed, 11 Mar 2015 18:09:11 +0000
- Subject: [wwwdocs] Document __has_attribute in /gcc-5/changes.html
- Authentication-results: sourceware.org; auth=none
This is a slightly-modified version of Ed's patch from
https://gcc.gnu.org/ml/gcc-patches/2015-01/msg02357.html which I plan
to commit to CVS tomorrow.
Index: changes.html
===================================================================
RCS file: /cvs/gcc/wwwdocs/htdocs/gcc-5/changes.html,v
retrieving revision 1.88
diff -u -r1.88 changes.html
--- changes.html 10 Mar 2015 17:34:36 -0000 1.88
+++ changes.html 11 Mar 2015 18:06:52 -0000
@@ -189,6 +189,29 @@
of the standard directive <code>#include</code>
and the extension <code>#include_next</code> respectively.
</li>
+ <li>A new built-in function to detect the existence of an attribute,
+ <code>__has_attribute</code>, has been added. The equivalent built-in
+ function <code>__has_cpp_attribute</code> was added to C++ to support
+ <a href="http://isocpp.org/std/standing-documents/sd-6-sg10-feature-test-recommendations">
+ Feature-testing recommendations for C++</a>.
+ The function <code>__has_attribute</code> is added to all C-like
+ languages as an extension:
+<blockquote><pre>
+int
+#ifdef __has_attribute
+# if __has_attribute(__noinline__)
+ __attribute__((__noinline__))
+# endif
+#endif
+foo(int x);
+</pre></blockquote>
+ If an attribute exists a nonzero constant integer is returned.
+ For standardized C++ attributes a date is returned, otherwise the
+ constant returned is 1.
+ The has_attribute macros will add underscores to an attribute name
+ if necessary to resolve the name.
+ For C++11 and onwards the attribute may be scoped.
+ </li>
<li>A new set of built-in functions for arithmetics with overflow checking
has been added: <code>__builtin_add_overflow</code>,
<code>__builtin_sub_overflow</code> and <code>__builtin_mul_overflow</code>