Re: Nasal demons in preprocessor use (Re: [PATCH] test-suite: new preprocessor test case)
From: Vegard Nossum
Date: Thu Mar 19 2009 - 16:21:12 EST
2009/3/19 Ingo Molnar <mingo@xxxxxxx>:
>
> * Al Viro <viro@xxxxxxxxxxxxxxxxxx> wrote:
>
>> On Thu, Mar 19, 2009 at 07:51:22PM +0100, Hannes Eder wrote:
>> > When currently running sparse agains the current linux-next tree, a
>> > lot of checks produce error messages like this:
>> >
>> > include/linux/skbuff.h:381:9: error: expected preprocessor identifier
>>
>> Cute. ÂIf anything, this kmemcheck_define_bitfield stuff needs to be moved
>> inside the ifdefs.
>>
>> Folks, this is not a valid C, period. ÂAnd no, there's no promise
>> that gcc won't change its behaviour on such constructs whenever
>> they feel like that.
>>
>> Preprocessor directives do not belong in argument lists. ÂNot
>> #ifdef, not #define, not #include; this is undefined behaviour.
>
> Agreed.
>
> Vegard, it's this bit:
>
> Â Â Â Âkmemcheck_define_bitfield(flags2, {
> #ifdef CONFIG_IPV6_NDISC_NODETYPE
> Â Â Â Â Â Â Â Â__u8 Â Â Â Â Â Â Â Â Â Ândisc_nodetype:2;
> #endif
> #if defined(CONFIG_MAC80211) || defined(CONFIG_MAC80211_MODULE)
> Â Â Â Â Â Â Â Â__u8 Â Â Â Â Â Â Â Â Â Âdo_not_encrypt:1;
> Â Â Â Â Â Â Â Â__u8 Â Â Â Â Â Â Â Â Â Ârequeue:1;
> #endif
> Â Â Â Â});
>
> Â Â Â ÂIngo
>
Hm.
Is this really not valid C?
It worked with GCC, so I assumed it was. My mistake.
Okay, that puts us in a bit of a tight spot, with regards to kmemcheck, I mean.
Maybe I should just take up GCC development instead, and implement a
-fkmemcheck or something.
(To get rid of the bitfield false positives, I mean.)
I guess this means that kmemcheck branch should be withdrawn from
linux-next, at least temporarily, as I have no immediate
workarounds/alternatives. Stephen, can you drop it?
Vegard
--
"The animistic metaphor of the bug that maliciously sneaked in while
the programmer was not looking is intellectually dishonest as it
disguises that the error is the programmer's own creation."
-- E. W. Dijkstra, EWD1036
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/