LWN.net Logo

Clang builds a working 2.6.36 Kernel

Clang builds a working 2.6.36 Kernel

Posted Oct 26, 2010 11:42 UTC (Tue) by ibukanov (subscriber, #3942)
Parent article: Clang builds a working 2.6.36 Kernel

> variable-length arrays or another intentionally unsupported GNUtension

variable-length arrays is a part of C99. Does that "intentionally unsupported" implies that CLang would not fully support C99?


(Log in to post comments)

Clang builds a working 2.6.36 Kernel

Posted Oct 26, 2010 11:50 UTC (Tue) by jwakely (subscriber, #60262) [Link]

does the kernel compile as C99? or does it compile as C90 with GNU extensions such as VLAs?

I wouldn't be surprised if Clang only supports VLAs in C99 mode

Clang builds a working 2.6.36 Kernel

Posted Oct 26, 2010 11:55 UTC (Tue) by jwakely (subscriber, #60262) [Link]

http://clang.llvm.org/compatibility.html#vla
that's in the context of C++, apparently Clang defaults to C99 for C (which is correct as that's the current standard) so I wonder why VLAs are described as unsupported - maybe a mistake

Clang builds a working 2.6.36 Kernel

Posted Oct 26, 2010 23:07 UTC (Tue) by wash (guest, #70825) [Link]

Very much so a mistake, my apologizes. I meant to refer to the GNU extension that allows variable length arrays in structures.

Clang builds a working 2.6.36 Kernel

Posted Oct 26, 2010 23:45 UTC (Tue) by Trelane (subscriber, #56877) [Link]

by "VLAs in structs" are you referring to flexible array members?

Clang builds a working 2.6.36 Kernel

Posted Oct 30, 2010 12:32 UTC (Sat) by viro (subscriber, #7872) [Link]

Much worse than that. It allows (and kernel does *not* use, unless something has drastically and cretinously changed) things like that:

extern void g(int *);
void f(int m, int n)
{
struct foo {
int a[n];
int b[n][m + 69];
} x;
g(&x.b[1][1]);
}

Yes, gcc is that sick.

Clang builds a working 2.6.36 Kernel

Posted Oct 27, 2010 9:36 UTC (Wed) by jwakely (subscriber, #60262) [Link]

Flexible array members are also standard C99, and I assume supported by Clang. *zero* length array members are a GNU extension:
http://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html

Clang builds a working 2.6.36 Kernel

Posted Oct 28, 2010 21:12 UTC (Thu) by jengelh (subscriber, #33263) [Link]

>does the kernel compile as C99? or does it compile as C90 with GNU extensions such as VLAs?

In Rome, do as the Romans do: ICC (which is said to be able to compile the kernel) also supports the GNUisms. :)

Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds