On Mon, 2009-08-17 at 17:48:06 -0400, Thomas Dickey wrote:
> On Mon, 17 Aug 2009, Guillem Jover wrote:
> >Package: libncursesw5-dev
> >Version: 5.7+20090803-1
> >Severity: normal
> >Since some time now this code has started producing warnings when
> >built with -Wall, which is a bit annoying as it clutters the
> >compilation logs, and distracts from actual warnings from the code
> >itself:
>
> I've not seen that warning for a while - I'm using
>
> g++ (Debian 4.3.3-14) 4.3.3
>
> Is your compiler version different, or is there some ifdef that I'm
> not seeing, which causes a different behavior?
Ah, sorry forgot to add those details, I've tried with versions 4.1,
4.3 and 4.4, all the same, so does not seem to be dependent on the
version. I'm building on amd64, which seems to be the trigger.
The attr_t type gets typedefed as chtype and that as ‘unsigned long’,
after the preprocessor, “attrset(a)” gets expanded to
“static_cast<int>((stdscr)->_attrs = (a));”.
So a better test case to show the problem would be:
,---
#include <ncurses.h>
int main()
{
attr_t a, v;
unsigned long ul;
long l;
int i, j;
static_cast<int>(i = j);
static_cast<int>(v = a);
static_cast<int>(v = l);
static_cast<int>(v = ul);
static_cast<int>(v = i);
return 0;
}
`---
On amd64-linux-gnu:
$ g++ -Wall n.cc -o n -lncurses
n.cc: In function ‘int main()’:
n.cc:10: warning: value computed is not used
n.cc:12: warning: value computed is not used
n.cc:13: warning: value computed is not used
n.cc:14: warning: value computed is not used
n.cc:15: warning: value computed is not used
On i386-linux-gnu:
$ g++ -Wall n.cc -o n -lncurses
n.cc: In function ‘int main()’:
n.cc:10: warning: value computed is not used
And changing wattrset to something like:
#define wattrset(win,at) ((win)->_attrs = (at), \
NCURSES_CAST(int, (win)->_attrs))
seems to fix the warnings.
regards,
guillem
--
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]