* [wwwdocs] Document __has_attribute in /gcc-5/changes.html
@ 2015-03-11 18:09 Jonathan Wakely
2015-03-11 18:16 ` Jakub Jelinek
0 siblings, 1 reply; 7+ messages in thread
From: Jonathan Wakely @ 2015-03-11 18:09 UTC (permalink / raw)
To: gcc-patches; +Cc: Ed Smith-Rowland
[-- Attachment #1: Type: text/plain, Size: 153 bytes --]
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.
[-- Attachment #2: patch.txt --]
[-- Type: text/x-patch, Size: 1612 bytes --]
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>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [wwwdocs] Document __has_attribute in /gcc-5/changes.html
2015-03-11 18:09 [wwwdocs] Document __has_attribute in /gcc-5/changes.html Jonathan Wakely
@ 2015-03-11 18:16 ` Jakub Jelinek
2015-03-11 18:42 ` Jonathan Wakely
0 siblings, 1 reply; 7+ messages in thread
From: Jakub Jelinek @ 2015-03-11 18:16 UTC (permalink / raw)
To: Jonathan Wakely; +Cc: gcc-patches, Ed Smith-Rowland
On Wed, Mar 11, 2015 at 06:09:11PM +0000, Jonathan Wakely wrote:
> 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,
Can you please instead write built-in function-like macro?
> + <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>
Jakub
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [wwwdocs] Document __has_attribute in /gcc-5/changes.html
2015-03-11 18:16 ` Jakub Jelinek
@ 2015-03-11 18:42 ` Jonathan Wakely
2015-04-07 8:38 ` Gerald Pfeifer
0 siblings, 1 reply; 7+ messages in thread
From: Jonathan Wakely @ 2015-03-11 18:42 UTC (permalink / raw)
To: Jakub Jelinek; +Cc: gcc-patches, Ed Smith-Rowland
[-- Attachment #1: Type: text/plain, Size: 927 bytes --]
On 11/03/15 19:14 +0100, Jakub Jelinek wrote:
>On Wed, Mar 11, 2015 at 06:09:11PM +0000, Jonathan Wakely wrote:
>> 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,
>
>Can you please instead write built-in function-like macro?
Yep, revised patch attached.
[-- Attachment #2: patch.txt --]
[-- Type: text/x-patch, Size: 1618 bytes --]
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:41:25 -0000
@@ -189,6 +189,30 @@
of the standard directive <code>#include</code>
and the extension <code>#include_next</code> respectively.
</li>
+ <li>A new built-in function-like macro to detect the existence of an
+ attribute, <code>__has_attribute</code>, has been added.
+ The equivalent built-in macro <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 macro <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>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [wwwdocs] Document __has_attribute in /gcc-5/changes.html
2015-03-11 18:42 ` Jonathan Wakely
@ 2015-04-07 8:38 ` Gerald Pfeifer
2015-04-07 8:41 ` Jakub Jelinek
2015-04-07 9:10 ` Jonathan Wakely
0 siblings, 2 replies; 7+ messages in thread
From: Gerald Pfeifer @ 2015-04-07 8:38 UTC (permalink / raw)
To: Jonathan Wakely; +Cc: Jakub Jelinek, gcc-patches, Ed Smith-Rowland
Hi Jonathan,
On Wed, 11 Mar 2015, Jonathan Wakely wrote:
> Yep, revised patch attached.
reading this update, there are some changes I'd like to suggest.
Some (or all ;-) may be disagreeable; they all stem from me
trying to understand this update.
One question: where it refers to __has_attribute returning a
date in some cases, would it make sense to provide an example
or show the format?
By the way, gcc/doc/ does not seem to contain any documentation
of this macro? Shouldn't that be described there?
Gerald
Index: gcc-5/changes.html
===================================================================
RCS file: /cvs/gcc/wwwdocs/htdocs/gcc-5/changes.html,v
retrieving revision 1.94
diff -u -r1.94 changes.html
--- gcc-5/changes.html 6 Apr 2015 12:56:40 -0000 1.94
+++ gcc-5/changes.html 7 Apr 2015 08:33:27 -0000
@@ -253,7 +253,7 @@
of the standard directive <code>#include</code>
and the extension <code>#include_next</code> respectively.
</li>
- <li>A new built-in function-like macro to detect the existence of an
+ <li>A new built-in function-like macro to determine the existence of an
attribute, <code>__has_attribute</code>, has been added.
The equivalent built-in macro <code>__has_cpp_attribute</code> was
added to C++ to support
@@ -270,11 +270,11 @@
#endif
foo(int x);
</pre></blockquote>
- If an attribute exists a nonzero constant integer is returned.
+ 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.
+ The <code>has_attribute</code> macro 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
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [wwwdocs] Document __has_attribute in /gcc-5/changes.html
2015-04-07 8:38 ` Gerald Pfeifer
@ 2015-04-07 8:41 ` Jakub Jelinek
2015-04-07 9:10 ` Jonathan Wakely
1 sibling, 0 replies; 7+ messages in thread
From: Jakub Jelinek @ 2015-04-07 8:41 UTC (permalink / raw)
To: Gerald Pfeifer; +Cc: Jonathan Wakely, gcc-patches, Ed Smith-Rowland
On Tue, Apr 07, 2015 at 10:38:09AM +0200, Gerald Pfeifer wrote:
> - The has_attribute macros will add underscores to an attribute name
> - if necessary to resolve the name.
> + The <code>has_attribute</code> macro will add underscores to an
> + attribute name if necessary to resolve the name.
This change looks problematic to me, as there is no has_attribute macro,
the "has_attribute macros" phrase was meant to stand for
"<code>__has_attribute</code> and <code>__has_cpp_attribute</code> macros".
For <code> I assume we want exact spelling.
Jakub
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [wwwdocs] Document __has_attribute in /gcc-5/changes.html
2015-04-07 8:38 ` Gerald Pfeifer
2015-04-07 8:41 ` Jakub Jelinek
@ 2015-04-07 9:10 ` Jonathan Wakely
2015-04-09 23:28 ` Gerald Pfeifer
1 sibling, 1 reply; 7+ messages in thread
From: Jonathan Wakely @ 2015-04-07 9:10 UTC (permalink / raw)
To: Gerald Pfeifer; +Cc: Jakub Jelinek, gcc-patches, Ed Smith-Rowland
On 07/04/15 10:38 +0200, Gerald Pfeifer wrote:
>One question: where it refers to __has_attribute returning a
>date in some cases, would it make sense to provide an example
>or show the format?
The referenced SD-6 document shows the values and format:
http://isocpp.org/std/standing-documents/sd-6-sg10-feature-test-recommendations
I would expect that most people using the macros are going to be
referring to that document anyway.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [wwwdocs] Document __has_attribute in /gcc-5/changes.html
2015-04-07 9:10 ` Jonathan Wakely
@ 2015-04-09 23:28 ` Gerald Pfeifer
0 siblings, 0 replies; 7+ messages in thread
From: Gerald Pfeifer @ 2015-04-09 23:28 UTC (permalink / raw)
To: Jakub Jelinek, Jonathan Wakely; +Cc: gcc-patches, Ed Smith-Rowland
On Tue, 7 Apr 2015, Jakub Jelinek wrote:
> This change looks problematic to me, as there is no has_attribute macro,
> the "has_attribute macros" phrase was meant to stand for
> "<code>__has_attribute</code> and <code>__has_cpp_attribute</code> macros".
> For <code> I assume we want exact spelling.
Yes, that's a very good point.
On Tue, 7 Apr 2015, Jonathan Wakely wrote:
> The referenced SD-6 document shows the values and format:
> http://isocpp.org/std/standing-documents/sd-6-sg10-feature-test-recommendations
>
> I would expect that most people using the macros are going to be
> referring to that document anyway.
This is a fair point as well.
Thanks for your feedback, Jakub and Jonathan. This is what I
just committed.
Gerald
Index: changes.html
===================================================================
RCS file: /cvs/gcc/wwwdocs/htdocs/gcc-5/changes.html,v
retrieving revision 1.99
diff -u -r1.99 changes.html
--- changes.html 9 Apr 2015 15:05:01 -0000 1.99
+++ changes.html 9 Apr 2015 23:26:37 -0000
@@ -262,7 +262,7 @@
of the standard directive <code>#include</code>
and the extension <code>#include_next</code> respectively.
</li>
- <li>A new built-in function-like macro to detect the existence of an
+ <li>A new built-in function-like macro to determine the existence of an
attribute, <code>__has_attribute</code>, has been added.
The equivalent built-in macro <code>__has_cpp_attribute</code> was
added to C++ to support
@@ -279,11 +279,12 @@
#endif
foo(int x);
</pre></blockquote>
- If an attribute exists a nonzero constant integer is returned.
+ 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.
+ Both <code>__has_attribute</code> and
+ <code>__has_cpp_attribute</code> 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
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2015-04-09 23:28 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-11 18:09 [wwwdocs] Document __has_attribute in /gcc-5/changes.html Jonathan Wakely
2015-03-11 18:16 ` Jakub Jelinek
2015-03-11 18:42 ` Jonathan Wakely
2015-04-07 8:38 ` Gerald Pfeifer
2015-04-07 8:41 ` Jakub Jelinek
2015-04-07 9:10 ` Jonathan Wakely
2015-04-09 23:28 ` Gerald Pfeifer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).