Skip to contentSkip to conversation

sparse missing bitwise warnings with dubious bitfields

DISCUSSION Johannes Berg 2 participants 2 messages Jun 8, 2007 Sparse checker

lore
Share & tools
lore
#0 lore raw

Hi,

Not sure if this is intended but it is surely quite weird. Take the following code:

--- begin code ---
#ifdef DUBIOUS
struct {
int x:1;
};
#endif

typedef unsigned short __attribute__((bitwise)) __le32;

int main(int argc, char **argv)
{
__le32 i = 5;
}
--- end code ---

and save it as test.c, and then observe:

$ sparse test.c
test.c:11:14: warning: incorrect type in initializer (different base types)
test.c:11:14:    expected restricted unsigned short [usertype] i
test.c:11:14:    got int 
$ sparse test.c -DDUBIOUS
test.c:3:10: error: dubious one-bit signed bitfield

[note that no warning about the bitwise error is there!]

johannes

#1 lore raw
Quoted 4 lines · Johannes Berg
$ sparse test.c -DDUBIOUS
test.c:3:10: error: dubious one-bit signed bitfield

[note that no warning about the bitwise error is there!]

... or any other warnings, for that matter.

Error turns the warnings off.