Page MenuHomeFreeBSD

Fix a bunch of -Wcast-qual warnings in uhid.c
ClosedPublic

Authored by dim on Jan 31 2015, 12:06 AM.
Tags
None
Referenced Files
F168551636: D1743.id3563.diff
Fri, Aug 28, 11:54 PM
F168497731: D1743.id3557.diff
Fri, Aug 28, 4:58 PM
Unknown Object (File)
Fri, Aug 28, 6:20 AM
Unknown Object (File)
Thu, Aug 27, 6:30 PM
Unknown Object (File)
Wed, Aug 26, 4:06 PM
Unknown Object (File)
Tue, Aug 25, 4:57 PM
Unknown Object (File)
Wed, Aug 12, 5:36 AM
Unknown Object (File)
Mon, Aug 10, 9:53 AM
Subscribers
None

Details

Summary

When testing with clang 3.6.0, I got a number of the following -Wcast-qual warnings:

sys/dev/usb/input/uhid.c:737:33: error: cast from 'unsigned char const (*)[125]' to 'void *' drops const qualifier [-Werror,-Wcast-qual]
                        sc->sc_repdesc_ptr = (void *)&uhid_graphire_report_descr;
                                                     ^
sys/dev/usb/input/uhid.c:758:33: error: cast from 'unsigned char const (*)[161]' to 'void *' drops const qualifier [-Werror,-Wcast-qual]
                        sc->sc_repdesc_ptr = (void *)&uhid_graphire3_4x5_report_descr;
                                                     ^
sys/dev/usb/input/uhid.c:778:32: error: cast from 'unsigned char const (*)[166]' to 'void *' drops const qualifier [-Werror,-Wcast-qual]
                sc->sc_repdesc_ptr = (void *)&uhid_xb360gp_report_descr;
                                             ^

As far as I can see, sc_repdesc_ptr can't be made into a const pointer, so this has to be fixed using __DECONST().

Test Plan

This compiles, and the kernel boots.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

dim retitled this revision from to Fix a bunch of -Wcast-qual warnings in uhid.c.
dim updated this object.
dim edited the test plan for this revision. (Show Details)
dim added a reviewer: hselasky.

Btw, I did not wrap the lines at 80 chars, since the existing style in the file already did not do that. :)

This revision is now accepted and ready to land.Jan 31 2015, 7:49 AM
dim updated this revision to Diff 3563.

Closed by commit rS277974 (authored by @dim).