Subject: lib/16982: libc/citrus does not compile with GCC 3.2 (gcc devel version)
To: None <gnats-bugs@gnats.netbsd.org>
From: None <thorpej@shagadelic.org>
List: netbsd-bugs
Date: 05/22/2002 20:55:59
>Number:         16982
>Category:       lib
>Synopsis:       libc/citrus does not compile with GCC 3.2 (gcc devel version)
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    lib-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed May 22 20:57:01 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Jason R Thorpe
>Release:        NetBSD 1.5ZC
>Organization:
Wasabi Systems, Inc.
>Environment:
	
	
System: NetBSD yeah-baby.shagadelic.org 1.5ZC NetBSD 1.5ZC (YEAH-BABY-XP) #8: Sat May 4 15:32:58 PDT 2002 thorpej@yeah-baby.shagadelic.org:/u1/netbsd/src/sys/arch/i386/compile/YEAH-BABY-XP i386
Architecture: i386
Machine: i386
>Description:
	The wide-char support in libc/citrus does not compile with
	GCC 3.2 (gcc-current).  This version is GCC (or GCC 3.1)
	is required in order to build certain platforms that NetBSD
	currently supports or which are in development.

>How-To-Repeat:
	Attempt to build libc with gcc-current.  Observe the warning:

/usr/local/gnu/bin/x86_64-unknown-netbsd-gcc  -DALL_STATE -DUSG_COMPAT  -Wall -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wno-uninitialized -Wreturn-type -Wpointer-arith -Wswitch -Wshadow  -Werror  -D_LIBC -DLIBC_SCCS -DSYSLIBC_SCCS -D_REENTRANT -I/u1/netbsd/src/lib/libc/include -DHESIOD -DINET6 -DNLS -DYP -D__DBINTERFACE_PRIVATE -I/u1/netbsd/src/lib/libc/../../libexec/ld.elf_so -I/u1/netbsd/src/lib/libc/dlfcn -DI18NMODULE_MAJOR=4 -DWITH_RUNE -I/u1/netbsd/src/lib/libc -DRESOLVSORT -I. -DPOSIX_MISTAKE -DPORTMAP -DFLOATING_POINT -nostdinc -isystem /u1/netbsd/destdir/x86_64/usr/include  -c /u1/netbsd/src/lib/libc/citrus/citrus_none.c
cc1: warnings being treated as errors
/u1/netbsd/src/lib/libc/citrus/citrus_none.c: In function `_citrus_NONE_ctype_mbstowcs':
/u1/netbsd/src/lib/libc/citrus/citrus_none.c:181: warning: passing arg 3 of `_citrus_NONE_ctype_mbsrtowcs' discards qualifiers from pointer target type
/u1/netbsd/src/lib/libc/citrus/citrus_none.c: In function `_citrus_NONE_ctype_wcstombs':
/u1/netbsd/src/lib/libc/citrus/citrus_none.c:276: warning: passing arg 3 of `_citrus_NONE_ctype_wcsrtombs' discards qualifiers from pointer target type
*** Error code 1

>Fix:
	The following patch allows libc to compile, but I'm pretty
	sure it is not the correct thing.

Index: citrus_ctype_template.h
===================================================================
RCS file: /cvsroot/basesrc/lib/libc/citrus/citrus_ctype_template.h,v
retrieving revision 1.13
diff -u -r1.13 citrus_ctype_template.h
--- citrus_ctype_template.h	2002/03/28 10:53:48	1.13
+++ citrus_ctype_template.h	2002/05/23 03:32:31
@@ -202,7 +202,7 @@
 	}
 
 	state = *psenc;
-	err = _FUNCNAME(mbrtowc_priv)(ei, pwc, &s, n, psenc, &nr);
+	err = _FUNCNAME(mbrtowc_priv)(ei, pwc, (const char **)&s, n, psenc, &nr);
 	if (err) {
 		*nresult = -1;
 		return (err);
@@ -445,7 +445,7 @@
 		*nresult = 0;
 	} else {
 		err = _FUNCNAME(mbrtowc_priv)(
-			cl, NULL, &s, n, (void *)psenc, nresult);
+			cl, NULL, (const char **)&s, n, (void *)psenc, nresult);
 	}
 	_RESTART_END(mbrlen, _TO_CEI(cl), pspriv, psenc);
 
@@ -468,7 +468,7 @@
 		*nresult = 0;
 	} else {
 		err = _FUNCNAME(mbrtowc_priv)(
-			cl, pwc, &s, n, (void *)psenc, nresult);
+			cl, pwc, (const char **)&s, n, (void *)psenc, nresult);
 	}
 	_RESTART_END(mbrtowc, _TO_CEI(cl), pspriv, psenc);
 
@@ -523,7 +523,7 @@
 	_DIAGASSERT(cl != NULL);
 
 	_FUNCNAME(init_state)(_CEI_TO_EI(_TO_CEI(cl)), &state);
-	err = _FUNCNAME(mbsrtowcs_priv)(cl, pwcs, &s, n, &state, nresult);
+	err = _FUNCNAME(mbsrtowcs_priv)(cl, pwcs, (const char **)&s, n, &state, nresult);
 	if (*nresult == (size_t)-2) {
 		err = EILSEQ;
 		*nresult = (size_t)-1;
@@ -594,7 +594,7 @@
 	_DIAGASSERT(cl != NULL);
 
 	_FUNCNAME(init_state)(_CEI_TO_EI(_TO_CEI(cl)), &state);
-	err = _FUNCNAME(wcsrtombs_priv)(cl, s, &pwcs, n,
+	err = _FUNCNAME(wcsrtombs_priv)(cl, s, (const wchar_t **)&pwcs, n,
 					&state, nresult);
 
 	return err;
Index: citrus_none.c
===================================================================
RCS file: /cvsroot/basesrc/lib/libc/citrus/citrus_none.c,v
retrieving revision 1.4
diff -u -r1.4 citrus_none.c
--- citrus_none.c	2002/03/25 20:47:02	1.4
+++ citrus_none.c	2002/05/23 03:32:32
@@ -178,7 +178,7 @@
 			    const char * __restrict s, size_t n,
 			    size_t * __restrict nresult)
 {
-	return (_citrus_NONE_ctype_mbsrtowcs(cl, wcs, &s, n, NULL, nresult));
+	return (_citrus_NONE_ctype_mbsrtowcs(cl, wcs, (const char **)&s, n, NULL, nresult));
 }
 
 static int
@@ -273,7 +273,7 @@
 			    const wchar_t * __restrict pwcs, size_t n,
 			    size_t * __restrict nresult)
 {
-	return (_citrus_NONE_ctype_wcsrtombs(cl, s, &pwcs, n, NULL, nresult));
+	return (_citrus_NONE_ctype_wcsrtombs(cl, s, (const wchar_t **)&pwcs, n, NULL, nresult));
 }
 
 static int
>Release-Note:
>Audit-Trail:
>Unformatted: