GCC only added support for __has_builtin in GCC 10. However, all
supported versions of GCC and clang include these builtins so just use
them unconditionally.
This fixes the build with GCC 9.
Differential D31942
<linux/overflow.h>: Don't use __has_builtin(). jhb on Sep 13 2021, 6:23 PM. Authored by Tags None Referenced Files
Details GCC only added support for __has_builtin in GCC 10. However, all This fixes the build with GCC 9.
Diff Detail
Event TimelineComment Actions I was asked to add those checks in D25015 but if all the compiler that we support have those it's good for me (that was my guess at the time but didn't bother to check). Comment Actions As an alternative, you could define __has_builtin(x) to 1 and suffer with a less precise error message should x not actually be supported. Comment Actions We can't really do that. __has_builtin() gets used for various things and in other places it is always defined to 0 when it doesn't exist. Breaking that pattern in a header would probably cause other breakage in the future. |