Page MenuHomeFreeBSD

Fix constant conversion warnings in ppbus(4)
ClosedPublic

Authored by dim on Sep 3 2016, 1:04 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Mar 28, 8:19 AM
Unknown Object (File)
Mar 5 2024, 11:30 PM
Unknown Object (File)
Jan 15 2024, 11:14 AM
Unknown Object (File)
Jan 13 2024, 7:43 AM
Unknown Object (File)
Dec 19 2023, 11:42 PM
Unknown Object (File)
Dec 9 2023, 12:37 AM
Unknown Object (File)
Nov 30 2023, 6:35 PM
Unknown Object (File)
Nov 27 2023, 7:38 AM
Subscribers
None

Details

Summary

With clang 3.9.0, compiling ppbus results in the following warnings:

sys/dev/ppbus/ppb_1284.c:296:46: error: implicit conversion from 'int' to 'char' changes value from 144 to -112 [-Werror,-Wconstant-conversion]
        if ((error = do_peripheral_wait(bus, SELECT | nBUSY, 0))) {
                     ~~~~~~~~~~~~~~~~~~      ~~~~~~~^~~~~~~
sys/dev/ppbus/ppb_1284.c:785:48: error: implicit conversion from 'int' to 'char' changes value from 240 to -16 [-Werror,-Wconstant-conversion]
                if (do_1284_wait(bus, nACK | SELECT | PERROR | nBUSY,
                    ~~~~~~~~~~~~      ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
sys/dev/ppbus/ppb_1284.c:786:29: error: implicit conversion from 'int' to 'char' changes value from 240 to -16 [-Werror,-Wconstant-conversion]
                                        nACK | SELECT | PERROR | nBUSY)) {
                                        ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~

This is because nBUSY is 0x80, so the char argument is wrapped to a
negative value. I have tried to fix this in a minimal fashion, by using
uint8_t in just a few places.

Test Plan

Is there anybody who still has functioning parallel port hardware? :)

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

dim retitled this revision from to Fix constant conversion warnings in ppbus(4).
dim updated this object.
dim edited the test plan for this revision. (Show Details)
dim added reviewers: imp, emaste.
emaste edited edge metadata.

LGTM

This revision is now accepted and ready to land.Sep 3 2016, 1:15 PM
This revision was automatically updated to reflect the committed changes.