From owner-svn-src-head@FreeBSD.ORG Mon Jan 23 12:25:07 2012 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4E17B106566C; Mon, 23 Jan 2012 12:25:07 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from tensor.andric.com (cl-327.ede-01.nl.sixxs.net [IPv6:2001:7b8:2ff:146::2]) by mx1.freebsd.org (Postfix) with ESMTP id 06DE48FC0A; Mon, 23 Jan 2012 12:25:07 +0000 (UTC) Received: from [IPv6:2001:7b8:3a7:0:d887:2a58:6ed8:8aa] (unknown [IPv6:2001:7b8:3a7:0:d887:2a58:6ed8:8aa]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id 355545C37; Mon, 23 Jan 2012 13:25:06 +0100 (CET) Message-ID: <4F1D51A0.6040405@FreeBSD.org> Date: Mon, 23 Jan 2012 13:25:04 +0100 From: Dimitry Andric Organization: The FreeBSD Project User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:10.0) Gecko/20120106 Thunderbird/10.0 MIME-Version: 1.0 To: Hiroki Sato References: <201201200138.q0K1cSou016739@svn.freebsd.org> <20120120.123256.1432718473132856309.hrs@allbsd.org> <20120123.132840.618925004528110765.hrs@allbsd.org> In-Reply-To: <20120123.132840.618925004528110765.hrs@allbsd.org> Content-Type: multipart/mixed; boundary="------------010104080804070801050505" Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, eadler@FreeBSD.org Subject: Re: svn commit: r230354 - head/usr.sbin/makefs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Jan 2012 12:25:07 -0000 This is a multi-part message in MIME format. --------------010104080804070801050505 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit On 2012-01-23 05:28, Hiroki Sato wrote: ... > I don't think it is needed. The makefs utility is a special case > because it will probably diverge from the upstream to support > FreeBSD-specific feature in the future (this is one of the reasons > why it is not in contrib/). It didn't happen so far, however. > > By the way, does gcc46 no longer allow unused code? Generally > speaking, I think it is enough to clean up unused code only when we > actually change the code. The warnings are not about unused code, but about variables which are assigned, but then never referenced anymore. Sometimes this is just a cosmetic issue, and the compiler will hopefully optimize out the unreferenced variable(s). In other situations there are real bugs. In any case, gcc 4.5 and 4.6 just enable more warnings by default, and when using -Wall; in particular the "variable set but not used" one. This warning should really be suppressed when WARNS is set to a low level, such as with makefs (it has WARNS?=2). Attached diff makes it so, for gcc45 and gcc46. It uses the same approach as I added earlier for clang. It can also be easily extended to other warnings. --------------010104080804070801050505 Content-Type: text/x-diff; name="gcc46-warnings-1.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="gcc46-warnings-1.diff" Index: share/mk/bsd.sys.mk =================================================================== --- share/mk/bsd.sys.mk (revision 230479) +++ share/mk/bsd.sys.mk (working copy) @@ -74,7 +74,14 @@ . if defined(NO_WARRAY_BOUNDS) CWARNFLAGS += -Wno-array-bounds . endif -. endif +. endif # clang +# Gcc 4.5 and 4.6 have more warnings enabled by default, and when using -Wall, +# so if WARNS is set to low values, these have to be disabled explicitly. +. if ${CC:T:Mgcc45} == "gcc45" || ${CC:T:Mgcc45} == "gcc46" +. if ${WARNS} <= 2 +CWARNFLAGS += -Wno-unused-but-set-variable +. endif +. endif # gcc45 || gcc46 . endif . if defined(FORMAT_AUDIT) --------------010104080804070801050505--