From owner-freebsd-ports-bugs@FreeBSD.ORG Sat May 30 21:40:01 2009 Return-Path: Delivered-To: freebsd-ports-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EE9AE10656BF for ; Sat, 30 May 2009 21:40:01 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id CE5F88FC13 for ; Sat, 30 May 2009 21:40:01 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.3/8.14.3) with ESMTP id n4ULe1EM017082 for ; Sat, 30 May 2009 21:40:01 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.3/8.14.3/Submit) id n4ULe1oW017081; Sat, 30 May 2009 21:40:01 GMT (envelope-from gnats) Resent-Date: Sat, 30 May 2009 21:40:01 GMT Resent-Message-Id: <200905302140.n4ULe1oW017081@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-ports-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Ed Schouten Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 41CC21065670 for ; Sat, 30 May 2009 21:33:27 +0000 (UTC) (envelope-from ed@hoeg.nl) Received: from palm.hoeg.nl (mx0.hoeg.nl [IPv6:2001:7b8:613:100::211]) by mx1.freebsd.org (Postfix) with ESMTP id 0E12D8FC08 for ; Sat, 30 May 2009 21:33:27 +0000 (UTC) (envelope-from ed@hoeg.nl) Received: by palm.hoeg.nl (Postfix, from userid 1000) id 3E6441CE50; Sat, 30 May 2009 23:33:26 +0200 (CEST) Message-Id: <20090530213326.3E6441CE50@palm.hoeg.nl> Date: Sat, 30 May 2009 23:33:26 +0200 (CEST) From: Ed Schouten To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Cc: Subject: ports/135083: [Patch] Support for USE_CSTD, override C language standard X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Ed Schouten List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 May 2009 21:40:02 -0000 >Number: 135083 >Category: ports >Synopsis: [Patch] Support for USE_CSTD, override C language standard >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sat May 30 21:40:01 UTC 2009 >Closed-Date: >Last-Modified: >Originator: Ed Schouten >Release: FreeBSD 6.4-STABLE i386 >Organization: >Environment: System: FreeBSD palm.hoeg.nl 6.4-STABLE FreeBSD 6.4-STABLE #0 r192147: Fri May 15 22:42:58 CEST 2009 ed@palm.hoeg.nl:/usr/obj/usr/src/sys/PALM i386 >Description: The version of GCC that's being shipped with all supported versions of FreeBSD uses C89 with GNU extensions by default (called gnu89). The problem is that this behaviour may change in future versions of GCC, but also when using different a different compiler, like Clang. This is why I propose this small change to bsd.port.mk, which allows us to override the C standard per port. When committed, we (the FreeBSD/Clang team) can start submitting patches to the individual port maintainers. This has the following advantages: - We can submit more bug reports to the Clang developers, because we can guarantee better coverage of the Ports tree. - If/when GCC in the base system will get updated to a version that uses C99 by default or if GCC ever gets replaced with Clang, less work will be required to keep the ports working. >How-To-Repeat: Build high profile ports like libiconv with CC=clang. It won't build. This means it's hard to get good support for Clang. >Fix: --- bsd.port.mk +++ bsd.port.mk @@ -308,6 +308,7 @@ # the regular expression. # USE_GCC - If set, this port requires this version of gcc, either in # the system or installed from a port. +# USE_CSTD - Override the default C language standard (gnu89, gnu99) # USE_GMAKE - If set, this port uses gmake. # GMAKE - Set to path of GNU make if not in $PATH. # Default: gmake @@ -2180,6 +2181,10 @@ .endif .endif +.if defined(USE_CSTD) +CFLAGS:= ${CFLAGS:N-std=*} -std=${USE_CSTD} +.endif + # Multiple make jobs support .if defined(DISABLE_MAKE_JOBS) || defined(MAKE_JOBS_UNSAFE) _MAKE_JOBS= # >Release-Note: >Audit-Trail: >Unformatted: