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?


Joe Buck <jbuck@synopsys.com> writes:

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

The syntax of __attribute__ is advantageously crafted so that it can
be #define __attribute__(a)  /* nothing */

If other compilers require to put something different, then one can
argue that the original code was using something really
implementation-defined; that GCC now requires people to spell that out
should be an improvement since now it is written all out :-)    

-- Gaby


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