Page MenuHomeFreeBSD

Fix constant conversion warnings in uplcom(4)
ClosedPublic

Authored by dim on Sep 3 2016, 10:40 PM.
Tags
None
Referenced Files
Unknown Object (File)
Dec 22 2023, 9:09 PM
Unknown Object (File)
Dec 12 2023, 8:08 AM
Unknown Object (File)
Dec 8 2023, 10:52 PM
Unknown Object (File)
Dec 7 2023, 11:36 PM
Unknown Object (File)
Nov 29 2023, 11:04 AM
Unknown Object (File)
Jul 28 2023, 5:32 PM
Unknown Object (File)
Jul 16 2023, 6:56 AM
Unknown Object (File)
Jun 27 2023, 9:10 AM
Subscribers

Details

Summary

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

sys/dev/usb/serial/uplcom.c:543:29: error: implicit conversion from 'int' to 'int8_t' (aka 'signed char') changes value from 192 to -64 [-Werror,-Wconstant-conversion]
        if (uplcom_pl2303_do(udev, UT_READ_VENDOR_DEVICE, UPLCOM_SET_REQUEST, 0x8484, 0, 1)
            ~~~~~~~~~~~~~~~~       ^~~~~~~~~~~~~~~~~~~~~
sys/dev/usb/usb.h:179:53: note: expanded from macro 'UT_READ_VENDOR_DEVICE'
#define UT_READ_VENDOR_DEVICE   (UT_READ  | UT_VENDOR | UT_DEVICE)
                                 ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~

This is because UT_READ is 0x80, so the int8_t argument is wrapped to a
negative value. While this should not effect the eventual bits in the
destination (which still end up correctly), it is better to use uint8_t
instead.

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 uplcom(4).
dim updated this object.
dim edited the test plan for this revision. (Show Details)
dim added reviewers: hselasky, emaste.
imp added a reviewer: imp.
This revision is now accepted and ready to land.Sep 4 2016, 3:43 AM
This revision was automatically updated to reflect the committed changes.