Author: eadler
Date: Mon May 21 03:58:15 2018
New Revision: 333959
URL: https://svnweb.freebsd.org/changeset/base/333959

Log:
  top(1): build with WARNS=3
  
  This fixes everything but
  -Wincompatible-pointer-types-discards-qualifiers

Modified:
  head/usr.bin/top/Makefile
  head/usr.bin/top/display.c
  head/usr.bin/top/display.h
  head/usr.bin/top/machine.h
  head/usr.bin/top/top.c

Modified: head/usr.bin/top/Makefile
==============================================================================
--- head/usr.bin/top/Makefile   Mon May 21 03:36:16 2018        (r333958)
+++ head/usr.bin/top/Makefile   Mon May 21 03:58:15 2018        (r333959)
@@ -7,7 +7,7 @@ SRCS+=  sigdesc.h top.local.h
 CFLAGS+= -I ${.OBJDIR}
 MAN=   top.1
 
-WARNS?=        2
+WARNS?=        3
 
 LIBADD=        ncursesw m kvm jail
 

Modified: head/usr.bin/top/display.c
==============================================================================
--- head/usr.bin/top/display.c  Mon May 21 03:36:16 2018        (r333958)
+++ head/usr.bin/top/display.c  Mon May 21 03:58:15 2018        (r333959)
@@ -32,6 +32,7 @@
 
 #include <curses.h>
 #include <ctype.h>
+#include <stdarg.h>
 #include <stdlib.h>
 #include <string.h>
 #include <strings.h>
@@ -1042,14 +1043,16 @@ display_header(int t)
     }
 }
 
-/*VARARGS2*/
 void
-new_message(int type, char *msgfmt, caddr_t a1, caddr_t a2, caddr_t a3)
+new_message(int type, char *msgfmt, ...)
 {
-    int i;
+    va_list args;
+    size_t i;
 
+    va_start(args, msgfmt);
+
     /* first, format the message */
-    snprintf(next_msg, sizeof(next_msg), msgfmt, a1, a2, a3);
+    snprintf(next_msg, sizeof(next_msg), msgfmt, args);
 
     if (msglen > 0)
     {

Modified: head/usr.bin/top/display.h
==============================================================================
--- head/usr.bin/top/display.h  Mon May 21 03:36:16 2018        (r333958)
+++ head/usr.bin/top/display.h  Mon May 21 03:58:15 2018        (r333959)
@@ -27,7 +27,7 @@ void   i_procstates(int total, int *brkdn);
 void    i_swap(int *stats);
 void    i_timeofday(time_t *tod);
 void    i_uptime(struct timeval *bt, time_t *tod);
-void    new_message();
+void    new_message(int type, char *msgfmt, ...);
 int     readline(char *buffer, int size, int numeric);
 char   *trim_header(char *text);
 void    u_arc(int *stats);

Modified: head/usr.bin/top/machine.h
==============================================================================
--- head/usr.bin/top/machine.h  Mon May 21 03:36:16 2018        (r333958)
+++ head/usr.bin/top/machine.h  Mon May 21 03:58:15 2018        (r333959)
@@ -91,4 +91,8 @@ int    proc_owner(int pid);
 /* non-int routines typically used by the machine dependent module */
 char   *printable(char *string);
 
+caddr_t
+get_process_info(struct system_info *si, struct process_select *sel,
+    int (*compare)(const void *, const void *));
+
 #endif /* MACHINE_H */

Modified: head/usr.bin/top/top.c
==============================================================================
--- head/usr.bin/top/top.c      Mon May 21 03:36:16 2018        (r333958)
+++ head/usr.bin/top/top.c      Mon May 21 03:58:15 2018        (r333959)
@@ -221,7 +221,7 @@ char *argv[];
     int displays = 0;          /* indicates unspecified */
     int sel_ret = 0;
     time_t curr_time;
-    char *(*get_userid)() = username;
+    char *(*get_userid)(int) = username;
     char *uname_field = "USERNAME";
     char *header_text;
     char *env_top;
@@ -625,7 +625,7 @@ restart:
 
     while ((displays == -1) || (displays-- > 0))
     {
-       int (*compare)();
+       int (*compare)(const void * const, const void * const);
 
            
        /* get the current stats */
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to