This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: dubious warning about unused object
- To: "Edwards, Phil" <pedwards at ball dot com>
- Subject: Re: dubious warning about unused object
- From: Jason Merrill <jason at cygnus dot com>
- Date: 05 May 1999 18:59:27 -0700
- Cc: "'egcs at egcs dot cygnus dot com'" <egcs at egcs dot cygnus dot com>
- References: <B7A6155A71B6D211BB2D0008C7B250B7090637@daytonmsg.ball.com>
>>>>> Edwards, Phil <pedwards@ball.com> writes:
> + Another option would be to annotate the definition of Lock
> + with a type attribute so that the compiler knows that Lock
> + is a resource allocation class. This seems like an appropriate
> + solution; a patch would be welcome.
> I think that the 'unused' attribute was documented as "not for use in
> C++."
That only refers to parameter decls; in C++, you can just leave out the name.
> I'm still learning about compiler internals, but is there an easy
> explanation as to why
> Lock l (lockinfo) __attribute__ ((unused));
> string s;
> wouldn't work around the problem? Would the ctor/dtor calls get
> accidentally "optimized" away or something?
Nope, that would also work. It just seemed like a type attribute would be
more convenient, since you would only have to use it once.
Jason