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
F102954181: D1743.diff
Tue, Nov 19, 4:00 AM
Unknown Object (File)
Wed, Oct 23, 9:26 PM
Unknown Object (File)
Wed, Oct 23, 7:22 AM
Unknown Object (File)
Mon, Oct 21, 6:36 AM
Unknown Object (File)
Oct 1 2024, 6:09 PM
Unknown Object (File)
Sep 23 2024, 7:58 PM
Unknown Object (File)
Sep 6 2024, 6:28 AM
Unknown Object (File)
Aug 30 2024, 6:32 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).