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

--- Comment #6 from Martin Sebor <msebor at gcc dot gnu.org> ---
(In reply to Paul Smith from comment #5)
> Is there some preprocessor magic that lets me know that I'm using GCC's
> __builtin_alloc so I can avoid calling alloca(0) in that situation?

The following detects support for __builtin_alloca in GCC.  __has_builtin is
available in GCC 10 and later and all recent versions of Clang.

#ifdef __has_builtin
#  if __has_builtin (__builtin_alloca)
#    warning have __builtin_alloca
#  else
#   warning no __builtin_alloca
#  endif
#else
# warning no __has_builtin
#endif

Reply via email to