bug-ncurses
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: attr_get warning when on ubuntu 13.04


From: Thomas Dickey
Subject: Re: attr_get warning when on ubuntu 13.04
Date: Sat, 14 Dec 2013 14:45:26 -0500
User-agent: Mutt/1.5.20 (2009-06-14)

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);

-- 
Thomas E. Dickey <address@hidden>
http://invisible-island.net
ftp://invisible-island.net

Attachment: signature.asc
Description: Digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]