quiting X warnings in /bin/sh

David O'Brien obrien at freebsd.org
Mon Feb 28 19:33:54 PST 2005


On 'i386' one gets several "comparison is always true due to limited
range of data type" warnings when compiling bin/sh because PEOF is -129
and SYNBASE is 129.  Which of course are outside the range of an 8-bit
character.  I think the correct fix is the patch below to give a range of
-128..128 in the signed character case, and -1..1 in the unsigned
character case.

Index: mksyntax.c
===================================================================
RCS file: /home/ncvs/src/bin/sh/mksyntax.c,v
retrieving revision 1.23
diff -u -r1.23 mksyntax.c
--- mksyntax.c	6 Apr 2004 20:06:51 -0000	1.23
+++ mksyntax.c	1 Mar 2005 03:29:50 -0000
@@ -158,7 +158,7 @@
 	size = (1 << nbits) + 1;
 	base = 1;
 	if (sign)
-		base += 1 << (nbits - 1);
+		base += (1 << (nbits - 1)) - 1;
 	digit_contig = 1;
 	for (i = 0 ; i < 10 ; i++) {
 		if (digit[i] != '0' + i)

-- 
-- David  (obrien at FreeBSD.org)


More information about the freebsd-audit mailing list