[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: attr_get warning when on ubuntu 13.04
From: |
Gaute Hope |
Subject: |
Re: attr_get warning when on ubuntu 13.04 |
Date: |
Sun, 15 Dec 2013 11:46:15 +0100 |
User-agent: |
Sup/git |
Excerpts from Thomas Dickey's message of 2013-12-14 20:45:26 +0100:
> On Sat, Dec 14, 2013 at 11:18:30AM +0100, Gaute Hope wrote:
> > Greetings,
> >
> > I'm getting some compiler warnings when using attr_get and wattr_get on
> > Ubuntu 13.04 which I don't get elsewhere:
> >
> > warning: the compariosn will always evaluate as 'true' for the address
> > of 'attrs' will never be NULL [-Waddress]
> > warning: the comparison will always evaluate as 'true' for the address
> > of 'pair' will never be NULL [-Waddress]
> >
> > (gcc 4.7.3)
>
> Actually it's the compiler version. I fix the ones that I can, and (within
> reason), tweak the macros to help appease the compiler. But this particular
> one is from compiler warning changes for a rather old macro - it's checked
> its parameters to ensure they are not-null since 1998.
>
> > this is with code that goes like this:
> >
> > attr_t attrs = 0;
> > short pair = 0;
> > int ret = attr_get(&attrs, &pair, 0);
> >
> > I am guessing the macros have been tweaked between the ncurses versions,
> > can you confirm this?
>
> You can work around it by telling the compiler to use the actual function
> rather than the macro. Do that by putting the name in parentheses, e.g.,
>
> int ret = (attr_get)(&attrs, &pair, 0);
Ok, thanks for the explanation. I assume the error will go away with
the next version upgrade on Ubuntus part.
Cheers, Gaute
signature.asc
Description: PGP signature