summaryrefslogtreecommitdiff
path: root/gdb/main.c
diff options
context:
space:
mode:
authorJohn Baldwin <jhb@FreeBSD.org>2016-04-19 13:51:05 -0700
committerJohn Baldwin <jhb@FreeBSD.org>2016-04-19 15:41:56 -0700
commitf39c07acc8c4039534a9c6f1757de82afe66ecd5 (patch)
tree615ff703326ba7410ea8f81898d2629b93d4d355 /gdb/main.c
parent537aefaf18444430df8126b474cf11ff7201b4c6 (diff)
Cast the pointer assigned to ss_sp to char *.
FreeBSD versions older than 11.0 use char * as the type of ss_sp in stack_t instead of the standards-defined void *. C++ allows a char * pointer to be converted to a void *, so it is safe to cast the return value of xmalloc to char * if ss_sp is either a char * or void *. Just always use the cast to char * since that is less ugly than having to add a special case. gdb/ChangeLog: * main.c (setup_alternate_signal_stack): Cast to char *.
Diffstat (limited to 'gdb/main.c')
-rw-r--r--gdb/main.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/gdb/main.c b/gdb/main.c
index c149b708bf..2ce17136df 100644
--- a/gdb/main.c
+++ b/gdb/main.c
@@ -297,7 +297,9 @@ setup_alternate_signal_stack (void)
#ifdef HAVE_SIGALTSTACK
stack_t ss;
- ss.ss_sp = xmalloc (SIGSTKSZ);
+ /* FreeBSD versions older than 11.0 use char * for ss_sp instead of
+ void *. This cast works with both types. */
+ ss.ss_sp = (char *) xmalloc (SIGSTKSZ);
ss.ss_size = SIGSTKSZ;
ss.ss_flags = 0;