Page MenuHomeFreeBSD

<linux/overflow.h>: Don't use __has_builtin().
ClosedPublic

Authored by jhb on Sep 13 2021, 6:23 PM.
Tags
None
Referenced Files
F116009764: D31942.diff
Thu, May 1, 1:25 PM
Unknown Object (File)
Mon, Apr 21, 8:34 AM
Unknown Object (File)
Tue, Apr 8, 8:14 PM
Unknown Object (File)
Sat, Apr 5, 4:57 PM
Unknown Object (File)
Mar 26 2025, 6:56 AM
Unknown Object (File)
Mar 24 2025, 11:51 PM
Unknown Object (File)
Mar 1 2025, 8:55 PM
Unknown Object (File)
Feb 15 2025, 9:39 PM
Subscribers

Details

Summary

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.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 41496
Build 38385: arc lint + arc unit

Event Timeline

jhb requested review of this revision.Sep 13 2021, 6:23 PM

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).

This revision is now accepted and ready to land.Sep 13 2021, 6:32 PM

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.

In D31942#720643, @imp wrote:

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.

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.

This revision was automatically updated to reflect the committed changes.