Hi Martin,

Martin Sebor <mse...@gmail.com> wrote:

> Ping: https://gcc.gnu.org/ml/gcc-patches/2019-10/msg00062.html
> 
> On 10/1/19 11:16 AM, Martin Sebor wrote:
>> Attached is an implementation of the __has_builtin special
>> preprocessor operator/macro analogous to __has_attribute and
>> (hopefully) compatible with the synonymous Clang feature (I
>> couldn't actually find tests for it in the Clang test suite
>> but if someone points me at them I'll verify it).
>> Tested on x86_64-linux.
>> Martin
>> PS I couldn't find an existing API to test whether a reserved
>> symbol like __builtin_offsetof is a function-like built-in so
>> I hardwired the tests for C and C++ into the new names_builtin_p
>> functions.  I don't like this very much because the next time
>> such an operator is added there is nothing to remind us to update
>> the functions.  Adding a flag to the c_common_reswords array would
>> solve the problem but at the expense of a linear search through
>> it.  Does anyone have a suggestion for how to do this better?

This patch will also contribute one of the pieces needed for PR90835 
(and, by inheritance, 90709).

I’ve tested this on Darwin16, and looked through the code - LGTM,
and it’s also somewhat resuable for supporting __has_feature/extension
for which I have patches in progress.

So, +1 for applying it.

thanks
Iain

Reply via email to