This is the mail archive of the ecos-patches@sourceware.org mailing list for the eCos 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: mbox compiler warning fix


Andrew Lunn wrote:
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.

UNUSED not USED. I don't know where __attribute__((used)) (CYGBLD_ATTRIB_USED) comes from. It's not documented in the GCC manuals I've seen (4.1.1 or 3.4.6, for example, at http://gcc.gnu.org/onlinedocs/).


Jifl
--
--["No sense being pessimistic, it wouldn't work anyway"]-- Opinions==mine


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