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)
Mon, Oct 13, 7:42 PM
Unknown Object (File)
Mon, Oct 13, 7:42 PM
Unknown Object (File)
Mon, Oct 13, 7:42 PM
Unknown Object (File)
Mon, Oct 13, 6:16 AM
Unknown Object (File)
Sep 13 2025, 12:38 AM
Unknown Object (File)
Sep 6 2025, 3:14 PM
Unknown Object (File)
Aug 14 2025, 6:15 PM
Unknown Object (File)
Jun 28 2025, 8:46 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