From owner-cvs-src@FreeBSD.ORG Thu Jul 22 13:14:43 2004 Return-Path: Delivered-To: cvs-src@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 0283B16A4CE; Thu, 22 Jul 2004 13:14:43 +0000 (GMT) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id F0F0F43D2D; Thu, 22 Jul 2004 13:14:42 +0000 (GMT) (envelope-from johan@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.11/8.12.11) with ESMTP id i6MDEgHa001628; Thu, 22 Jul 2004 13:14:42 GMT (envelope-from johan@repoman.freebsd.org) Received: (from johan@localhost) by repoman.freebsd.org (8.12.11/8.12.11/Submit) id i6MDEgK4001627; Thu, 22 Jul 2004 13:14:42 GMT (envelope-from johan) Message-Id: <200407221314.i6MDEgK4001627@repoman.freebsd.org> From: Johan Karlsson Date: Thu, 22 Jul 2004 13:14:42 +0000 (UTC) To: src-committers@FreeBSD.org, cvs-src@FreeBSD.org, cvs-all@FreeBSD.org X-FreeBSD-CVS-Branch: HEAD Subject: cvs commit: src/usr.bin/hexdump Makefile display.c odsyntax.c parse.c X-BeenThere: cvs-src@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Jul 2004 13:14:43 -0000 johan 2004-07-22 13:14:42 UTC FreeBSD src repository Modified files: usr.bin/hexdump Makefile display.c odsyntax.c parse.c Log: display.c: - 'savech' is only used if it is set a few lines above where it is used, initialize it to silence warning. - 'length' is either -1 or greater than 0, hence it is safe to cast it to unsigned when comparing it here. odsyntax.c: - 'p' is assigned either (*argvp)[0] or (*argvp)[1] which both are char *. 'num' and 'end' are assigned values based on 'p'. Hence use char * instead of unsigned char * for these variables. '&end' as the second argument to strtoll does not need to be casted to char** any more. This solves a 'dereferencing type-punned pointer will break strict-aliasing rules' warning when compiling with -O2. parse.c: - 'prec' is only used when sokay == USEPREC and sokay = USEPREC when 'prec' is assigned. Hence 'prec' is not used uninitialized, initialize it to silence warning. - The code involving 'nextpr' is hard to follow, but I belive 'nextpr' will not be used unless it is initialized. Anyway, IF 'nextpr' is used uninitialized it is better to get a consistant error (seg fault, when dereferencing a NULL pointer) than potentially accessing some random memory. The above changes makes hexdump WARNS=6 clean even when compiled with -O2. Hence bump WARNS to keep it clean. Tested by: CFLAGS='-O2 -pipe' make universe Revision Changes Path 1.9 +1 -0 src/usr.bin/hexdump/Makefile 1.20 +2 -1 src/usr.bin/hexdump/display.c 1.17 +2 -2 src/usr.bin/hexdump/odsyntax.c 1.13 +3 -0 src/usr.bin/hexdump/parse.c