From f368d9fd26ae002fe2fce20add4cb2b806f48972 Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Tue, 12 Mar 2019 15:24:00 -0400 Subject: make FILE a complete type for pre-C11 standard profiles C11 removed the requirement that FILE be a complete type, which was deemed erroneous, as part of the changes introduced by N1439 regarding completeness of types (see footnote 6 for specific mention of FILE). however the current version of POSIX is still based on C99 and incorporates the old requirement that FILE be a complete type. expose an arbitrary, useless complete type definition because the actual object used to represent FILE streams cannot be public/ABI. thanks to commit 13d1afa46f8098df290008c681816c9eb89ffbdb, we now have a framework for suppressing the public complete-type definition of FILE when stdio.h is included internally, so that a different internal definition can be provided. this is perfectly well-defined, since the same struct tag can refer to different types in different translation units. it would be a problem if the implementation were accessing the application's FILE objects or vice versa, but either would be undefined behavior. --- src/include/stdio.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/include/stdio.h') diff --git a/src/include/stdio.h b/src/include/stdio.h index 534c6907..fae3755b 100644 --- a/src/include/stdio.h +++ b/src/include/stdio.h @@ -1,6 +1,8 @@ #ifndef STDIO_H #define STDIO_H +#define __DEFINED_struct__IO_FILE + #include "../../include/stdio.h" #undef stdin -- cgit v1.2.1