Page MenuHomeFreeBSD

sys/_types.h: Actually unbreak gcc build
ClosedPublic

Authored by des on Sat, Nov 29, 9:50 AM.
Tags
None
Referenced Files
F138805618: D53986.id167312.diff
Thu, Dec 4, 8:36 PM
Unknown Object (File)
Sun, Nov 30, 11:23 PM
Subscribers

Details

Summary

Fixes: 19728f31ae42 ("sys/_types.h: Unbreak gcc build")

Diff Detail

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

Event Timeline

des requested review of this revision.Sat, Nov 29, 9:50 AM

So I checked and the preprocessor _does_ do short-circuit evaluation of boolean expressions, so this shouldn't be necessary, yet gcc complains:

sys/sys/_types.h:164:46: error: missing binary operator before token "("
  164 | #if !defined(__has_feature) || !__has_feature(capabilities)
      |                                              ^
markj added inline comments.
sys/sys/_types.h
167

Why not just write

#ifdef __has_feature
#if !__has_feature(capabilities)

?

With that change, the gcc13 build completes successfully for me.

sys/sys/_types.h
167

Because that inverts the logic. We want these lines included in all cases /except/ when the compiler has the capabilities feature.

des marked an inline comment as done.Sat, Nov 29, 3:38 PM
This revision is now accepted and ready to land.Sat, Nov 29, 9:22 PM
This revision was automatically updated to reflect the committed changes.