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)
Sun, May 12, 8:13 PM
Unknown Object (File)
Sun, May 12, 12:23 PM
Unknown Object (File)
Sun, May 12, 9:20 AM
Unknown Object (File)
Apr 2 2024, 4:46 AM
Unknown Object (File)
Dec 20 2023, 2:10 AM
Unknown Object (File)
Dec 16 2023, 8:58 AM
Unknown Object (File)
Dec 16 2023, 8:57 AM
Unknown Object (File)
Oct 25 2023, 7:11 PM
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).