From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/13606 Path: news.gmane.org!.POSTED!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: Re: Minor C99 conformance issue: FILE is an incomplete type Date: Wed, 16 Jan 2019 15:20:00 -0500 Message-ID: <20190116202000.GJ23599@brightrain.aerifal.cx> References: <50ae7061-5b41-f046-b6b5-4a26f09a8cca@adelielinux.org> <20190116193302.GI23599@brightrain.aerifal.cx> <20190116195715.GM21289@port70.net> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: blaine.gmane.org 1547669888 31875 195.159.176.226 (16 Jan 2019 20:18:08 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 16 Jan 2019 20:18:08 +0000 (UTC) User-Agent: Mutt/1.5.21 (2010-09-15) To: musl@lists.openwall.com Original-X-From: musl-return-13622-gllmg-musl=m.gmane.org@lists.openwall.com Wed Jan 16 21:18:04 2019 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by blaine.gmane.org with smtp (Exim 4.84_2) (envelope-from ) id 1gjrdT-0008CY-IG for gllmg-musl@m.gmane.org; Wed, 16 Jan 2019 21:18:03 +0100 Original-Received: (qmail 17878 invoked by uid 550); 16 Jan 2019 20:20:13 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Original-Received: (qmail 17848 invoked from network); 16 Jan 2019 20:20:12 -0000 Content-Disposition: inline In-Reply-To: <20190116195715.GM21289@port70.net> Original-Sender: Rich Felker Xref: news.gmane.org gmane.linux.lib.musl.general:13606 Archived-At: On Wed, Jan 16, 2019 at 08:57:15PM +0100, Szabolcs Nagy wrote: > * Rich Felker [2019-01-16 14:33:02 -0500]: > > On Wed, Jan 16, 2019 at 01:25:57PM -0600, A. Wilcox wrote: > > > On 01/16/19 13:06, Keith Thompson wrote: > > > > The musl 1.0.0 manual says that it's intended to conform to C99. > > > > > > > > Both the C99 and C11 standards require FILE to be an object type. > > > > > > > > In C99, incomplete types are not object types. In C11, the definition > > > > of "object type" was changed, so now incomplete types are object types. > > > > (See section C99 and C11 6.2.5, C99 7.19.1, C11 7.21.1.) > > > > > > > > So, in C99 FILE is not permitted to be an incomplete type, but in C11 > > > > it is. (The section describing type FILE did not change. I don't > > > > know whether the authors of the standard actually intended to change > > > > the requirement.) > > > > > > > > Using musl-gcc, FILE is an incomplete type, so it conforms to C11 > > > > but not to C99. could be modified so that, for example, > > > > it pays attention to the value of __STDC_VERSION__ to decide how to > > > > define FILE (whether to make struct _IO_FILE visible). > > > > The real struct _IO_FILE cannot be made visible because its size and > > representation are not public or preserved across versions. A fake one > > could be; the reason it hasn't been is that it requires extra work to > > suppress the fake definition inside libc. But it could be done, > > especially now with the internal wrapper headers (commit > > 13d1afa46f8098df290008c681816c9eb89ffbdb and related work). > > i assume the only point of a fake FILE is to satisfy some > conformance test that uses sizeof(FILE) and not useful in > any other way.. which means it's not really relevant in > practice. I don't see any other purpose. You can't even portably make sentinel FILE objects with address guaranteed to compare not-equal to any actual open FILE, since FILE* need not actually be a valid pointer to anything (it could be some sort of opaque handle representable in a pointer type). Rich