[cfe-dev] gcc quirk not implemented
Chris Lattner
clattner at apple.com
Tue Oct 21 10:01:54 PDT 2008
On Oct 21, 2008, at 9:00 AM, Eli Friedman wrote:
> On Tue, Oct 21, 2008 at 6:36 AM, Roman Divacky
> <rdivacky at freebsd.org> wrote:
>> hi
>>
>> gcc accepts this code:
>>
>> int
>> __xuname(int namesize, void *namebuf)
>> {
>> struct xutsname {
>> char sysname[namesize]; /* Name of this OS. */
>> } *name;
>> }
>>
>> which clang refuses with:
>>
>> const.c:5:25: error: arrays with static storage duration must have
>> constant integer length
>> char sysname[namesize]; /* Name of this OS. */
>> ^~~~~~~
>>
>> note that this violates C99 but obviously it's used (for example in
>> freebsd libc code)
>> so I believe it should get implemented.
>
> Thanks for the report; please file in Bugzilla so it doesn't get lost.
> Looks like a serious pain to implement (structs with multiple
> variable-sized members, anyone?), but I guess that's gcc compat.
Yeah, GCC allows stuff after VLAs as well in structs (which is
exposing an Ada feature through to C). I personally have no interest
in implementing this sort of thing in Clang, but if someone else
wanted to work on it, I wouldn't object :)
-Chris
More information about the cfe-dev
mailing list