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.
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)
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to