Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 16 Nov 2009 23:44:25 +0100
From:      Rene Ladan <rene@freebsd.org>
To:        "doc@FreeBSD.org" <doc@freebsd.org>
Subject:   [RFC] [patch] Clang section for Porters Handbook
Message-ID:  <4B01D5C9.4080207@freebsd.org>

next in thread | raw e-mail | index | archive | help
This is an OpenPGP/MIME signed message (RFC 2440 and 3156)
--------------enigA24CE0F4F79B7318097A72BD
Content-Type: multipart/mixed; boundary="------------070207010900080605070008"

This is a multi-part message in MIME format.
--------------070207010900080605070008
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: quoted-printable

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=20
also http://wiki.freebsd.org/BuildingFreeBSDWithClang ).

It has already been reviewed by some members of The Clang Team and some=20
doc people.

Comments/suggestions/approvals are welcome.

Regards,
Rene
--=20
http://www.rene-ladan.nl/

GPG fingerprint =3D ADBC ECCD EB5F A6B4 549F  600D 8C9E 647A E564 2BFC=20
(subkeys.pgp.net)

--------------070207010900080605070008
Content-Type: text/plain;
 name="phb-clang.diff"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline;
 filename="phb-clang.diff"

=3D=3D=3D=3D //depot/projects/docproj_nl/en_US.ISO8859-1/books/porters-ha=
ndbook/book.sgml#49 - /home/rene/freebsd/p4/doc/en_US.ISO8859-1/books/por=
ters-handbook/book.sgml =3D=3D=3D=3D
13604a13605,13693
>       <sect1 id=3D"dads-clang">
> 	<title>Clang: new C/C++ compiler</title>
>=20
> 	<para>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 are <quote>write proper=

> 	    ports</quote> and <quote>write proper source code</quote>.  More
> 	  specifically:</para>
>=20
> 	<itemizedlist>
> 	  <listitem>
> 	    <para>Respect the <makevar>CC</makevar> and <makevar>CXX</makevar>=

> 	      variables. Do not use any of the programs <filename>cc</filename=
>,
> 	      <filename>c99</filename>, <filename>gcc</filename>,
> 	      <filename>c++</filename>, or <filename>g++</filename> in a port
> 	      directly.</para>
> 	  </listitem>
>=20
> 	  <listitem>
> 	    <para>Respect <makevar>LD</makevar>, do not use
> 	      <filename>ld</filename> in a port directly.</para>
> 	  </listitem>
>=20
> 	  <listitem>
> 	    <para>Do not use <filename>cpp</filename> for reformatting manual
> 	      pages or shell scripts.  Try to use something more suitable
> 	      instead, possibly falling back to <makevar>CPP</makevar>.</para>=

> 	      <!-- (rene) what about the C++ preprocessor? -->
> 	  </listitem>
>=20
> 	  <listitem>
> 	    <para>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
> 	      <literal>inline</literal>, compiler errors caused by the use of
> 	      reserved C99 keywords (i.e. restrict) or calls to unimplemented
> 	      ISO C99 math routines try to add <literal>USE_CSTD=3Dgnu89</lite=
ral>
> 	      to the port <filename>Makefile</filename>.</para>
> 	  </listitem>
>=20
> 	  <listitem>
> 	    <para>The <literal>-traditional</literal> option is not supported,=

> 	      so existing occurences have to be removed.  No concensus has yet=

> 	      been reached on ports abusing this option to preserve white spac=
e
> 	      in text formatting.  Note that the Clang preprocessor does not
> 	      preserve white space.</para>
> 	  </listitem>
>=20
> 	  <listitem>
> 	    <para>Explicit type indication of variables must be used in
> 	      built-in assembler code.</para>
> 	  </listitem>
>=20
> 	  <listitem>
> 	    <para>The main function must be properly declared as:</para>
>=20
> 	    <programlisting>int main(int argc, char **argv)</programlisting>
>=20
> 	    <para>or, if there are no parameters, as:</para>
>=20
> 	    <programlisting>int main(void)</programlisting>
> 	  </listitem>
>=20
> 	  <listitem>
> 	    <para>The maximum useable optimization level is 3.  Level 4 is
> 	      reserved for link-time optimization for the Clang backend.</para=
>
> 	  </listitem>
>=20
> 	  <!--(rene) -I and -L belong to CONFIGURE_ENV, not to CFLAGS (?)-->
> 	</itemizedlist>
>=20
> 	<para>Some temporary hacks that might be used if all else fails:</para=
>
>=20
> 	<itemizedlist>
> 	  <listitem>
> 	    <para>Adding <literal>-fheinous-gnu-extensions</literal>.  Note
> 	      that this option is already deprecated.</para>
> 	  </listitem>
>=20
> 	  <listitem>
> 	    <para>Reducing the warning level by adding
> 	      <literal>--diasable-werror</literal> or
> 	      <literal>--disable-strict</literal>, or by disabling
> 	      <literal>--warn-common</literal> or
> 	      <literal>-Werror</literal>.</para>
> 	  </listitem>
> 	</itemizedlist>
>       </sect1>
>=20

--------------070207010900080605070008--

--------------enigA24CE0F4F79B7318097A72BD
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.13 (FreeBSD)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAksB1oYACgkQjJ5keuVkK/zNBQCgzj7x1q4EkfMuzBRQicyANoyi
SW0AmQE0ICNbfeNdNzzLIxMAgeMXHIz9
=+xTV
-----END PGP SIGNATURE-----

--------------enigA24CE0F4F79B7318097A72BD--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4B01D5C9.4080207>