From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from xry111.site (xry111.site [89.208.246.23]) by sourceware.org (Postfix) with ESMTPS id C3C8B3858C41 for ; Fri, 19 May 2023 13:03:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C3C8B3858C41 Authentication-Results: sourceware.org; dmarc=pass (p=reject dis=none) header.from=xry111.site Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=xry111.site DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=xry111.site; s=default; t=1684501429; bh=SNc5JRt/7RH/nA0F3skOqVmdOTuHdUuXLAEaPUPBKK0=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=UbtuBT3JXJFfui3qquyWEXjDbWDs5XWkQz6Jud0oY64AQpcptDn6MVWFC7AcLHWUN uzQVQvnOtv+wiZCzvndlTCJ33Lslbd5UXjE9fKn3ofo7XlDGkV7QWszWnoWuCNIVmV zRNjbcFW7PGfy2lwt+y0dw2yRn5ov3UGODo+9t4I= Received: from [192.168.124.8] (unknown [113.140.11.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature ECDSA (P-384) server-digest SHA384) (Client did not present a certificate) (Authenticated sender: xry111@xry111.site) by xry111.site (Postfix) with ESMTPSA id D978565B9E; Fri, 19 May 2023 09:03:47 -0400 (EDT) Message-ID: <93403e420952c324665840cb924666023d438da4.camel@xry111.site> Subject: Re: [PATCH] libio: Add nonnull attribute for most FILE * arguments in stdio.h From: Xi Ruoyao To: Alejandro Colomar , libc-alpha@sourceware.org Cc: Adhemerval Zanella Netto , Carlos O'Donell Date: Fri, 19 May 2023 21:03:45 +0800 In-Reply-To: <651c313c-edf7-7655-e58b-34d4c22eb34d@gmail.com> References: <20230518172511.2130831-1-xry111@xry111.site> <528cf363cd06bc0055a4275eda4010ce67c4a4fa.camel@xry111.site> <728611bb98d6a6fc868ba54609c140b9d280c76a.camel@xry111.site> <651c313c-edf7-7655-e58b-34d4c22eb34d@gmail.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.48.1 MIME-Version: 1.0 X-Spam-Status: No, score=1.5 required=5.0 tests=BAYES_00,BODY_8BITS,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,KAM_SHORT,LIKELY_SPAM_FROM,RCVD_IN_BARRACUDACENTRAL,SPF_HELO_PASS,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Level: * X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Fri, 2023-05-19 at 14:40 +0200, Alejandro Colomar wrote: > On 5/19/23 07:21, Xi Ruoyao via Libc-alpha wrote: > > On Fri, 2023-05-19 at 12:13 +0800, Xi Ruoyao wrote: > > > On Thu, 2023-05-18 at 20:29 +0200, Alex Colomar wrote: >=20 > [...] >=20 > > >=20 > > > I guess when I took the note on the paper I misspelled "fflush" as > > > "setbuf" for some reason (maybe lack of coffee :( ). > > >=20 > > > I'll retest all the changes in one hour or two hours. > >=20 > > I've sent v2 with the mistakes in fflush, fflush_unlocked, and > > setbuf > > fixed.=C2=A0 Thanks for pointing out my mistake! > > > I guess I need to avoid creating a patch at 0100 AM in the future > > :). >=20 > I'm glad to help :-) >=20 > How about fclose(3)?=C2=A0 Was it left out on purpose, or was it a sleep(= 0) > issue too? :p It was done at https://sourceware.org/git/?p=3Dglibc.git;a=3Dcommit;h=3D71d9e0fe Actually fclose is the start point of this __nonnull addition: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D109570 But unfortunately in Apr I didn't have enough time to check the entire stdio.h function by function. Then in the following discussion for the GCC PR we found ferror should have __nonnull too and I decided to check all stdio.h functions this time. >=20 > On 5/18/23 20:06, Alex Colomar via Libc-alpha wrote: > =C2=A0>> @@ -878,7 +883,7 @@ extern int fileno_unlocked (FILE *__stream) > =C2=A0>> __THROW __wur; > =C2=A0>>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 This function is a possible cancel= lation point and therefore > not > =C2=A0>>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 marked with __THROW.=C2=A0 */ > =C2=A0>> -extern int pclose (FILE *__stream); > =C2=A0>> +extern int pclose (FILE *__stream) __nonnull ((1)); > =C2=A0> > =C2=A0> You didn't patch fclose(3).=C2=A0 Any reason?=C2=A0 I guess it's = similarly UB > to > =C2=A0> call fclose(NULL). >=20 > Cheers, > Alex >=20 > >=20 >=20 > --=20 > > GPG key fingerprint: A9348594CE31283A826FBDD8D57633D441E25BB5 >=20 --=20 Xi Ruoyao School of Aerospace Science and Technology, Xidian University