svn commit: r334551 - head/usr.bin/top

Eitan Adler eadler at FreeBSD.org
Sun Jun 3 05:07:40 UTC 2018


Author: eadler
Date: Sun Jun  3 05:07:39 2018
New Revision: 334551
URL: https://svnweb.freebsd.org/changeset/base/334551

Log:
  top(1): use greater warnings
  
  One of the downsides of using numeric WARNS is that if we only have a
  single type of issue we get no protection from other changes.  For
  example, we got no warning for missing variable declaration, due to
  the issues with "const".
  
  For this utility, explicitly list out the warnings which are failing.
  They should still be fixed, so only reduce them to warning instead of
  error.
  
  Tested with: clang base (amd64, i386), gcc6, gcc7, gcc9, gcc base (mips)

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

Modified: head/usr.bin/top/Makefile
==============================================================================
--- head/usr.bin/top/Makefile	Sun Jun  3 03:53:11 2018	(r334550)
+++ head/usr.bin/top/Makefile	Sun Jun  3 05:07:39 2018	(r334551)
@@ -1,12 +1,22 @@
 # $FreeBSD$
 
+.include <src.opts.mk>
+
 PROG=	top
 SRCS=	commands.c display.c machine.c screen.c top.c \
 	username.c utils.c sigdesc.h
 CFLAGS+= -I ${.OBJDIR}
 MAN=	top.1
 
-WARNS?=	3
+WARNS?=	6
+
+.if ${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} >= 50000
+CFLAGS.gcc=-Wno-error=cast-align -Wno-error=cast-qual -Wno-error=discarded-qualifiers -Wno-error=incompatible-pointer-types \
+	-Wno-error=maybe-uninitialized
+.else #base gcc
+NO_WERROR=
+.endif
+CFLAGS.clang=-Wno-error=incompatible-pointer-types-discards-qualifiers -Wno-error=cast-qual -Wno-error=cast-align
 
 LIBADD=	ncursesw m kvm jail
 

Modified: head/usr.bin/top/machine.c
==============================================================================
--- head/usr.bin/top/machine.c	Sun Jun  3 03:53:11 2018	(r334550)
+++ head/usr.bin/top/machine.c	Sun Jun  3 05:07:39 2018	(r334551)
@@ -229,7 +229,7 @@ static int pageshift;		/* log base 2 of the pagesize *
 /*
  * Sorting orders.  The first element is the default.
  */
-char *ordernames[] = {
+static const char *ordernames[] = {
 	"cpu", "size", "res", "time", "pri", "threads",
 	"total", "read", "write", "fault", "vcsw", "ivcsw",
 	"jid", "swap", "pid", NULL


More information about the svn-src-all mailing list