[cfe-dev] '__has_builtin' and '-mcpu'

Martin J. O'Riordan via cfe-dev cfe-dev at lists.llvm.org
Thu Jul 28 06:24:25 PDT 2016


For our chip we have implemented many builtins, but some of these builtins
are only available with particular versions of the chip that we select using
'-mcpu'.

 

If the programmer attempts to use a builtin that is not supported by the
selected CPU, the compiler correctly diagnoses that it is not available, so
all is well.

 

But I was thinking that it might be useful for the programmer to test for
the existence of the builtin using '__has_builtin', but while this returns
true when give the name of any of our builtins, it does so regardless of
which CPU variant was selected.

 

Is there someplace I need to supplement the builtin descriptions so that
'__has_builtin' will return false if the builtin exists but is not available
for the selected CPU, or is it not possible to express this?  If it is
possible, how should I express this?

 

Thanks,

 

            MartinO

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20160728/cef2aa2c/attachment.html>


More information about the cfe-dev mailing list