This is the mail archive of the
ecos-patches@sourceware.org
mailing list for the eCos project.
Re: mbox compiler warning fix
> >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/).
Ah, O.K.
Well, we don't have CYGBLD_ATTRIB_UNUSED in cyg_type.h. What we have is
# if !defined(CYGBLD_ATTRIB_USED)
# if __GNUC_VERSION__ >= 30302
# define CYGBLD_ATTRIB_USED __attribute__((used))
# else
# define CYGBLD_ATTRIB_USED __attribute__((unused))
# endif
# endif
This tells the compiler that a variable is used, or at least it should
not complain about it not being used. Typically this is for #ifdef
out code, yet the variable declarations still exist.
However the warning im getting is different. Its about passing an
uninitialised variable to a function.
Is CYGBLD_ATTRIB_UNUSED something eCosCentric have added to there
private branch?
Andrew