Subject: lib/30391: build.sh fails in lib/libc/string/wcschr.c
To: None <lib-bug-people@netbsd.org, gnats-admin@netbsd.org,>
From: Holger Weiss <holger@jhweiss.de>
List: netbsd-bugs
Date: 06/01/2005 14:17:00
>Number:         30391
>Category:       lib
>Synopsis:       build.sh fails in lib/libc/string/wcschr.c
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    lib-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Jun 01 14:17:00 +0000 2005
>Originator:     Holger Weiss
>Release:        NetBSD 2.0_STABLE
>Organization:
Individual Network Berlin e.V.
>Environment:
System: NetBSD pandora.jhweiss.de 2.0_STABLE NetBSD 2.0_STABLE (PANDORA) #11: Sun May 1 05:27:23 CEST 2005 holger@pandora.jhweiss.de:/usr/build/obj/sys/arch/i386/compile/PANDORA i386
Architecture: i386
Machine: i386
>Description:
	Compiling netbsd-2 source fails in lib/libc/string/wcschr.c,
revision 1.2.8.1 (pull-up of 1.3):

/usr/build/tools/bin/i386--netbsdelf-gcc -O2 -pipe -DALL_STATE -DUSG_COMPAT -Wall -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wno-sign-compare -Wno-traditional -Wno-uninitialized -Wreturn-type -Wswitch -Wshadow  -Werror -D_LIBC -DLIBC_SCCS -DSYSLIBC_SCCS -D_REENTRANT -I/usr/src/lib/libc/include -DHESIOD -DINET6 -DNLS -DYP -D__DBINTERFACE_PRIVATE -DI18NMODULE_MAJOR=4 -I/usr/src/libexec/ld.elf_so -I/usr/src/lib/libc/dlfcn -DCITRUS_ICONV -DWITH_RUNE -I/usr/src/lib/libc -DRESOLVSORT -I. -DPOSIX_MISTAKE -DPORTMAP -DFLOATING_POINT   -nostdinc -isystem /usr/build/dist/usr/include -c    /usr/src/lib/libc/string/wcschr.c -o wcschr.o.tmp
/usr/src/lib/libc/string/wcschr.c: In function `wcschr':
/usr/src/lib/libc/string/wcschr.c:47: warning: implicit declaration of function `__UNCONST'
/usr/src/lib/libc/string/wcschr.c:47: warning: return makes pointer from integer without a cast

*** Failed target:  wcschr.o

>How-To-Repeat:
	cd /usr/src	# netbsd-2 as of 2005-06-01
	./build.sh -U distribution
>Fix:
	Declaring __UNCONST as in lib/libc/stdio/vfprintf.c solves the
problem for me:

Index: wcschr.c
===================================================================
RCS file: /cvsroot/src/lib/libc/string/wcschr.c,v
retrieving revision 1.2.8.1
diff -u -r1.2.8.1 wcschr.c
--- wcschr.c	31 May 2005 21:13:11 -0000	1.2.8.1
+++ wcschr.c	1 Jun 2005 13:52:34 -0000
@@ -36,6 +36,18 @@
 #include <assert.h>
 #include <wchar.h>
 
+#ifdef lint
+static __inline void *__UNCONST __P((const void *));
+static __inline void *
+__UNCONST(const void *v)
+{
+	/* LINTED */
+	return (void *) v;
+}
+#else
+#define __UNCONST(v)	(void *)(v)
+#endif
+
 wchar_t *
 wcschr(const wchar_t *p, wchar_t c)
 {