Page MenuHomeFreeBSD

use bool for one-bit wide bit-fields
ClosedPublic

Authored by dim on Apr 19 2023, 8:29 PM.
Tags
None
Referenced Files
Unknown Object (File)
Oct 2 2024, 1:33 PM
Unknown Object (File)
Oct 1 2024, 9:28 PM
Unknown Object (File)
Sep 30 2024, 6:32 PM
Unknown Object (File)
Sep 30 2024, 5:02 AM
Unknown Object (File)
Sep 30 2024, 12:34 AM
Unknown Object (File)
Sep 27 2024, 10:31 AM
Unknown Object (File)
Sep 27 2024, 5:57 AM
Unknown Object (File)
Sep 21 2024, 6:27 AM
Subscribers

Details

Summary

A signed one-bit wide bit-field can take only the values 0 and -1. Clang
16 introduced a warning that "implicit truncation from 'int' to a
one-bit wide bit-field changes value from 1 to -1". Fix the warnings by
using C99 bool.

Reported by: Clang 16
MFC after: 3 days

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 51042
Build 47933: arc lint + arc unit

Event Timeline

dim requested review of this revision.Apr 19 2023, 8:29 PM
emaste added inline comments.
sys/dev/acpica/acpi_pci_link.c
358

and here

365

and here

369

and here

496

and here

561

we could make this true instead if so desired

907

and here

This revision is now accepted and ready to land.Apr 19 2023, 11:15 PM

I agree with Ed that we should be changing these to use true/false rather than 0/1 or TRUE/FALSE constants that map to 0/1.

sys/dev/acpica/acpi_pxm.c
61

These are not bools, but ints (domain and id). You need to leave those as is and only change enabled and has_memory.

sys/dev/acpica/acpi_pxm.c
61

Oh no, clearly I did not look closely enough.

Fix acpi_pxm.c mistake, add quicc_bfe.h.

This revision now requires review to proceed.Apr 21 2023, 6:42 PM

Also convert TRUE|FALSE to true|false in acpi_pxm.c.

This revision is now accepted and ready to land.Apr 25 2023, 4:41 PM
This revision was automatically updated to reflect the committed changes.