Re: gratuitous gcc warnings: unused function arguments?

From: Garance A Drosihn <drosih_at_rpi.edu>
Date: Sun, 16 Jan 2005 19:51:35 -0500
At 9:05 PM +0000 1/16/05, Robert Watson wrote:
>On Sun, 16 Jan 2005, David O'Brien wrote:
>
>  > We're not going to hack GCC to deal with this.  That is going way
>  > too far.  This is coming up because people are using high WARNS
>  > values in Makefiles.  Either back them down to a lower WARNS value;
>  > or we should add -Wno-unused-parameter to WARNS level 3.
>
>I'd be fine with simply pushing threshold for unused parameters up
>a few notches on the warning scale.  I'd like to have access to the
>other interesting warnings are WARNS=3 and WARNS=4 relating to
>qualifiers, strings, etc.

I think it would be useful to keep that warning "in general", but
have an option to turn it off.  The following seems to work for me,
assuming we can decide on the best name for a new NO_WUNUSED_ARGS
option:

Index: bsd.sys.mk
===================================================================
RCS file: /usr/cvs/free/depot/src/share/mk/bsd.sys.mk,v
retrieving revision 1.35
diff -u -r1.35 bsd.sys.mk
--- bsd.sys.mk	12 Mar 2004 21:36:12 -0000	1.35
+++ bsd.sys.mk	17 Jan 2005 00:32:14 -0000
_at__at_ -29,6 +29,9 _at__at_
  .  if ${WARNS} > 5
  CWARNFLAGS	+=	-Wchar-subscripts -Winline -Wnested-externs 
-Wredundant-decls
  .  endif
+.  if defined(NO_WUNUSED_ARGS) && ${WARNS} < 5
+CWARNFLAGS	+=	-Wno-unused-parameter
+.  endif
  .  if ${WARNS} > 1 && ${WARNS} < 5
  # XXX Delete -Wuninitialized by default for now -- the compiler doesn't
  # XXX always get it right.

-- 
Garance Alistair Drosehn            =   gad_at_gilead.netel.rpi.edu
Senior Systems Programmer           or  gad_at_freebsd.org
Rensselaer Polytechnic Institute    or  drosih_at_rpi.edu
Received on Sun Jan 16 2005 - 23:51:38 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:26 UTC