From owner-freebsd-current@freebsd.org Thu Oct 5 21:33:26 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 AA93EE43300 for ; Thu, 5 Oct 2017 21:33:26 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-io0-x22b.google.com (mail-io0-x22b.google.com [IPv6:2607:f8b0:4001:c06::22b]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6ED7D34A8 for ; Thu, 5 Oct 2017 21:33:26 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-io0-x22b.google.com with SMTP id i38so2227424iod.2 for ; Thu, 05 Oct 2017 14:33:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=j8GhWZH5xrIcPpV7Ro+IZLQXAA6/Bdvzh1iZopHfYCg=; b=g/NLmZvaotwbLRyOXIKup55KwkJmvVuZx0o6FExpZC0fqRY09KttAcuBzPff+IMHDJ 1l6iNXjJKTMiJwkOV8Xy4ICZU0xLEIvSM/z75qF///84DjjvYS5UulweCOOZfkyZ3LC5 bu/xVPY6DX4C8CcGtoloX7A/WcnPuFLXSExroDs58b0tfL68Ab5CD4fsA42Iq5d2FtCJ s9WW5DyPZnN/XZqMapLkncy/MgCFDyc2+XEFusak5k2s0z7EWBuub2TmJi4F8sueJM7R qgVcWj+3jgD0JoJVWiHS4sbtLnXvqzH4H7bm9xFpKLIGfty6kl+hM49cxPwk8yPO5cY0 w7YA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=j8GhWZH5xrIcPpV7Ro+IZLQXAA6/Bdvzh1iZopHfYCg=; b=frEqZQCYbZi174xV+0/Bm61Bquw+pmx2to39gtipOhP856rJRZByoZt5oIcQ10yW5F IPC6uhiCWT5s9WxsssU0NKdBrfcyL9riGPMueQHkrlhTt7OT8IIFwn7vN+jDol5CYTlr PM+bH0WKUuEE1sQBUbzwT68uXHABBa8i1Wq2JlUUJ6HIo6/+INIlPKPH7KWHEGuEO1kk zeQBn6hCVosX5aT5Kuc/tZ4VOhelIKio0JpcwDc8Nq2W0zMDzz7bn6xIw6ea4sBzdelA 2oDQA+KjWY+cB7ue4JeCq+LhoM69hgsVbx5lCteMClLlTISHBVZxzovY8xSz+fFd+UVy xLEg== X-Gm-Message-State: AMCzsaWBS4miIOKPWsBsE8Slqqm+sDu/EIFuymv4rRr+tPFUh0wAPWcH ncfUAE1bzsgfMA25ZavnP1HPxagrnWSCyMi4Q/EhTQ== X-Google-Smtp-Source: AOwi7QD2LqRMjwmVNZwKKrJSeTtl/2IrkgJYEEmOlwbv5KpErae7QJdJhgKZgtd6azV2XJJWZGc8/fzgY/fFhOPlgPU= X-Received: by 10.107.135.147 with SMTP id r19mr91177ioi.26.1507239205702; Thu, 05 Oct 2017 14:33:25 -0700 (PDT) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.94.130 with HTTP; Thu, 5 Oct 2017 14:33:25 -0700 (PDT) X-Originating-IP: [69.53.245.200] In-Reply-To: <1507238672.86205.250.camel@freebsd.org> References: <1507238672.86205.250.camel@freebsd.org> From: Warner Losh Date: Thu, 5 Oct 2017 14:33:25 -0700 X-Google-Sender-Auth: WX6pyNxzc8ImPqTwIRKLGSPCYJM Message-ID: Subject: Re: C++ in jemalloc To: Ian Lepore Cc: David Goldblatt , FreeBSD Current Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.23 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:33:26 -0000 On Thu, Oct 5, 2017 at 2:24 PM, Ian Lepore wrote: > 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). > It's the ubiquity of C++11 is why I didn't just say "Go for it". Warner