Date: Mon, 21 May 2018 09:46:31 +0100 From: Andrew Turner <andrew@fubar.geek.nz> To: Eitan Adler <eadler@freebsd.org> Cc: src-committers <src-committers@freebsd.org>, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r333959 - head/usr.bin/top Message-ID: <9F97F4FF-0148-4889-8825-0237FFD09550@fubar.geek.nz> In-Reply-To: <201805210358.w4L3wFji081505@repo.freebsd.org> References: <201805210358.w4L3wFji081505@repo.freebsd.org>
index | next in thread | previous in thread | raw e-mail
> On 21 May 2018, at 04:58, Eitan Adler <eadler@freebsd.org> wrote: > > 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) > { You missed the call to va_end. You need to call va_end within the same function, and after you have finished with args. See stdarg(3): Each invocation of va_start() or va_copy() must be paired with a corresponding invocation of va_end() in the same function. Andrewhelp
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?9F97F4FF-0148-4889-8825-0237FFD09550>
