]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
callback.h:struct host_callback_struct compilation error on Windows hosts.
authorJoel Brobecker <brobecker@adacore.com>
Wed, 3 Dec 2014 07:33:13 +0000 (02:33 -0500)
committerJoel Brobecker <brobecker@adacore.com>
Wed, 3 Dec 2014 09:43:08 +0000 (13:43 +0400)
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) <to_stat>: Renamed
from "stat".
<to_fstat>: Renamed from "fstat".
<to_lstat>: 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
include/gdb/callback.h
sim/common/ChangeLog
sim/common/sim-io.c
sim/common/syscall.c
sim/cris/ChangeLog
sim/cris/traps.c
sim/h8300/ChangeLog
sim/h8300/compile.c

index 135391d42427fba4260d5c8bf15956bfa6f32695..7ec304cf7aff777b3b9cd1638f4b8afaed1da88d 100644 (file)
@@ -1,3 +1,10 @@
+2014-12-03  Joel Brobecker  <brobecker@adacore.com>
+
+       * callback.h (struct host_callback_struct) <to_stat>: Renamed
+       from "stat".
+       <to_fstat>: Renamed from "fstat".
+       <to_lstat>: Renamed from "lstat".
+
 2014-03-10  Mike Frysinger  <vapier@gentoo.org>
 
        * remote-sim.h (sim_do_command): Add const to cmd.
index bb1edacaa3915cb251ce9d856f336587a2cececb..d9ac2635443b370e8dd7370b41a53a86f57b034a 100644 (file)
@@ -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 *);
index 64f208146f48d2fdf784e84e381d30686a28b0bc..3c85626c520cf57dbd772c84b95121c8d44a4547 100644 (file)
@@ -1,3 +1,11 @@
+2014-12-03  Joel Brobecker  <brobecker@adacore.com>
+
+       * 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
+
 2014-08-28  Gary Benson  <gbenson@redhat.com>
 
        * sim-trace.h (debug_printf): New define.
index 918137bacd482d2c2562043928f0d1fcaa92fd2a..1114ec6138ec799e4307e8a52078d1d128e9e261 100644 (file)
@@ -391,11 +391,11 @@ sim_io_poll_read (SIM_DESC sd,
 int
 sim_io_stat (SIM_DESC sd, const char *path, struct stat *buf)
 {
-  return STATE_CALLBACK (sd)->stat (STATE_CALLBACK (sd), path, buf);
+  return STATE_CALLBACK (sd)->to_stat (STATE_CALLBACK (sd), path, buf);
 }
 
 int
 sim_io_fstat (SIM_DESC sd, int fd, struct stat *buf)
 {
-  return STATE_CALLBACK (sd)->fstat (STATE_CALLBACK (sd), fd, buf);
+  return STATE_CALLBACK (sd)->to_fstat (STATE_CALLBACK (sd), fd, buf);
 }
index 397cd80c504422c4cd5d25c860dfa796054a9fb1..b5cb1caf6963602a8370da8266e51a98b0ab32e6 100644 (file)
@@ -455,7 +455,7 @@ cb_syscall (host_callback *cb, CB_SYSCALL *sc)
            result = -1;
            goto FinishSyscall;
          }
-       result = (*cb->stat) (cb, path, &statbuf);
+       result = (*cb->to_stat) (cb, path, &statbuf);
        free (path);
        if (result < 0)
          goto ErrorFinish;
@@ -488,7 +488,7 @@ cb_syscall (host_callback *cb, CB_SYSCALL *sc)
        struct stat statbuf;
        TADDR addr = sc->arg2;
 
-       result = (*cb->fstat) (cb, sc->arg1, &statbuf);
+       result = (*cb->to_fstat) (cb, sc->arg1, &statbuf);
        if (result < 0)
          goto ErrorFinish;
        buflen = cb_host_to_target_stat (cb, NULL, NULL);
@@ -526,7 +526,7 @@ cb_syscall (host_callback *cb, CB_SYSCALL *sc)
            result = -1;
            goto FinishSyscall;
          }
-       result = (*cb->lstat) (cb, path, &statbuf);
+       result = (*cb->to_lstat) (cb, path, &statbuf);
        free (path);
        if (result < 0)
          goto ErrorFinish;
index 4801f1451aa0c5dedcfcfe78846848c6be9616a3..ad903fb2f1b9b58c28c012d68bf3e2506da8e5c7 100644 (file)
@@ -1,3 +1,8 @@
+2014-12-03  Joel Brobecker  <brobecker@adacore.com>
+
+       * traps.c (cris_break_13_handler): Adjust call to "fstat" callback
+       by call to "to_fstat" following renaming in callback.h.
+
 2014-08-19  Alan Modra  <amodra@gmail.com>
 
        * configure: Regenerate.
index 35dce3cca756f154dce2fdbdb1afb6c4117c79ee..c50f04f236d5447f85acfe0cbd68703948bc7473 100644 (file)
@@ -2204,7 +2204,7 @@ cris_break_13_handler (SIM_CPU *current_cpu, USI callnum, USI arg1,
                || ((events = sim_core_read_unaligned_2 (current_cpu, pc,
                                                         0, ufds + 4))
                    != TARGET_POLLIN)
-               || ((cb->fstat) (cb, fd, &buf) != 0
+               || ((cb->to_fstat) (cb, fd, &buf) != 0
                    || (buf.st_mode & S_IFIFO) == 0)
                || current_cpu->thread_data == NULL)
              {
index 62ef367c2dc6b4201f52abe54e2535137fe22fd8..16489e64852e2c552e1cb61c2fe266ae12076560 100644 (file)
@@ -1,3 +1,9 @@
+2014-12-03  Joel Brobecker  <brobecker@adacore.com>
+
+       * 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.
+
 2014-08-19  Alan Modra  <amodra@gmail.com>
 
        * configure: Regenerate.
index 348cdbbd42a6741c7964d5d87d905edaeef65b78..4deba8281f648fa021ced78eb3e62bbb5f99d1ec 100644 (file)
@@ -3062,7 +3062,8 @@ sim_resume (SIM_DESC sd, int step, int siggnal)
            stat_ptr = (h8300hmode && !h8300_normal_mode) ? GET_L_REG (1) : GET_W_REG (1);
 
            /* Callback stat and return.  */
-           fstat_return = sim_callback->fstat (sim_callback, fd, &stat_rec);
+           fstat_return = sim_callback->to_fstat (sim_callback, fd,
+                                                  &stat_rec);
 
            /* Have stat_ptr point to starting of stat_rec.  */
            temp_stat_ptr = (char *) (&stat_rec);
@@ -3136,7 +3137,7 @@ sim_resume (SIM_DESC sd, int step, int siggnal)
 
            /* Callback stat and return.  */
            stat_return =
-             sim_callback->stat (sim_callback, filename, &stat_rec);
+             sim_callback->to_stat (sim_callback, filename, &stat_rec);
 
            /* Have stat_ptr point to starting of stat_rec.  */
            temp_stat_ptr = (char *) (&stat_rec);