From owner-freebsd-doc@FreeBSD.ORG Mon Dec 7 22:21:09 2009 Return-Path: Delivered-To: doc@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9FD091065700 for ; Mon, 7 Dec 2009 22:21:09 +0000 (UTC) (envelope-from r.c.ladan@gmail.com) Received: from mail-ew0-f211.google.com (mail-ew0-f211.google.com [209.85.219.211]) by mx1.freebsd.org (Postfix) with ESMTP id CB6C58FC1F for ; Mon, 7 Dec 2009 22:21:08 +0000 (UTC) Received: by ewy3 with SMTP id 3so62691ewy.33 for ; Mon, 07 Dec 2009 14:21:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:sender:message-id:date:from :organization:user-agent:mime-version:to:subject:references :in-reply-to:x-enigmail-version:content-type; bh=+iFLT6muZ7zUIvJcIg3QwC5+mP1z6YH72EyqRNHksbU=; b=XwANAW6iDqILRe0MWKcD5fhZdpfekeNThgWEz10eGNWwixL+Gvhk/SvIcBoJgrXBM5 Zb86w8shNJtruwXK9uLZKyKwpNhQSG9B7YvImDmVRLDsg16ghy688zEcbPDRYEhucD88 Fm4f2LH+4XNqaN1M4ri/19rcEDG+J0gs2Uuk0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:message-id:date:from:organization:user-agent:mime-version:to :subject:references:in-reply-to:x-enigmail-version:content-type; b=EtFAngL44vCwjG3BzMWwy9k2eoFmuJmFlF0vdjsfg61jBx+7VRsb4nq1jiWHIdW9mL Z/H6Hh4vt/yKBGOKp1KOIxBtUNVTdVfG3/unwxD4YO3h14LGQAdh8tESFc9tr9OtTbVe p5hUyrAEuDquWP9MLrNERy4T2Hd3Qyr6FatuY= Received: by 10.213.25.66 with SMTP id y2mr15242678ebb.54.1260224461257; Mon, 07 Dec 2009 14:21:01 -0800 (PST) Received: from self.rene-ladan.nl (ip4da3ae31.direct-adsl.nl [77.163.174.49]) by mx.google.com with ESMTPS id 7sm9795985eyb.2.2009.12.07.14.20.59 (version=TLSv1/SSLv3 cipher=RC4-MD5); Mon, 07 Dec 2009 14:21:00 -0800 (PST) Sender: Rene Ladan Message-ID: <4B1D7FCA.90209@freebsd.org> Date: Mon, 07 Dec 2009 23:20:58 +0100 From: Rene Ladan Organization: The FreeBSD Project User-Agent: Thunderbird 2.0.0.23 (X11/20090826) MIME-Version: 1.0 To: "doc@FreeBSD.org" References: <4B01D5C9.4080207@freebsd.org> In-Reply-To: <4B01D5C9.4080207@freebsd.org> X-Enigmail-Version: 0.95.6 Content-Type: multipart/mixed; boundary="------------070108030407030508060706" Cc: Subject: Re: [RFC] [patch] Clang section for Porters Handbook X-BeenThere: freebsd-doc@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Documentation project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Dec 2009 22:21:09 -0000 This is a multi-part message in MIME format. --------------070108030407030508060706 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Rene Ladan schreef: > Hi list, > > attached is a patch for the Porters Handbook listing some extra rules to > keep in mind when writing ports against the future Clang compiler (see > also http://wiki.freebsd.org/BuildingFreeBSDWithClang ). > > It has already been reviewed by some members of The Clang Team and some > doc people. > > Comments/suggestions/approvals are welcome. > Slightly newer version with some links to patches and a script is attached. Note that the line numbers might be off due to other changes in the meantime. Regards, Rene -- http://www.rene-ladan.nl/ GPG fingerprint = ADBC ECCD EB5F A6B4 549F 600D 8C9E 647A E564 2BFC (subkeys.pgp.net) --------------070108030407030508060706 Content-Type: text/x-patch; name="book.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="book.diff" ==== //depot/projects/docproj_nl/en_US.ISO8859-1/books/porters-handbook/book.sgml#49 - /home/rene/freebsd/p4/doc/en_US.ISO8859-1/books/porters-handbook/book.sgml ==== @@ -13602,6 +13624,104 @@ shorthand solution. + + Clang: new C/C++ compiler + + A future version of &os; will likely have the Clang C/C++ + compiler as its base compiler. Some modifications to the Ports + Collection are necessary. In general, these involve + generalizing the port and making the source + code portable. More specifically: + + + + Respect the CC and CXX + variables. Do not use any of the programs cc, + c99, gcc, + c++, or g++ in a port + directly. + + + + Respect LD, do not use + ld in a port directly. + + + + Do not use cpp for reformatting manual + pages or shell scripts. Try to use something more suitable + instead, possibly falling back to CPP. + + + + + Clang uses the gnu99 standard by default, while GCC uses the + gnu89 standard by default. Therefore, if there are any linker + errors caused by the different semantics of + inline, compiler errors caused by the use of + reserved C99 keywords (i.e. restrict) or calls to unimplemented + ISO C99 math routines try to add USE_CSTD=gnu89 + to the port Makefile. + + + + The -traditional option is not supported, + so existing occurrences have to be removed. No consensus has yet + been reached on ports abusing this option to preserve white space + in text formatting. Note that the Clang preprocessor does not + preserve white space. + + + + Explicit type indication of variables must be used in + built-in assembler code. + + + + The main function must be properly declared as: + + int main(int argc, char **argv) + + or, if there are no parameters, as: + + int main(void) + + + + The maximum usable optimization level is 3. Level 4 is + reserved for link-time optimization for the Clang backend. + + + + + + Some temporary hacks that might be used if all else fails: + + + + Adding -fheinous-gnu-extensions. Note + that this option is already deprecated. + + + + Reducing the warning level by adding + --diasable-werror or + --disable-strict, or by disabling + --warn-common or + -Werror. + + + + The current patch set can be downloaded from a server of rene@. + A customizable + script to automatically update your Tinderbox Ports Tree + and apply the patches to it is also available. You might also want + to fetch the + list of files to remove from there. This list is relative + to the Tinderbox Ports Tree. + + Respect both <makevar>CC</makevar> and <makevar>CXX</makevar> --------------070108030407030508060706--