On 09 Dec 2021 07:02, Tom Tromey wrote: > For a Windows-hosted build with arm-elf as the target, the sim build > fails like: what is your --host ? guessing it's a mingw toolchain. > [...]sim-io.c:214:29: error: 'struct host_callback_struct' has no member named 'open' > > The recent header reorganization seems to have caused this, because > now 'open' is redefined by the gnulib fcntl.h. yeah, i think that's why it started breaking. > The fix is simple: remove the undef of 'open' from sim-io.c. mmm, not that simple. the error you're seeing is because the open macro rewrote the host_callback_struct structure. and then we tried to use it, but they no longer matched. include/sim/callback.h: struct host_callback_struct { int (*open) (host_callback *, const char*, int mode); common/sim-io.c: int sim_io_open (SIM_DESC sd, const char *name, int flags) { return STATE_CALLBACK (sd)->open (STATE_CALLBACK (sd), name, flags); } i'm not keen on relying on open being defined to a simple symbol name and thus it will continue to compile. if it's defined to something more complicated, i imagine it will still fail to compile. #define open(args...) _foo_open(1234, ## args) so i think it's better to move the undef between the system includes and the local sim includes so it's undone for the header & source. this file doesn't use actual open() call, so should be fine. -mike --- a/sim/common/sim-io.c +++ b/sim/common/sim-io.c @@ -33,12 +33,12 @@ #include #endif +#undef open + #include "sim-main.h" #include "sim-io.h" #include "sim/callback.h" -#undef open - /* Define the rate at which the simulator should poll the host for a quit. */ #ifndef POLL_QUIT_INTERVAL