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)
Nov 25 2024, 7:32 AM
Unknown Object (File)
Oct 25 2024, 8:34 PM
Unknown Object (File)
Oct 24 2024, 9:47 PM
Unknown Object (File)
Oct 2 2024, 4:04 AM
Unknown Object (File)
Sep 26 2024, 8:00 PM
Unknown Object (File)
Sep 23 2024, 5:11 PM
Unknown Object (File)
Sep 22 2024, 2:41 PM
Unknown Object (File)
Sep 21 2024, 12:08 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.