public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Add a blurb about __has_cpp_attribute and __has_attribute to gcc-5/changes.
@ 2015-01-27  5:44 Ed Smith-Rowland
  2015-03-10 11:47 ` Markus Trippelsdorf
  0 siblings, 1 reply; 3+ messages in thread
From: Ed Smith-Rowland @ 2015-01-27  5:44 UTC (permalink / raw)
  To: Jason Merrill, Gerald Pfeifer, gcc-patches

[-- Attachment #1: Type: text/plain, Size: 240 bytes --]

Gerald,

Could I get a hand on checking in this last addition?

-m 'Add a blurb to htdocs/gcc-5/changes.html to explain the 
__has_cpp_attribute and
the equivalent __has_attribute macros.'

Thanks,

Ed

Sorry, I forgot to add gcc-patches.


[-- Attachment #2: patch_has_attribute --]
[-- Type: text/plain, Size: 1183 bytes --]

Index: htdocs/gcc-5/changes.html
===================================================================
RCS file: /cvs/gcc/wwwdocs/htdocs/gcc-5/changes.html,v
retrieving revision 1.73
diff -r1.73 changes.html
186a187,206
>     <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 functions 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.  Except for
> 	standardized C++ attributes that return dates 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>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Add a blurb about __has_cpp_attribute and __has_attribute to gcc-5/changes.
  2015-01-27  5:44 Add a blurb about __has_cpp_attribute and __has_attribute to gcc-5/changes Ed Smith-Rowland
@ 2015-03-10 11:47 ` Markus Trippelsdorf
  2015-03-10 12:01   ` Jakub Jelinek
  0 siblings, 1 reply; 3+ messages in thread
From: Markus Trippelsdorf @ 2015-03-10 11:47 UTC (permalink / raw)
  To: Ed Smith-Rowland; +Cc: Jason Merrill, Gerald Pfeifer, gcc-patches

On 2015.01.26 at 23:22 -0500, Ed Smith-Rowland wrote:
> Gerald,
> 
> Could I get a hand on checking in this last addition?
> 
> -m 'Add a blurb to htdocs/gcc-5/changes.html to explain the 
> __has_cpp_attribute and
> the equivalent __has_attribute macros.'
> 
> Thanks,

Ping?

And maybe add a word about the macro behavior in plain C sources,
see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65377 ?

-- 
Markus

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Add a blurb about __has_cpp_attribute and __has_attribute to gcc-5/changes.
  2015-03-10 11:47 ` Markus Trippelsdorf
@ 2015-03-10 12:01   ` Jakub Jelinek
  0 siblings, 0 replies; 3+ messages in thread
From: Jakub Jelinek @ 2015-03-10 12:01 UTC (permalink / raw)
  To: Markus Trippelsdorf
  Cc: Ed Smith-Rowland, Jason Merrill, Gerald Pfeifer, gcc-patches

On Tue, Mar 10, 2015 at 12:47:54PM +0100, Markus Trippelsdorf wrote:
> On 2015.01.26 at 23:22 -0500, Ed Smith-Rowland wrote:
> > Gerald,
> > 
> > Could I get a hand on checking in this last addition?
> > 
> > -m 'Add a blurb to htdocs/gcc-5/changes.html to explain the 
> > __has_cpp_attribute and
> > the equivalent __has_attribute macros.'
> > 
> > Thanks,
> 
> Ping?
> 
> And maybe add a word about the macro behavior in plain C sources,
> see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65377 ?

>     <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                                                            

__has_attribute and __has_cpp_attribute are not a built-in functions, but
built-in function-like macros.

BTW, unlike clang++ we perform macro replacements in the argument, the spec
is unclear and I believe it is useful to be able to e.g. do
#ifdef __clang__
#define NS clang::
#elif defined __GNUC__
#define NS gnu::
#endif
#if defined (NS) && defined (__has_cpp_attribute)
#if __has_cpp_attribute (NS noreturn)
...
#endif
#endif
etc.

	Jakub

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-03-10 12:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-27  5:44 Add a blurb about __has_cpp_attribute and __has_attribute to gcc-5/changes Ed Smith-Rowland
2015-03-10 11:47 ` Markus Trippelsdorf
2015-03-10 12:01   ` Jakub Jelinek

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).