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)
Thu, Jan 16, 2:15 AM
Unknown Object (File)
Nov 21 2024, 4:59 PM
Unknown Object (File)
Nov 14 2024, 10:12 PM
Unknown Object (File)
Nov 11 2024, 8:31 AM
Unknown Object (File)
Sep 27 2024, 2:16 PM
Unknown Object (File)
Sep 23 2024, 2:36 PM
Unknown Object (File)
Sep 23 2024, 2:35 PM
Unknown Object (File)
Sep 23 2024, 2:35 PM
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.