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 53D06385828B for ; Mon, 18 Dec 2023 07:56:43 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 53D06385828B Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 53D06385828B Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1702886204; cv=none; b=BvIPSl9gc5qAd2GMxvJdJhBLWBXzsdpHgz4HCDyAe86IZlCNKYMRAvv23c/I+w5EPVDmUiorx1n/pwsoX4kAQkb2X9+x8dV05qBKx3yDsWeo8YDAMBgSbbcanG44kXX87y/mo2avUYdLJhQtJUgWiVSuBwEyDkosXF4gHXUO10Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1702886204; c=relaxed/simple; bh=JhM3Av9IAtxEjjNeirtU0Wf5vSbL7Ah3RKbo/uBvGpk=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=f1HTIZ0QyZH07SxZi4+Ou5w7W+OE5jBQRGtBZOJQxRYKkG4yDAgBo/DijDpe862dq438vY7EogwohToPTLVm2nYKzyHhLY6U7pJCBzUlV0H3sWjmEGCfptE5I1PpDsQAPXQIPXwOIYn0ifndgUBmhmTf3WplSblxg5RwnB2dWYQ= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1702886203; 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=N3UENFtgwwNqTuU4iZfdEjnPlbilf1F0q0J7p+w/uMs=; b=C18CkQMY1/wduXftf8yBGR1Ml/KwSD6CDnX+O3pyQ6JYTeur+auvJP9SOmVsj6Za9z38lU YlGaHdtAquTeCmNxiNLC3s8taO0nFP56ZRUhaif+lP2hvpxfikKYCbZk/zBj8mr6r8g6Kl yVez7Zj7yDIGrbWVWn50KbSck5UChT4= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-690-zvhcb9uNOYym6DoXupGwCg-1; Mon, 18 Dec 2023 02:56:37 -0500 X-MC-Unique: zvhcb9uNOYym6DoXupGwCg-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 0CE408A7F42; Mon, 18 Dec 2023 07:56:37 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.39.192.92]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A3EF11C060B1; Mon, 18 Dec 2023 07:56:36 +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 3BI7uXZA1267694 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Mon, 18 Dec 2023 08:56:34 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.17.1/8.17.1/Submit) id 3BI7uWZh1267693; Mon, 18 Dec 2023 08:56:32 +0100 Date: Mon, 18 Dec 2023 08:56:31 +0100 From: Jakub Jelinek To: YunQiang Su Cc: gcc-patches@gcc.gnu.org, ian@airs.com, pinskia@gmail.com, matoro_mailinglist_gcc-patches@matoro.tk Subject: Re: [PATCH 2/2] libiberty/reconcat: Add note about append string to NULL Message-ID: Reply-To: Jakub Jelinek References: <20231218034422.2668628-1-syq@gcc.gnu.org> <20231218034422.2668628-2-syq@gcc.gnu.org> MIME-Version: 1.0 In-Reply-To: <20231218034422.2668628-2-syq@gcc.gnu.org> X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.7 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=-9.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 Mon, Dec 18, 2023 at 11:44:22AM +0800, YunQiang Su wrote: > For reconcat, if the `optr` can only be used as the last one > of string list, aka, we cannot append something to it. > Let's add some note into the document. > > libiberty: > * concat.c (reconcat): Add note about append string to NULL > into document. > --- > libiberty/concat.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/libiberty/concat.c b/libiberty/concat.c > index 4cb1df3baf3..3a6b4ca71e8 100644 > --- a/libiberty/concat.c > +++ b/libiberty/concat.c > @@ -169,6 +169,9 @@ loop: > str = reconcat (str, "pre-", str, NULL); > @end example > > +Note: don't try to append string(s) to the a NULL string, > +as the process will stop at the first NULL argument. > + > @end deftypefn I think this is unnecessary and misleading. The fact that NULL is the variable argument terminator is already clearly documented, and first argument to reconcat can be NULL just fine, so one just needs to be careful. Jakub