Page MenuHomeFreeBSD

LinuxKPI: Use negative bit field size to trigger BUILD_BUG_ON_ZERO
ClosedPublic

Authored by wulf on Dec 27 2021, 11:02 PM.
Tags
None
Referenced Files
Unknown Object (File)
Nov 18 2025, 9:38 AM
Unknown Object (File)
Nov 17 2025, 5:43 PM
Unknown Object (File)
Nov 17 2025, 3:46 PM
Unknown Object (File)
Nov 17 2025, 1:45 PM
Unknown Object (File)
Oct 13 2025, 7:42 PM
Unknown Object (File)
Oct 13 2025, 7:42 PM
Unknown Object (File)
Oct 13 2025, 7:42 PM
Unknown Object (File)
Oct 13 2025, 6:16 AM

Details

Summary

compile time assertion on non-NULL pointers. Tests conducted show that
_Static_assert, negative array size method and current code does not
handle pointers well enough. Bit field method solves this problem.

This change is derrived from Linux implementation of BUILD_BUG_ON_ZERO.

MFC after: 1 week

Diff Detail

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