This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Add a blurb about __has_cpp_attribute and __has_attribute to gcc-5/changes.
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Markus Trippelsdorf <markus at trippelsdorf dot de>
- Cc: Ed Smith-Rowland <3dw4rd at verizon dot net>, Jason Merrill <jason at redhat dot com>, Gerald Pfeifer <gerald at pfeifer dot com>, gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Tue, 10 Mar 2015 13:01:04 +0100
- Subject: Re: Add a blurb about __has_cpp_attribute and __has_attribute to gcc-5/changes.
- Authentication-results: sourceware.org; auth=none
- References: <54C7129E dot 2050109 at verizon dot net> <20150310114754 dot GD351 at x4>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
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