This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Joy with new GCC 3.3 warnings -- HTF to shut them up?


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).


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]