Re: [PATCH 16/16] fix handling of integer constant expressions
From: Neil Booth
Date: Sun Jun 24 2007 - 17:49:42 EST
Al Viro wrote:-
> > See gcc.gnu.org/PR456 for more discussion. Yes it's an old
> > bug...
>
> Humm... Right, so __builtin_offsetof() needs special treatment too.
> Oh, bugger. Is
> offsetof(struct foo, a.x[n])
> a documented extension? I _know_ that it's not promised by 7.17,
> but gcc eats it (and obviously that sucker requires extra treatment
> in that case).
I asked on comp.std.c about this; the feeling was that only identifiers
are intended to be permitted as the 2nd argument to offsetof. If true
the standard has a very obscure way of stating something that could
be said much more simply.
> Parsing __builtin_offsetof() arguments is going to be fun ;-/ Right
> now sparse has it as a predefined macro, but if we want to do that
> kind of analysis, we need to really parse it. OTOH, that's not
> such a big deal... Parser would need to accept
> ident ( \[ expr \] | . ident )*
don't forget -> if you're going to accept extra stuff. GCC forgot ->
with the parser rewrite, yes I filed a PR.
Neil.
-
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/