From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by sourceware.org (Postfix) with ESMTP id 6BB023861030 for ; Thu, 6 Aug 2020 15:05:25 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 6BB023861030 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-430-J-rOss2DPuqJGERWm2QgPA-1; Thu, 06 Aug 2020 11:05:23 -0400 X-MC-Unique: J-rOss2DPuqJGERWm2QgPA-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 35C24100AA27; Thu, 6 Aug 2020 15:05:22 +0000 (UTC) Received: from localhost (unknown [10.33.36.145]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8DF9587A65; Thu, 6 Aug 2020 15:05:21 +0000 (UTC) Date: Thu, 6 Aug 2020 16:05:20 +0100 From: Jonathan Wakely To: Martin Sebor Cc: Martin Sebor , Jakub Jelinek , libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: Re: [committed] libstdc++: Replace operator>>(istream&, char*) [LWG 2499] Message-ID: <20200806150520.GC3400@redhat.com> References: <20200805212500.GA2013665@redhat.com> <5a18ba7e-e550-72b9-150f-ce7abed339fd@redhat.com> <20200806131448.GY3400@redhat.com> <20200806133051.GZ3400@redhat.com> <65eddee9-f07c-b717-1a66-8c05a3e45fc4@gmail.com> MIME-Version: 1.0 In-Reply-To: <65eddee9-f07c-b717-1a66-8c05a3e45fc4@gmail.com> X-Clacks-Overhead: GNU Terry Pratchett X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline X-Spam-Status: No, score=-9.3 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, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Aug 2020 15:05:26 -0000 On 06/08/20 08:56 -0600, Martin Sebor via Libstdc++ wrote: >For this specific use case, I saw __istream_extract defined >as an ordinary (non-template) function in a .tcc file in >the patch so I thought it was out of line. If it's inline It's overloaded. One is a function template defined inline, the other is a non-inline function defined in the library. >or if it's a template the only workaround I can think of >to retain the warning is to have it make a call to (no-op) >function with the attribute that is not inlined. It's too >bad there is no attribute to tell the expander to avoid >emitting such a function (which would be the equivalent of >the idea I outlined in my second paragraph above). That will still fail to warn because of -Wsystem-headers. Attempting to use attributes here achieves absolutely nothing for the problem scenarios I was concerned about. The only case where it helps is passing a null pointer or a pointer to a zero-sized buffer to operator>> and not optimising. All other problematic cases fail to warn, and it's those other cases where a warning would be helpful.