This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Joy with new GCC 3.3 warnings -- HTF to shut them up?
- From: Joe Buck <jbuck at synopsys dot com>
- To: "Cook, Kelley (R.K.)" <kcook34 at ford dot com>
- Cc: "'David O'Brien'" <obrien at freebsd dot org>, "'GCC'" <gcc at gcc dot gnu dot org>
- Date: Thu, 1 May 2003 09:17:10 -0700
- Subject: Re: Joy with new GCC 3.3 warnings -- HTF to shut them up?
- References: <E70D26A9CDD5C04D806EB8CA831D07210FC506@na1ecm61.dearborn.ford.com>
On Thu, May 01, 2003 at 11:43:25AM -0400, Cook, Kelley (R.K.) wrote:
> >Previously one could shut up GCC complaining about unused file-scope
> >variables by making them 'const', now with GCC 3.3 that doesn't work.
> >
> >So how is one suppose to quiet GCC about SCCS, $Id$, copyright[], and
> >other identification strings? BSD has a lot of:
> >
> > #ifndef lint
> > static const char copyright[] =
> > "@(#) Copyright (c) 1992, 1993, 1994\n\
> > The Regents of the University of California. All rights
> > reserved.\n";
> > static const char sccsid[] = "@(#)chflags.c 8.5 (Berkeley) 4/1/94";
> > #endif
> >
> >I tried adding "__attribute__((__unused__))" in various places in the
> >definition, but that didn't work.
> >
>
> Probably because it should have been "__attribute__((unused))". :)
No, because that's not C. (That is, it doesn't suffice just to add the
attribute, one also must add an #ifdef so that compilers other than gcc
will accept it; then, if other compilers imitate GCC, you'll have to add
an attribute in different form for each of the OTHER compilers you need
to shut up).
I think it was a mistake for gcc to make this change, in fact, one can
argue that it is a regression (in that there doesn't appear to be a
way to write a conforming C program that uses this standard means of
getting a version identifier into the object file without producing a
warning).