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)
Sun, Jun 9, 6:26 PM
Unknown Object (File)
Sat, Jun 8, 6:05 PM
Unknown Object (File)
Sat, Jun 8, 6:05 PM
Unknown Object (File)
May 10 2024, 3:53 AM
Unknown Object (File)
Mar 17 2024, 8:38 PM
Unknown Object (File)
Mar 17 2024, 8:38 PM
Unknown Object (File)
Jan 14 2024, 7:14 AM
Unknown Object (File)
Dec 23 2023, 12:18 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 Not Applicable
Unit
Tests Not Applicable

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
64

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
64

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.