This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

possible vfscanf problem?


Hi,

while looking thru the current CVS compile warnings on PPC again, it occurred 
to me that these warnings in vfscanf.c might be not as harmless as I thought:

vfscanf.c: In function `_IO_vfscanf':
vfscanf.c:1291: warning: comparison is always false due to limited range of 
data type
vfscanf.c:1343: warning: comparison is always false due to limited range of 
data type
vfscanf.c:1401: warning: comparison is always false due to limited range of 
data type
vfscanf.c:1473: warning: comparison is always false due to limited range of 
data type

The correct warning fix would be as in the patch appended, but is it really 
OK to compare chars read from a pointer against EOF here?

There's another warning I'm not sure how to handle correctly:

make[2]: Entering directory `/cvsx/rawhide/BUILD/glibc-2.1.92/dirent'
In file included from ../sysdeps/unix/powerpc/sysdep.h:19,
                 from ../sysdeps/unix/sysv/linux/powerpc/sysdep.h:19,
                 from ../sysdeps/unix/sysv/linux/getdents.c:29,
                 from ../sysdeps/unix/sysv/linux/i386/getdents64.c:41,
                 from ../sysdeps/unix/sysv/linux/powerpc/getdents64.c:1:
../sysdeps/unix/sysdep.h:40:16: warning: "SYS_ify" redefined
../sysdeps/unix/sysv/linux/powerpc/sysdep.h:27:1: warning: this is the 
location of the previous definition

Any idea?

Franz.
Index: stdio-common/vfscanf.c
===================================================================
RCS file: /cvs/glibc/libc/stdio-common/vfscanf.c,v
retrieving revision 1.80
diff -u -p -r1.80 vfscanf.c
--- stdio-common/vfscanf.c	2000/08/23 16:53:42	1.80
+++ stdio-common/vfscanf.c	2000/08/28 20:55:08
@@ -102,7 +102,7 @@
 #  undef EOF
 #  define EOF		  WEOF
 # else
-#  define ungetc(c, s)	((void) ((int) c == EOF				      \
+#  define ungetc(c, s)	((void) ((int) (signed char) c == EOF				      \
 				 || (--read_in,				      \
 				     _IO_sputbackc (s, (unsigned char) c))))
 #  define inchar()	(c == EOF ? EOF					      \

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]