[Bug preprocessor/96952] __builtin_thread_pointer support cannot be probed

jakub at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Sep 7 12:10:02 GMT 2020


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96952

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
__has_builtin does what is documented:

The special operator @code{__has_builtin (@var{operand})} may be used in
constant integer contexts and in preprocessor @samp{#if} and @samp{#elif}
expressions to test whether the symbol named by its @var{operand} is
recognized as a built-in function by GCC in the current language and
conformance mode.  It evaluates to a constant integer with a nonzero
value if the argument refers to such a function, and to zero otherwise.

__builtin_thread_pointer is recognized as a built-in function by GCC, so you
get 1 from __has_builtin.  It is not feasible to have at preprocessing time
complete knowledge of the details how the builtin will be lowered (if at all),
expanded (if at all), whether it needs any optabs etc.  A lot of those details
are also dependent on the builtin arguments and other details (e.g. from which
function it is called, what function specific options are enabled etc.).


More information about the Gcc-bugs mailing list