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
Unknown Object (File)
Sat, Dec 21, 11:51 AM
Unknown Object (File)
Wed, Dec 18, 4:11 AM
Unknown Object (File)
Wed, Dec 18, 3:21 AM
Unknown Object (File)
Thu, Dec 5, 4:26 AM
Unknown Object (File)
Nov 19 2024, 4:00 AM
Unknown Object (File)
Oct 23 2024, 9:26 PM
Unknown Object (File)
Oct 23 2024, 7:22 AM
Unknown Object (File)
Oct 21 2024, 6:36 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).