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)
Mon, Oct 7, 3:28 AM
Unknown Object (File)
Sat, Oct 5, 6:00 AM
Unknown Object (File)
Fri, Oct 4, 7:18 PM
Unknown Object (File)
Fri, Oct 4, 8:56 AM
Unknown Object (File)
Thu, Oct 3, 2:01 PM
Unknown Object (File)
Thu, Oct 3, 8:37 AM
Unknown Object (File)
Wed, Oct 2, 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
No Lint Coverage
Unit
No Test Coverage

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).