From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 5C7153860760 for ; Tue, 25 Oct 2022 23:00:34 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 5C7153860760 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1666738834; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2eqrv8FLFy7hRlpnvKwzhA+kC3DSKBKbnJs4mDHF1bI=; b=KbEHA936GXZxbRB8W8HlEY7aEN2FpD/YZzAOhRcOdeSZi/hXU/iPFsjLLlp9cE8ZFn9Yx5 ZYzd8ZXkRDAZ2QaLHDWmTsUNuXf5KD1U+XKIWm3rv1xNTMt0Y4JZx9NgZS4P6oM3pBEWVU Bmkh4KuIKRwyOtAgngSxa0xK0xN3BYM= Received: from mail-qv1-f69.google.com (mail-qv1-f69.google.com [209.85.219.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-556-PgV2LCyKOVypVS6KE541zg-1; Tue, 25 Oct 2022 19:00:32 -0400 X-MC-Unique: PgV2LCyKOVypVS6KE541zg-1 Received: by mail-qv1-f69.google.com with SMTP id ln3-20020a0562145a8300b004b8c29a7d50so7989606qvb.15 for ; Tue, 25 Oct 2022 16:00:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:to:from:subject:message-id:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=2eqrv8FLFy7hRlpnvKwzhA+kC3DSKBKbnJs4mDHF1bI=; b=2dZNbE7jH3nwrtAEJ+CMZzl8kvfZoHmbTvA77h1dK5MvVm3al4fL6gADmEKCvNB0l1 dRYHGVgHiwQBCMi4drcINOLUd6XUV8ickBu1B1qOvw5j1MxwBFErpLDmyICWsLrbR641 QH4N9tFGPowwakqAA7xZjNsT4qtPTgt5oEDeacaJji9kGSJWwoZ+fV5tG3G5RsKMqLUd cxT5zM7l8dvRNhOxZOZ7lB9FIfNlJYpx5FODsPaSAIHu1YBkv8D3DHG0XMNObXV/wcEt 4Lm3R1SRlwnq+U87zFJ3Qn1i0mOOA+d3dNAob4gLYbmXNzU8VF3W9P08fhOvoWmiLOb6 20FQ== X-Gm-Message-State: ACrzQf2VG3knwq4nNww0LV0W4C6aJCSEN5xOaHP+uQLRDyzJ/RK7zW0n t43xvpkS4qo45AwfmJgURNo/Q8gxRtXr0rGMiv2u5ineiadMeogv1vrePLwRyNVVsTj7paFOk1p 3Y7+qvqxbMbL63qHYy0xcdaiA2A2Po+ZuQQRbXNtrZBuPAzQdPqqPhKKPs52Ea2YNqS1WZg== X-Received: by 2002:a0c:e2d4:0:b0:4bb:5902:922c with SMTP id t20-20020a0ce2d4000000b004bb5902922cmr18862753qvl.57.1666738831875; Tue, 25 Oct 2022 16:00:31 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4hANHxJup72hVyMwnzX5VMs0UQXjv/64BI9fLzHWHEUQYU3LXDfxTduT1HFnSwG80JFqVKYw== X-Received: by 2002:a0c:e2d4:0:b0:4bb:5902:922c with SMTP id t20-20020a0ce2d4000000b004bb5902922cmr18862728qvl.57.1666738831527; Tue, 25 Oct 2022 16:00:31 -0700 (PDT) Received: from t14s.localdomain (c-73-69-212-193.hsd1.ma.comcast.net. [73.69.212.193]) by smtp.gmail.com with ESMTPSA id v18-20020a05622a145200b0035cf31005e2sm2295439qtx.73.2022.10.25.16.00.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Oct 2022 16:00:30 -0700 (PDT) Message-ID: <80b4191570fd1485ca6af17f8edab6b49c03e8d1.camel@redhat.com> Subject: Re: [PATCH 1/2] Add gcc/make-unique.h From: David Malcolm To: gcc-patches@gcc.gnu.org Date: Tue, 25 Oct 2022 19:00:29 -0400 In-Reply-To: <20221021160150.1600351-1-dmalcolm@redhat.com> References: <20221021160150.1600351-1-dmalcolm@redhat.com> User-Agent: Evolution 3.44.4 (3.44.4-1.fc36) MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-10.5 required=5.0 tests=BAYES_00,BODY_8BITS,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,KAM_SHORT,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Fri, 2022-10-21 at 12:01 -0400, David Malcolm wrote: > This patch adds gcc/make-unique.h, containing a minimal C++11 > implementation of make_unique (std::make_unique is C++14). >=20 > The followup patch uses this in dozens of places within the analyzer. >=20 > Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu. >=20 > OK for trunk? I've now realized that I sent an earlier version of this patch here: https://gcc.gnu.org/pipermail/gcc-patches/2022-July/598189.html Dave >=20 > gcc/ChangeLog: > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0* make-unique.h: New file= . >=20 > Signed-off-by: David Malcolm > --- > =C2=A0gcc/make-unique.h | 42 ++++++++++++++++++++++++++++++++++++++++++ > =C2=A01 file changed, 42 insertions(+) > =C2=A0create mode 100644 gcc/make-unique.h >=20 > diff --git a/gcc/make-unique.h b/gcc/make-unique.h > new file mode 100644 > index 00000000000..752a1d3dd30 > --- /dev/null > +++ b/gcc/make-unique.h > @@ -0,0 +1,42 @@ > +/* Minimal implementation of make_unique for C++11 compatibility. > +=C2=A0=C2=A0 Copyright (C) 2022 Free Software Foundation, Inc. > + > +This file is part of GCC. > + > +GCC is free software; you can redistribute it and/or modify it under > +the terms of the GNU General Public License as published by the Free > +Software Foundation; either version 3, or (at your option) any later > +version. > + > +GCC is distributed in the hope that it will be useful, but WITHOUT > ANY > +WARRANTY; without even the implied warranty of MERCHANTABILITY or > +FITNESS FOR A PARTICULAR PURPOSE.=C2=A0 See the GNU General Public > License > +for more details. > + > +You should have received a copy of the GNU General Public License > +along with GCC; see the file COPYING3.=C2=A0 If not see > +.=C2=A0 */ > + > +#ifndef GCC_MAKE_UNIQUE > +#define GCC_MAKE_UNIQUE > + > +/* This header uses std::unique_ptr, but can't be directly > +=C2=A0=C2=A0 included due to issues with macros.=C2=A0 Hence mu= st be > included > +=C2=A0=C2=A0 from system.h by defining INCLUDE_MEMORY in any source file= using > +=C2=A0=C2=A0 make-unique.h.=C2=A0 */ > + > +#ifndef INCLUDE_MEMORY > +# error "You must define INCLUDE_MEMORY before including system.h to > use make-unique.h" > +#endif > + > +/* Minimal implementation of make_unique for C++11 compatibility > +=C2=A0=C2=A0 (std::make_unique is C++14).=C2=A0 */ > + > +template > +inline typename std::enable_if::value, > std::unique_ptr>::type > +make_unique(Args&&... args) > +{ > +=C2=A0 return std::unique_ptr (new T (std::forward (args)...)); > +} > + > +#endif /* ! GCC_MAKE_UNIQUE */