This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Add a blurb about __has_cpp_attribute and __has_attribute to gcc-5/changes.


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]