On Wed, 2020-03-11 at 00:30 +0900, Masahiro Yamada wrote: > On Tue, Mar 10, 2020 at 8:31 PM David Laight <David.Laight@xxxxxxxxxx> wrote: > > From: Nathan Chancellor > > > Sent: 10 March 2020 01:26 > > ... > > > Sure, I can send v2 to do that but I think that sending 97 patches just > > > casting the small values (usually less than twenty) to unsigned long > > > then to the enum is rather frivolous. I audited at least ten to fifteen > > > of these call sites when creating the clang patch and they are all > > > basically false positives. > > > > Such casts just make the code hard to read. > > If misused casts can hide horrid bugs. > > IMHO sprinkling the code with casts just to remove > > compiler warnings will bite back one day. > > > > I agree that too much casts make the code hard to read, > but irrespective of this patch, there is no difference > in the fact that we need a cast to convert > (const void *) to a non-pointer value. > > The difference is whether we use > (uintptr_t) or (enum foo). or hide it altogether in a macro like cast_to #define cast_to(type, val) \ etc... where cast_to could do the appropriate intermediate cast if type is an enum and sizeof(tupeof val) is larger than int