On Thu, Dec 25, 2008 at 02:10, Christopher Li <sparse@xxxxxxxxxxx> wrote: > On Wed, Dec 24, 2008 at 1:59 PM, David Given <dg@xxxxxxxxxxx> wrote: >> The thing is, sizeof(void) is *not* 1. sizeof(void) is *illegal*. It >> just happens that gcc, as a platform-specific extension, treats >> sizeof(void) as 1 by default. > > Exactly. I am unhappy about that patch as well. > Sparse internally use symbol->bit_size == 0 to determine uncompleted type. > Thanks this change. Now is_byte_type() will return true for void type as well. I can only agree here. I made my patch that way only because of my poor understanding of the sparse internals (which I stated in my first email). >> As a linter, sparse really ought not to be encouraging non-portable >> behaviour. Admittedly, there's so much stuff in the kernel source that's >> gcc-specific that it's probably not going to be possible to make it >> build on anything else, but it should still warn people about it unless >> specifically told otherwise --- it's bad practice, and may be indicative >> of further problems elsewhere, and as such is worth a diagnostic. > > I don't see the kernel directly use sizeof(void). Most of the place is > using (void*) pointer + offset. It is not portable. But it is probably not > worthy while to fix. Convert the void* to char*, add offset, convert it back > to void* is pretty annoying as well. If we really want to make it clean, maybe > we can use a macro or inline functions. Again, probably not worth the effort. > > But legitimize sizeof(void) == 1 is a different story. That I feel is just > plain wrong. Of course explicit sizeof(void) itself is just plain wrong, but also it's something that nobody would ever use. So, if you warn here, I of course have no objections. -- To unsubscribe from this list: send the line "unsubscribe linux-sparse" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html