From owner-svn-src-all@freebsd.org Mon May 21 14:01:24 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 29E60EF1D57 for ; Mon, 21 May 2018 14:01:24 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from outbound1b.ore.mailhop.org (outbound1b.ore.mailhop.org [54.200.247.200]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A118F7EE47 for ; Mon, 21 May 2018 14:01:23 +0000 (UTC) (envelope-from ian@freebsd.org) X-MHO-User: 6fb703f3-5cff-11e8-8837-614b7c574d04 X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Originating-IP: 67.177.211.60 X-Mail-Handler: DuoCircle Outbound SMTP Received: from ilsoft.org (unknown [67.177.211.60]) by outbound1.ore.mailhop.org (Halon) with ESMTPSA id 6fb703f3-5cff-11e8-8837-614b7c574d04; Mon, 21 May 2018 14:01:20 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id w4LE1J0A095057; Mon, 21 May 2018 08:01:19 -0600 (MDT) (envelope-from ian@freebsd.org) Message-ID: <1526911279.32688.67.camel@freebsd.org> Subject: Re: svn commit: r333959 - head/usr.bin/top From: Ian Lepore To: Eitan Adler Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Date: Mon, 21 May 2018 08:01:19 -0600 In-Reply-To: <9F97F4FF-0148-4889-8825-0237FFD09550@fubar.geek.nz> References: <201805210358.w4L3wFji081505@repo.freebsd.org> <9F97F4FF-0148-4889-8825-0237FFD09550@fubar.geek.nz> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.18.5.1 FreeBSD GNOME Team Port Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 May 2018 14:01:24 -0000 On Mon, 2018-05-21 at 09:46 +0100, Andrew Turner wrote: > > > > > On 21 May 2018, at 04:58, Eitan Adler 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 > > #include > > +#include > > #include > > #include > > #include > > @@ -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. > > Andrew Also, you can't pass a va_list to snprintf(), it needs to be vsnprintf(). And new_message() should now have a __printf_like attribute. -- Ian