llvm/clang once more
Alex Hornung
ahornung at gmail.com
Tue Mar 17 01:00:36 PDT 2009
Matt, sorry for sending this twice to your mail; I forgot to add the
mailing list as CC the first time.
clang uses __clang__ as preprocessor "identifier". Be sure not to
conditionalize the other branch on __GNUC__ or similar, as clang also
defines it.
Sincerely,
Alex
PS: For the curious (from lib/Lex/Preprocessor.cpp):
// Compiler version introspection macros.
DefineBuiltinMacro(Buf, "__llvm__=1"); // LLVM Backend
DefineBuiltinMacro(Buf, "__clang__=1"); // Clang Frontend
// Currently claim to be compatible with GCC 4.2.1-5621.
DefineBuiltinMacro(Buf, "__APPLE_CC__=5621");
DefineBuiltinMacro(Buf, "__GNUC_MINOR__=2");
DefineBuiltinMacro(Buf, "__GNUC_PATCHLEVEL__=1");
DefineBuiltinMacro(Buf, "__GNUC__=4");
DefineBuiltinMacro(Buf, "__GXX_ABI_VERSION=1002");
DefineBuiltinMacro(Buf, "__VERSION__=\"4.2.1 (Apple Computer, Inc. "
"build 5621) (dot 3)\"");
On Mon, 2009-03-16 at 16:36 -0700, Matthew Dillon wrote:
> :Hi,
> :
> :I've managed to get our GENERIC kernel to compile with llvm/clang.
> There
> :is still one temporary fix (at least until clang guys fix the related
> :bug), but the kernel definitely compiles, boots and works stable.
> :As a stress test I've done a buildworld, which it survived without
> :problems.
> :I've put everything about DragonFly and llvm/clang so far together on
> :one page, http://leaf.dragonflybsd.org/~alexh/clang/clang.html in
> case
> :you are interested in details or even want to try it yourself.
> :
> :Sincerely,
> :Alex
>
> I assume clang defines a preprocessor symbol identifying that
> clang
> is the compiler? What is that symbol? I would be happy to commit
> that patch at the end suitably conditionalized for clang (just so
> we
> know the hack is for clang and can remove it later on when clang
> is
> fixed).
>
> -Matt
> Matthew Dillon
> <dillon at backplane.com>
More information about the Kernel
mailing list