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 01-May-2003, Joe Buck <jbuck@synopsys.com> wrote:
> On Thu, May 01, 2003 at 11:43:25AM -0400, Cook, Kelley (R.K.) wrote:
> > "__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).

Does the warning still occur if the variable is declared "volatile"?
(It shouldn't.) 

If GCC gets this right, then adding "volatile" would be
a simple way of avoiding the warning while keeping within standard C.

If GCC doesn't get this right, then someone who cares enough should post
a patch to supress the warning for volatile variables.

If the intent is for the string to appear in the object file, then it
ought to be declared volatile anyway.  C compilers have always had the
freedom to optimize away non-volatile unused variables.

-- 
Fergus Henderson <fjh@cs.mu.oz.au>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.


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