Subject: Re: build error in icmp6.c
To: None <itojun@iijlab.net>
From: Simon Burge <simonb@netbsd.org>
List: current-users
Date: 06/14/2000 00:57:18
itojun@iijlab.net wrote:
>
> >Sources updated this morning; macppc:
> >cc -O2 -pipe -Werror -Wreturn-type -Wpointer-arith
> >-Wno-uninitialized -Wno-main -msoft-float -I. -I../../../../arch
> >-I../../../.. -nostdinc -I../../../../../crypto-intl/sys
> >-I../../../../../gnu/sys -DLKM -DDIAGNOSTIC -DTRAP_PANICWAIT
> >-DNMBCLUSTERS="0x400" -DMAXUSERS=64 -D_KERNEL -Dmacppc -c
> >../../../../netinet6/icmp6.c
> >cc1: warnings being treated as errors
> >../../../../netinet6/icmp6.c: In function `ni6_dnsmatch':
> >../../../../netinet6/icmp6.c:1419: warning: comparison is always 0
> >due to limited range of data type
> >../../../../netinet6/icmp6.c:1419: warning: comparison is always 0
> >due to limited range of data type
> >*** Error code 1
>
> how can I suppress the warning in this case? it looks that macppc
> treats char as unsigned char, while for i386 char is signed.
> if the char is signed, I really need to check for negative numbers.
>
> itojun
>
>
> ---
> static int
> ni6_dnsmatch(a, alen, b, blen)
> const char *a;
> int alen;
> const char *b;
> int blen;
> {
> /* ... */
>
> if (a[0] < 0 || b[0] < 0) <--- line 1419 in the above
> return 0;
>
> /* ... */
> }
Would something like:
if ((signed char)a[0] < 0 || (signed char)b[0] < 0)
work?