Fix sol-thread.c compilation on Solaris
authorRainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
Thu, 30 Nov 2017 09:57:04 +0000 (10:57 +0100)
committerRainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
Thu, 30 Nov 2017 09:57:04 +0000 (10:57 +0100)
Building current gdb mainline with gcc 7.1 on Solaris 11.4 fails:

/vol/src/gnu/gdb/gdb/dist/gdb/sol-thread.c: In function `void _initialize_sol_thread()':
/vol/src/gnu/gdb/gdb/dist/gdb/sol-thread.c:1229:66: error: invalid conversion from `void (*)(char*, int)' to `void (*)(const char*, int)' [-fpermissive]
     _("Show info on Solaris user threads."), &maintenanceinfolist);
                                                                  ^
In file included from /vol/src/gnu/gdb/gdb/dist/gdb/completer.h:21:0,
                 from /vol/src/gnu/gdb/gdb/dist/gdb/symtab.h:31,
                 from /vol/src/gnu/gdb/gdb/dist/gdb/language.h:26,
                 from /vol/src/gnu/gdb/gdb/dist/gdb/frame.h:72,
                 from /vol/src/gnu/gdb/gdb/dist/gdb/gdbarch.h:39,
                 from /vol/src/gnu/gdb/gdb/dist/gdb/defs.h:557,
                 from /vol/src/gnu/gdb/gdb/dist/gdb/sol-thread.c:51:
/vol/src/gnu/gdb/gdb/dist/gdb/command.h:140:33: note:   initializing argument 3 of `cmd_list_element* add_cmd(const char*, command_class, void (*)(const char*, int), const char*, cmd_list_element**)'
 extern struct cmd_list_element *add_cmd (const char *, enum command_class,
                                 ^~~~~~~

The following patch allows compilation to succeed on i386-pc-solaris2.11
and sparc-sun-solaris2.11.

* sol-thread.c (info_solthreads): Constify args.
Cast args to void *.

gdb/ChangeLog
gdb/sol-thread.c

index d6cbba8aeb126f9ed5f3fb9b923ef7ddf327ce5f..73685e6d253d773132ab6f7afe19abac7c67d90d 100644 (file)
@@ -1,3 +1,8 @@
+2017-11-30  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
+
+       * sol-thread.c (info_solthreads): Constify args.
+       Cast args to void *.
+
 2017-11-29  John Baldwin  <jhb@FreeBSD.org>
 
        * target-float.c [HAVE_LIBMPFR]: Define MPFR_USE_INTMAX_T.
index c5219148bdc9447689f2cb48de45b3767a6d87b1..5f07a3c93e3c922828e2735059333877ce41d72d 100644 (file)
@@ -1122,9 +1122,9 @@ info_cb (const td_thrhandle_t *th, void *s)
    inferior.  */
 
 static void
-info_solthreads (char *args, int from_tty)
+info_solthreads (const char *args, int from_tty)
 {
-  p_td_ta_thr_iter (main_ta, info_cb, args,
+  p_td_ta_thr_iter (main_ta, info_cb, (void *) args,
                    TD_THR_ANY_STATE, TD_THR_LOWEST_PRIORITY,
                    TD_SIGNO_MASK, TD_THR_ANY_USER_FLAGS);
 }