__has_include__ is problematic

Nathan Sidwell nathan@acm.org
Mon Jan 14 21:40:00 GMT 2019


On 1/10/19 9:32 AM, Jakub Jelinek wrote:
> On Thu, Jan 10, 2019 at 03:20:59PM +0100, Florian Weimer wrote:
>> Can we remove __has_include__?
> 
> No.
> 
>> Its availability results in code which is needlessly non-portable
>> because for some reason, people write __has_include__ instead of
>> __has_include.  (I don't think there is any difference.)
> 
> __has_include needs to be a macro, while __has_include__ is a weirdo
> builtin that does all the magic.  But one needs to be able to
> #ifdef __has_include
> etc.

Why not give the wierdo __has_include__ an unspellable name? 
('builtin<SPACE>has<SPACE>include') and take care constructing the 
__has_include macro expansion to have a token with exactly that spelling?

nathan

-- 
Nathan Sidwell



More information about the Gcc mailing list