Date: Thu, 5 Oct 2017 15:21:17 -0600 From: Alan Somers <asomers@freebsd.org> To: Warner Losh <imp@bsdimp.com> Cc: David Goldblatt <davidtgoldblatt@gmail.com>, FreeBSD Current <freebsd-current@freebsd.org> Subject: Re: C++ in jemalloc Message-ID: <CAOtMX2g7Ynh659=kaxdoqCnWFFJckK70wzxGQOazE724bVFxFw@mail.gmail.com> In-Reply-To: <CANCZdfqO49Jg7vv=mhXZ6-YxqX=C0vSMkR=rnaFdb561hF3XuA@mail.gmail.com> References: <CAHD6eXdazBO4=R7m5odWLt0YyAoTsuZTKvYbEh4_U5ZUXzxt9g@mail.gmail.com> <CANCZdfqO49Jg7vv=mhXZ6-YxqX=C0vSMkR=rnaFdb561hF3XuA@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Oct 5, 2017 at 3:01 PM, Warner Losh <imp@bsdimp.com> wrote: > On Thu, Oct 5, 2017 at 11:59 AM, David Goldblatt <davidtgoldblatt@gmail.com> > 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 To be clear, Warner is talking about C++11 code in jemalloc. C++98 will work fine on all architectures, and I think most of C++03 will too. dtc(1) is allowed to use C++11 because it only builds on architectures that support it. -Alan
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAOtMX2g7Ynh659=kaxdoqCnWFFJckK70wzxGQOazE724bVFxFw>