devel/*/gdb: do not assume that time_t is long

llvm22 rightly objects to this
This commit is contained in:
naddy
2026-05-21 23:30:09 +00:00
parent 0d991b6540
commit a1b4ae3c90
10 changed files with 133 additions and 2 deletions
+1 -1
View File
@@ -2,7 +2,7 @@ COMMENT= gdb for arm-none-eabi cross-development
DISTNAME= gdb-7.12.1
EXTRACT_SUFX= .tar.xz
REVISION= 1
REVISION= 2
HOMEPAGE= https://www.gnu.org/software/gdb/
@@ -0,0 +1,12 @@
Index: include/gdb/callback.h
--- include/gdb/callback.h.orig
+++ include/gdb/callback.h
@@ -82,7 +82,7 @@ struct host_callback_struct
int (*read_stdin) ( host_callback *, char *, int);
int (*rename) (host_callback *, const char *, const char *);
int (*system) (host_callback *, const char *);
- long (*time) (host_callback *, long *);
+ time_t (*time) (host_callback *, time_t *);
int (*unlink) (host_callback *, const char *);
int (*write) (host_callback *,int, const char *, int);
int (*write_stdout) (host_callback *, const char *, int);
@@ -0,0 +1,21 @@
Index: sim/common/callback.c
--- sim/common/callback.c.orig
+++ sim/common/callback.c
@@ -421,10 +421,14 @@ os_system (host_callback *p, const char *s)
return wrap (p, system (s));
}
-static long
-os_time (host_callback *p, long *t)
+static time_t
+os_time (host_callback *p, time_t *t)
{
- return wrap (p, time (t));
+ time_t result;
+
+ result = time(t);
+ p->last_errno = errno;
+ return result;
}
@@ -0,0 +1,15 @@
Index: sim/common/sim-io.c
--- sim/common/sim-io.c.orig
+++ sim/common/sim-io.c
@@ -66,9 +66,9 @@ sim_io_unlink (SIM_DESC sd,
}
-long
+time_t
sim_io_time (SIM_DESC sd,
- long *t)
+ time_t *t)
{
return STATE_CALLBACK (sd)->time (STATE_CALLBACK (sd), t);
}
@@ -0,0 +1,12 @@
Index: sim/common/sim-io.h
--- sim/common/sim-io.h.orig
+++ sim/common/sim-io.h
@@ -31,7 +31,7 @@ int sim_io_shutdown (SIM_DESC sd);
int sim_io_unlink (SIM_DESC sd, const char *);
-long sim_io_time (SIM_DESC sd, long *);
+time_t sim_io_time (SIM_DESC sd, time_t *);
int sim_io_system (SIM_DESC sd, const char *);
+1 -1
View File
@@ -2,7 +2,7 @@ TOOL= gdb
TOOL_V= 7.2a
LTS_V= 20111205
REVISION= 4
REVISION= 5
GNU_TOOL= Yes
@@ -0,0 +1,12 @@
Index: include/gdb/callback.h
--- include/gdb/callback.h.orig
+++ include/gdb/callback.h
@@ -81,7 +81,7 @@ struct host_callback_struct
int (*read_stdin) ( host_callback *, char *, int);
int (*rename) (host_callback *, const char *, const char *);
int (*system) (host_callback *, const char *);
- long (*time) (host_callback *, long *);
+ time_t (*time) (host_callback *, time_t *);
int (*unlink) (host_callback *, const char *);
int (*write) (host_callback *,int, const char *, int);
int (*write_stdout) (host_callback *, const char *, int);
@@ -0,0 +1,32 @@
Index: sim/common/callback.c
--- sim/common/callback.c.orig
+++ sim/common/callback.c
@@ -74,7 +74,7 @@ extern int system PARAMS ((const char *));
static int os_init PARAMS ((host_callback *));
static int os_shutdown PARAMS ((host_callback *));
static int os_unlink PARAMS ((host_callback *, const char *));
-static long os_time PARAMS ((host_callback *, long *));
+static time_t os_time PARAMS ((host_callback *, time_t *));
static int os_system PARAMS ((host_callback *, const char *));
static int os_rename PARAMS ((host_callback *, const char *, const char *));
static int os_write_stdout PARAMS ((host_callback *, const char *, int));
@@ -496,12 +496,16 @@ os_system (p, s)
return wrap (p, system (s));
}
-static long
+static time_t
os_time (p, t)
host_callback *p;
- long *t;
+ time_t *t;
{
- return wrap (p, time (t));
+ time_t result;
+
+ result = time(t);
+ p->last_errno = errno;
+ return result;
}
@@ -0,0 +1,15 @@
Index: sim/common/sim-io.c
--- sim/common/sim-io.c.orig
+++ sim/common/sim-io.c
@@ -66,9 +66,9 @@ sim_io_unlink(SIM_DESC sd,
}
-long
+time_t
sim_io_time(SIM_DESC sd,
- long *t)
+ time_t *t)
{
return STATE_CALLBACK (sd)->time (STATE_CALLBACK (sd), t);
}
@@ -0,0 +1,12 @@
Index: sim/common/sim-io.h
--- sim/common/sim-io.h.orig
+++ sim/common/sim-io.h
@@ -31,7 +31,7 @@ int sim_io_shutdown (SIM_DESC sd);
int sim_io_unlink (SIM_DESC sd, const char *);
-long sim_io_time (SIM_DESC sd, long *);
+time_t sim_io_time (SIM_DESC sd, time_t *);
int sim_io_system (SIM_DESC sd, const char *);