From owner-freebsd-current@freebsd.org Thu Oct 5 21:24:41 2017 Return-Path: Delivered-To: freebsd-current@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9CE89E43091 for ; Thu, 5 Oct 2017 21:24:41 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from outbound1b.ore.mailhop.org (outbound1b.ore.mailhop.org [54.200.247.200]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 80B6A3034 for ; Thu, 5 Oct 2017 21:24:41 +0000 (UTC) (envelope-from ian@freebsd.org) X-MHO-User: 99bc1cf9-aa13-11e7-a937-4f970e858fdb X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Originating-IP: 73.78.92.27 X-Mail-Handler: DuoCircle Outbound SMTP Received: from ilsoft.org (unknown [73.78.92.27]) by outbound1.ore.mailhop.org (Halon) with ESMTPSA id 99bc1cf9-aa13-11e7-a937-4f970e858fdb; Thu, 05 Oct 2017 21:24:42 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id v95LOWl4004399; Thu, 5 Oct 2017 15:24:32 -0600 (MDT) (envelope-from ian@freebsd.org) Message-ID: <1507238672.86205.250.camel@freebsd.org> Subject: Re: C++ in jemalloc From: Ian Lepore To: Warner Losh , David Goldblatt Cc: FreeBSD Current Date: Thu, 05 Oct 2017 15:24:32 -0600 In-Reply-To: References: Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.18.5.1 FreeBSD GNOME Team Port Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Oct 2017 21:24:41 -0000 On Thu, 2017-10-05 at 14:01 -0700, Warner Losh wrote: > On Thu, Oct 5, 2017 at 11:59 AM, David Goldblatt > wrote: > > > > >  Hi all, > > > > The jemalloc developers have wanted to start using C++ for a while, to > > enable some targeted refactorings of code we have trouble maintaining due > > to brittleness or complexity (e.g. moving thousand line macro definitions > > to templates, changing the build->extract symbols->rebuild mangling scheme > > for internal symbols to one using C++ namespaces). We'd been holding off > > because we thought that FreeBSD base all had to compile on GCC 4.2, in > > order to support some esoteric architectures[1]. > > > > The other day though, I noticed that there is some C++ shipping with > > FreeBSD; /usr/bin/dtc and /sbin/devd (the former claiming in the HACKING > > document that C++11 is a minimum for FreeBSD 11). This, combined with the > > fact that ports now points to a modern gcc, makes me think we were > > incorrect, and can turn on C++ without breaking FreeBSD builds. > > > > Am I right? Will anything break if jemalloc needs a C++ compiler to build? > > We will of course not use exceptions, RTTI, global constructors, the C++ > > stdlib, or anything else that might affect C source or link compatibility. > > > > Thanks, > > David (on behalf of the jemalloc developers > > > > [1] That being said, we don't compile or test on those architectures, and > > so probably don't work there in the first place if I'm being honest. But > > we'd also like to avoid making that a permanent state of affairs that can't > > be changed. > > > For FreeBSD 10 and earlier, this would likely break all architectures that > aren't x86. Starting in FreeBSD 11, arm and powerpc are supported by clang, > but not super well. For FreeBSD 12, we're getting close for everything > except sparc64 (whose fate has not yet been finally decided). > > So for the popular architectures, this arrangement might work. For building > with external toolchains, it might also work. Some of the less popular > architectures may be a problem. > > Does that help? It isn't completely cut and dried, but it should be helpful > for you making a decision. > > Warner Wait a sec... we've been compiling C++ code with gcc 4.2 since like 2006.  What am I missing here that keeps this answer from being a simple "go for it"? Just stay away from C++11 features and gcc 4.2 should work fine.  (DTC may require C++11, but that was likely the author's choice given that there was no requirement for it to work on pre-clang versions of freebsd). -- Ian