Page MenuHomeFreeBSD

sys/_types.h: Unbreak gcc build
ClosedPublic

Authored by des on Nov 28 2025, 5:11 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Jan 18, 2:18 AM
Unknown Object (File)
Sat, Jan 17, 5:20 PM
Unknown Object (File)
Sat, Jan 10, 3:35 PM
Unknown Object (File)
Sat, Jan 10, 3:20 PM
Unknown Object (File)
Fri, Jan 9, 5:28 AM
Unknown Object (File)
Dec 25 2025, 12:28 PM
Unknown Object (File)
Dec 22 2025, 7:05 PM
Unknown Object (File)
Dec 11 2025, 4:07 PM
Subscribers

Details

Summary

We can't assume that <sys/cdefs.h> is in scope.

Fixes: 85ab981a8e4e ("sys/_types.h: define fallback __(u)intcap_t")

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

des requested review of this revision.Nov 28 2025, 5:11 PM

Oh that's what you meant. Why wouldn't it be in scope?

For the record: Clang documents __has_feature() as a function-like macro, but GCC only says it's a "special operator", was introduced for compatibility with clang and recommends against using it.

In any case, we are already testing for whether __has_feature is defined or not in sys/cdefs.h, so we know that works. The GCC folks must indeed have taken the full compatibility route, which is sensible.

This revision is now accepted and ready to land.Nov 28 2025, 5:29 PM
In D53980#1233312, @imp wrote:

Oh that's what you meant. Why wouldn't it be in scope?

Because ever since someone¹ added tools/build/test-includes/Makefile to our tree four years ago, we test on every buildworld that most headers can be included without prerequisites, and <sys/_types.h> is included by <sys/_callout.h> which is included by <sys/callout.h> and none of those includes <sys/cdefs.h>.

¹ that someone was you

In D53980#1233328, @des wrote:
In D53980#1233312, @imp wrote:

Oh that's what you meant. Why wouldn't it be in scope?

Because ever since someone¹ added tools/build/test-includes/Makefile to our tree four years ago, we test on every buildworld that most headers can be included without prerequisites, and <sys/_types.h> is included by <sys/_callout.h> which is included by <sys/callout.h> and none of those includes <sys/cdefs.h>.

¹ that someone was you

Oh. That problem... I could go either way on just including it or using ifdef.

This revision was automatically updated to reflect the committed changes.