From owner-freebsd-hackers@FreeBSD.ORG Fri Nov 28 11:20:11 2008 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9E02F1065673 for ; Fri, 28 Nov 2008 11:20:11 +0000 (UTC) (envelope-from christoph.mallon@gmx.de) Received: from mail.gmx.net (mail.gmx.net [213.165.64.20]) by mx1.freebsd.org (Postfix) with SMTP id 09FB18FC0C for ; Fri, 28 Nov 2008 11:20:10 +0000 (UTC) (envelope-from christoph.mallon@gmx.de) Received: (qmail invoked by alias); 28 Nov 2008 11:20:09 -0000 Received: from p54A3F209.dip.t-dialin.net (EHLO tron.homeunix.org) [84.163.242.9] by mail.gmx.net (mp049) with SMTP; 28 Nov 2008 12:20:09 +0100 X-Authenticated: #1673122 X-Provags-ID: V01U2FsdGVkX185mkUynBc5fuhkjFzmBSAO5HMyfWzQtY1+LcVdBm BvbDoa+XubgTjZ Message-ID: <492FD3E7.6000205@gmx.de> Date: Fri, 28 Nov 2008 12:20:07 +0100 From: Christoph Mallon User-Agent: Thunderbird 2.0.0.18 (X11/20081124) MIME-Version: 1.0 To: Alexander Leidinger References: <492F0591.7050807@gmx.de> <20081128093858.57826oi96gmzliww@webmail.leidinger.net> In-Reply-To: <20081128093858.57826oi96gmzliww@webmail.leidinger.net> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Y-GMX-Trusted: 0 X-FuHaFi: 0.54 Cc: freebsd-hackers@freebsd.org Subject: Re: New C compiler and analyzer lang/cparser in ports X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Nov 2008 11:20:11 -0000 Alexander Leidinger schrieb: > Quoting Christoph Mallon (from Thu, 27 Nov > 2008 21:39:45 +0100): > >> cparser is a C compiler, which can parse C89 and C99 as well as many >> GCC and some MSVC extensions. The handled GCC extensions include >> __attribute__, inline assembler, computed goto and statement >> expressions. The compiler driver is compatible with with GCC (-fxxx, >> -Wxxx, -M, ...). It also provides many useful analyses for warnings - >> for some examples see below. > > How much of the GCC stuff in /usr/include/cdefs.h would work with > cparser? Info: this is the major part one has to do to make another > compiler ready to compile our kernel. I guess, you mean /usr/include/sys/cdefs.h. Let's have a look. #define __GNUCLIKE_ASM 3 #define __GNUCLIKE_MATH_BUILTIN_CONSTANTS cparser supports GCC style inline assembler (except for x87 floating point constraints, which are not implemented, yet) and also supports builtins like __builtin_nanf. #define __GNUCLIKE___TYPEOF 1 #define __GNUCLIKE___OFFSETOF 1 cparser supports __typeof__ and __builtin_offsetof #define __GNUCLIKE___SECTION 1 This is missing. #define __GNUCLIKE_ATTRIBUTE_MODE_DI 1 The __attribute__((mode($FOO)) insanity is supported. # define __GNUCLIKE_CTOR_SECTION_HANDLING 1 __attribute__((constructor)) and destructor are supported. #define __GNUCLIKE_BUILTIN_CONSTANT_P 1 # define __GNUCLIKE_BUILTIN_VARARGS 1 # define __GNUCLIKE_BUILTIN_STDARG 1 # define __GNUCLIKE_BUILTIN_VAALIST 1 cparser handles these GCC builtins. #define __CC_SUPPORTS_INLINE 1 #define __CC_SUPPORTS___INLINE 1 #define __CC_SUPPORTS___INLINE__ 1 I think we support all alternative spellings with any number of underscores for all keywords. (: I'll skip some simple stuff now, which also works. #define __dead2 __attribute__((__noreturn__)) #define __pure2 __attribute__((__const__)) #define __unused __attribute__((__unused__)) #define __used __attribute__((__used__)) #define __packed __attribute__((__packed__)) #define __aligned(x) __attribute__((__aligned__(x))) #define __section(x) __attribute__((__section__(x))) All of these are parsed and except for __section__ are handled, e.g. __noreturn__ is used for optimization. We also have -Wmissing-noreturn, which warns about functions, which should have this attribute. I'm skipping more attribute stuff. #define __weak_reference(sym,alias) \ __asm__(".weak " #alias); \ __asm__(".equ " #alias ", " #sym) global asm statements are supported, too. The compiler driver is compatible with GCC, but we need to support more switches. This is a matter of time and digging through GCC documentation. Regards Christoph