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 574D6387545E for ; Fri, 29 Sep 2023 10:07:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 574D6387545E 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=1695982055; h=from:from:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references; bh=Igy3lnrr3VlRARy8PkZkG4vWg5kRYFNpZkEl1Db+jkI=; b=aJe1Pz5TgKanH08BVRWiFUBnNQO8KZQGYOOmwf9ENG0bxZ8PRyFQvD5xQF5vJnv8HqlMFh SMxY0MGqhRJdUcCTyDX0MtQNneNNX7JSb1YkgpPaFfPwfj+TqdxilsZ6ypxg395qkqCGQU +j4PoAJYl6QS7fBnmJ4wqfSU1s8xQDY= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-600-35rjl9afP7KSfO-AeoQ_ew-1; Fri, 29 Sep 2023 06:07:32 -0400 X-MC-Unique: 35rjl9afP7KSfO-AeoQ_ew-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A69601DD35D1; Fri, 29 Sep 2023 10:07:31 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.39.193.202]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6066A2156A27; Fri, 29 Sep 2023 10:07:31 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.17.1/8.17.1) with ESMTPS id 38TA7SHK992125 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Fri, 29 Sep 2023 12:07:28 +0200 Received: (from jakub@localhost) by tucnak.zalov.cz (8.17.1/8.17.1/Submit) id 38TA7Rak992124; Fri, 29 Sep 2023 12:07:27 +0200 Date: Fri, 29 Sep 2023 12:07:27 +0200 From: Jakub Jelinek To: Jonathan Wakely Cc: Richard Biener , Richard Sandiford , gcc-patches@gcc.gnu.org Subject: Re: [PATCH] vec.h, v3: Make some ops work with non-trivially copy constructible and/or destructible types Message-ID: Reply-To: Jakub Jelinek References: MIME-Version: 1.0 In-Reply-To: X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-0.9 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=no 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, Sep 29, 2023 at 11:00:01AM +0100, Jonathan Wakely wrote: > > +/* Destruct N elements in DST. */ > > + > > +template > > +inline void > > +vec_destruct (T *dst, unsigned n) > > +{ > > + for ( ; n; ++dst, --n) > > + dst->~T (); > > +} > > + > > /* Control data for vectors. This contains the number of allocated > > and used slots inside a vector. */ > > > > @@ -310,6 +338,9 @@ va_heap::release (vec > if (v == NULL) > > return; > > > > + if (!std::is_trivially_destructible ::value) > > Do GCC's coding standards really require a space before the template > argument list, like for a function parameter list? > That style doesn't seem to be used elsewhere (and is not idiomatic for > C++ at all). Seems it is mixed, in gcc/ subdirectory: grep ' <[a-zA-Z]' *.h *.cc */*.h */*.cc | grep -v '#.*include' | wc -l 7143 grep '[^ ]<[a-zA-Z]' *.h *.cc */*.h */*.cc | grep -v '#.*include' | wc -l 13579 > > + template > > + struct is_trivially_copyable_or_pair > > > The space in "> >" is only required in C++98, we don't need it in C++11. I know, I was just following what code around used as well. Though admittedly that is from the days where we needed C++98 compatibility. Jakub