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.129.124]) by sourceware.org (Postfix) with ESMTPS id AF0903858D20 for ; Tue, 11 Jul 2023 08:57:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org AF0903858D20 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=1689065836; h=from:from: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=+BlcrysZP+kr+8M9+pO7ttzD+TrrU9sQcaA/bTZho7k=; b=UpTQSKkMhPQEurtS/bqDTvurNdx+NF8pHwzDyD23juFF1uTwSbbljUSfFS4YfhfwSJ9rZm /RadRClSpQEW/4F1XGogNJWAGaN1n/EMFFCFESL4mWJusGRSQBHCJM5qwEPT67PI+dVMYj eLlY5u2JnBLbAaveCgf1sOWmV9LI16g= Received: from mimecast-mx02.redhat.com (mx3-rdu2.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-643-QgBoCtMUM4y0_DkPOYvYsQ-1; Tue, 11 Jul 2023 04:57:13 -0400 X-MC-Unique: QgBoCtMUM4y0_DkPOYvYsQ-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id BCCDC1C09A41; Tue, 11 Jul 2023 08:57:12 +0000 (UTC) Received: from oldenburg.str.redhat.com (unknown [10.2.16.46]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E534A1401C2F; Tue, 11 Jul 2023 08:57:10 +0000 (UTC) From: Florian Weimer To: Siddhesh Poyarekar Cc: Xi Ruoyao , libc-alpha@sourceware.org, Adhemerval Zanella Netto , Carlos O'Donell , Alex Colomar , Andreas Schwab , Zack Weinberg , Jeff Law Subject: Re: [PATCH] Revert "libio: Add __nonnull for FILE * arguments of fclose and freopen" References: <20230710220659.3501429-2-xry111@xry111.site> <874jmbf2pl.fsf@oldenburg.str.redhat.com> Date: Tue, 11 Jul 2023 10:57:09 +0200 In-Reply-To: <874jmbf2pl.fsf@oldenburg.str.redhat.com> (Florian Weimer's message of "Tue, 11 Jul 2023 07:15:50 +0200") Message-ID: <87ilaqesgq.fsf@oldenburg.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-Spam-Status: No, score=-4.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_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE 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: * Florian Weimer: > * Siddhesh Poyarekar: > >> On 2023-07-10 18:07, Xi Ruoyao wrote: >>> This reverts commit 71d9e0fe766a3c22a730995b9d024960970670af. >>> Apparantly the maintainers do not like __nonnull. And I'm too >>> pissed >>> off to work on this anymore. Anyway I don't care about the analyzer so >>> they can just add these as ugly special analyzer patterns. And I'm not >>> so stupid to pass NULL to these things myself, so lacking a warning is >>> not a problem to me. >> >> Sorry you feel this way, but this is still unresolved as we don't have >> a consensus yet. However I understand if you're frustrated and don't >> want to work on this for now; I do hope you return though. >> >> In any case, if the consensus does steer towards never using >> __nonnull__, it'll likely be better to do it by hacking cdefs.h to >> expand __nonnull to nothing. > > We can do this under #ifdef _LIBC. This way, analyzers can still > benefit from the annotations, but the attribute does not affect the > glibc build. > > It doesn't make sense to maintain the nonnull-ness of glibc function > arguments outside glibc, so we should add these annotations to the > installed headers. While trying to implement that, I found this in include/sys/cdefs.h: /* The compiler will optimize based on the knowledge the parameter is not NULL. This will omit tests. A robust implementation cannot allow this so when compiling glibc itself we ignore this attribute. */ # undef __nonnull # define __nonnull(params) So the whole thing is really a non-issue, and I don't think we need to revert anything. We can stop doing that #undef dance if there's an -f flag to get the GCC behavior we want, so that we benefit from GCC diagnostics during the glibc build. Thanks, Florian