Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date: Wed, 6 Oct 2021 13:49:16 +0000
From: Pascal Cuoq <>
To: "" <>
Subject: STRUCT _IO_FILE { char __x; }; as the poor C programmer's abstract


The file stdio.h contains:

#if __STDC_VERSION__ < 201112L
#define __NEED_struct__IO_FILE
#include <bits/alltypes.h>

And the file alltypes.h is generated from which contains:

STRUCT _IO_FILE { char __x; };

This means that when the compiler defines __STDC_VERSION__ to less than 201112L, a bogus definition for the type FILE and for the prototypes of functions that access values of this type can exist in files outside musl, alongside the real definition from stdio_impl.h which exists in files inside musl:

struct _IO_FILE {
        unsigned flags;
        unsigned char *rpos, *rend;
        int (*close)(FILE *);

This is at least a minor annoyance when trying to do source-level verifications on a mix of source files including some files that implement musl together with some files that use musl from the outside.

Was it only in C11 that it became possible to avoid this ugly hack?

(We stumbled on this because we happened to be doing the pre-processing with -std=c99, and I think it should be no problem to change it to be done with -std=c11, but I'm surprised nevertheless because I don't see which item in corresponds to this change between C99 and C11. Could the test be changed to ā€œ__STDC_VERSION__ < 199901Lā€?)


Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.