Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 23 Jan 2012 13:25:04 +0100
From:      Dimitry Andric <dim@FreeBSD.org>
To:        Hiroki Sato <hrs@FreeBSD.org>
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
Message-ID:  <4F1D51A0.6040405@FreeBSD.org>
In-Reply-To: <20120123.132840.618925004528110765.hrs@allbsd.org>
References:  <201201200138.q0K1cSou016739@svn.freebsd.org> <20120120.123256.1432718473132856309.hrs@allbsd.org> <CAF6rxg=VWzUcDuk_oN_wepJPejg8JnGBKm5oLXB7Y8JCW52t3w@mail.gmail.com> <20120123.132840.618925004528110765.hrs@allbsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4F1D51A0.6040405>