Page MenuHomeFreeBSD

Update D1727, removing the casts altogether
ClosedPublic

Authored by dim on Feb 1 2015, 3:24 PM.
Tags
None
Referenced Files
Unknown Object (File)
Oct 7 2024, 3:28 AM
Unknown Object (File)
Oct 5 2024, 6:00 AM
Unknown Object (File)
Oct 4 2024, 7:18 PM
Unknown Object (File)
Oct 4 2024, 8:56 AM
Unknown Object (File)
Oct 3 2024, 2:01 PM
Unknown Object (File)
Oct 3 2024, 8:37 AM
Unknown Object (File)
Oct 2 2024, 10:19 PM
Unknown Object (File)
Sep 24 2024, 12:09 PM
Subscribers

Details

Summary

After D1727 was committed, Bruce Evans noted that the casts were actually completely unnecessary, here:

https://lists.freebsd.org/pipermail/svn-src-all/2015-February/098478.html

And indeed, if we would want to send this upstream, it is better to just assign &xxx_io_mc_regs[0][0] without any cast.

Test Plan

Compile, and boot

Diff Detail

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

Event Timeline

dim retitled this revision from to Update D1727, removing the casts altogether.
dim updated this object.
dim edited the test plan for this revision. (Show Details)
dim added a reviewer: dumbbell.

Add sys/dev/drm2/radeon/si.c too.

if we would want to send this upstream

I don't see why we wouldn't. Presumably Linux people may bump into the same warnings in the future and have to make a similar change.

In D1748#5, @emaste wrote:

I don't see why we wouldn't. Presumably Linux people may bump into the same warnings in the future and have to make a similar change.

They won't, because of this bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64825

E.g. even gcc5's -Wcast-qual does not warn about this yet.

I think getting rid of the cast is a win regardless of -Wcast-qual.

It is also possible to get rid of any type weirdness at all. The declaration

const u32 (*io_mc_regs)[2];

allows direct assignment of barts_io_mc_regs et al. The values can then be read as io_mc_regs[i][0] and io_mc_regs[i][1]. Alternatively, barts_io_mc_regs and friends could be made arrays of structs instead of arrays of arrays. However, given that both approaches are more invasive, this is only interesting if upstream will take it.

dumbbell edited edge metadata.

Looks good to me.

This revision is now accepted and ready to land.Feb 7 2015, 4:50 PM
dim updated this revision to Diff 3707.

Closed by commit rS278438 (authored by @dim).