From 2d7bb7580ac174127f8ae127ebc4156a91035fc0 Mon Sep 17 00:00:00 2001 From: Joel Brobecker Date: Wed, 3 Dec 2014 02:33:13 -0500 Subject: callback.h:struct host_callback_struct compilation error on Windows hosts. On Windows, a recent gnulib update imported the lstat module, and this caused a remote-sim.c build failure in struct host_callback_struct: In file included from /[...]/gdb/remote-sim.c:34:0: /[...]/gdb/../include/gdb/callback.h:93:9: error: duplicate member '_stati64' int (*lstat) (host_callback *, const char *, struct stat *); ^ What happens it that gnulib's stat.h makes the following defines: /* Large File Support on native Windows. */ #if 1 # define stat _stati64 #endif and then: #if 1 # if ! 0 /* mingw does not support symlinks, therefore it does not have lstat. But without links, stat does just fine. */ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define lstat stat # endif So, the following fields in struct host_callback_struct... int (*stat) (host_callback *, const char *, struct stat *); int (*fstat) (host_callback *, int, struct stat *); int (*lstat) (host_callback *, const char *, struct stat *); ... get translated to... int (*_stati64) (host_callback *, const char *, struct _stati64 *); int (*_fstati64) (host_callback *, int, struct _stati64 *); int (*_stati64) (host_callback *, const char *, struct _stati64 *); ... which causes two fields to have the same name. This patch fixes the issue by renaming the stat-related fields by adding a "to_" prefix, similar to what is done in GDB's target_ops vector. include/gdb/ChangeLog: * callback.h (struct host_callback_struct) : Renamed from "stat". : Renamed from "fstat". : Renamed from "lstat". sim/common/ChangeLog: * sim-io.c (sim_io_stat, sim_io_fstat): Adjust calls to "stat" and "fstat" callbacks by calls to "to_stat" and "to_fstat" (resp) callbacks following renaming in callback.h. * syscall.c (cb_syscall): Likewise. Adjust calls to "lstat" callback by call to "to_lstat" callback sim/cris/ChangeLog: * traps.c (cris_break_13_handler): Adjust call to "fstat" callback by call to "to_fstat" following renaming in callback.h. sim/h8300/ChangeLog: * compile.c (sim_resume): Adjust calls to "stat" and "fstat" callbacks by calls to "to_stat" and "to_fstat" (resp) callbacks following renaming in callback.h. --- include/gdb/ChangeLog | 7 +++++++ include/gdb/callback.h | 6 +++--- 2 files changed, 10 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/gdb/ChangeLog b/include/gdb/ChangeLog index 135391d..7ec304c 100644 --- a/include/gdb/ChangeLog +++ b/include/gdb/ChangeLog @@ -1,3 +1,10 @@ +2014-12-03 Joel Brobecker + + * callback.h (struct host_callback_struct) : Renamed + from "stat". + : Renamed from "fstat". + : Renamed from "lstat". + 2014-03-10 Mike Frysinger * remote-sim.h (sim_do_command): Add const to cmd. diff --git a/include/gdb/callback.h b/include/gdb/callback.h index bb1edac..d9ac263 100644 --- a/include/gdb/callback.h +++ b/include/gdb/callback.h @@ -88,9 +88,9 @@ struct host_callback_struct void (*flush_stdout) (host_callback *); int (*write_stderr) (host_callback *, const char *, int); void (*flush_stderr) (host_callback *); - int (*stat) (host_callback *, const char *, struct stat *); - int (*fstat) (host_callback *, int, struct stat *); - int (*lstat) (host_callback *, const char *, struct stat *); + int (*to_stat) (host_callback *, const char *, struct stat *); + int (*to_fstat) (host_callback *, int, struct stat *); + int (*to_lstat) (host_callback *, const char *, struct stat *); int (*ftruncate) (host_callback *, int, long); int (*truncate) (host_callback *, const char *, long); int (*pipe) (host_callback *, int *); -- cgit v1.1