This is the mail archive of the
ecos-patches@sourceware.org
mailing list for the eCos project.
Re: mbox compiler warning fix
- From: Andrew Lunn <andrew at lunn dot ch>
- To: Jonathan Larmour <jifl at jifvik dot org>
- Cc: eCos Patches <ecos-patches at ecos dot sourceware dot org>
- Date: Mon, 8 Jan 2007 20:02:08 +0100
- Subject: Re: mbox compiler warning fix
- References: <20070107171001.GD3369@lunn.ch> <45A1397D.2090909@jifvik.org>
On Sun, Jan 07, 2007 at 06:18:37PM +0000, Jonathan Larmour wrote:
> Andrew Lunn wrote:
> >Hi
> >
> >This patch fixes a compiler warnings in the mbox code with recent
> >versions of gcc.
>
> We should avoid this for time-sensitive code. It should be tagged with
> __attribute__((unused)) (aka CYGBLD_ATTRIB_UNUSED) instead. In fact all
> uninitialised variable warnings should be treated this way.
Unfortunately, that does not work:
/home/lunn/eCos/anoncvs-clean/packages/kernel/current/src/sync/mbox.cxx: In member function 'void* Cyg_Mbox::get()':
/home/lunn/eCos/anoncvs-clean/packages/kernel/current/src/sync/mbox.cxx:113: warning: 'used' attribute ignored
/home/lunn/eCos/anoncvs-clean/packages/kernel/current/src/sync/mbox.cxx:113: warning: 'p' may be used uninitialized in this
when compiling:
void *
Cyg_Mbox::get()
{
void * CYGBLD_ATTRIB_USED p;
if ( ! m.get( p ) )
return NULL;
return p;
}
I also tried the CYGBLD_ATTRIB_USED in other positions on the line and
nothing works.
Any ideas?
Andrew