From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1364 invoked from network); 24 Mar 2003 12:18:30 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 24 Mar 2003 12:18:30 -0000 Received: (qmail 7125 invoked by alias); 24 Mar 2003 12:17:59 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 18376 Received: (qmail 7115 invoked from network); 24 Mar 2003 12:17:59 -0000 Received: from localhost (HELO sunsite.dk) (127.0.0.1) by localhost with SMTP; 24 Mar 2003 12:17:59 -0000 X-MessageWall-Score: 0 (sunsite.dk) Received: from [62.189.183.235] by sunsite.dk (MessageWall 1.0.8) with SMTP; 24 Mar 2003 12:17:59 -0000 Received: from exchange01.csr.com (unverified) by (Content Technologies SMTPRS 4.2.1) with ESMTP id for ; Mon, 24 Mar 2003 12:26:00 +0000 Received: from csr.com (tinky-winky.csr.com [192.168.144.127]) by exchange01.csr.com with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2650.21) id G0TVKAKT; Mon, 24 Mar 2003 12:17:21 -0000 To: zsh-workers@sunsite.dk (Zsh hackers list) Subject: PATCH: Minor problem with wchar/iconv headers Date: Mon, 24 Mar 2003 12:17:56 +0000 Message-ID: <23196.1048508276@csr.com> From: Peter Stephenson The new code to include wchar.h in utils.c comes after the normal zsh headers. This means that zsh's own system.h has already executed the test `#ifdef offsetof' and if it hasn't found it provided its own definitions. It turns out on Solaris 2.8 with gcc 2.95.2 (and therefore probably elsewhere) that wchar.h hooks in stddef.h, which tries to define offsetof itself, provoking a warning with the current layout of include files. Since it depends on config.h, this needs to be buried somewhere in system.h. It seems unlikely including something called `stddef.h' will cause grief, but you never know... I've also suppressed a couple of other warnings gcc was coming up with. I would have to read the C standard in detail to know why the `(const char **)' cast is necessary to suppress a warning. Index: zshconfig.ac =================================================================== RCS file: /cvsroot/zsh/zsh/zshconfig.ac,v retrieving revision 1.34 diff -u -r1.34 zshconfig.ac --- zshconfig.ac 15 Mar 2003 17:36:17 -0000 1.34 +++ zshconfig.ac 24 Mar 2003 12:13:38 -0000 @@ -494,7 +494,7 @@ limits.h fcntl.h libc.h sys/utsname.h sys/resource.h \ locale.h errno.h stdio.h stdlib.h unistd.h sys/capability.h \ utmp.h utmpx.h sys/types.h pwd.h grp.h poll.h sys/mman.h \ - netinet/in_systm.h pcre.h langinfo.h wchar.h) + netinet/in_systm.h pcre.h langinfo.h wchar.h stddef.h) if test $dynamic = yes; then AC_CHECK_HEADERS(dlfcn.h) AC_CHECK_HEADERS(dl.h) Index: Src/system.h =================================================================== RCS file: /cvsroot/zsh/zsh/Src/system.h,v retrieving revision 1.15 diff -u -r1.15 system.h --- Src/system.h 28 Apr 2001 17:38:01 -0000 1.15 +++ Src/system.h 24 Mar 2003 12:13:38 -0000 @@ -89,6 +89,16 @@ # include #endif +#ifdef HAVE_STDDEF_H +/* + * Seen on Solaris 8 with gcc: stddef defines offsetof, which clashes + * with system.h's definition of the symbol unless we include this + * first. Otherwise, this will be hooked in by wchar.h, too late + * for comfort. + */ +#include +#endif + #include #include #include Index: Src/utils.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/utils.c,v retrieving revision 1.46 diff -u -r1.46 utils.c --- Src/utils.c 18 Mar 2003 14:39:49 -0000 1.46 +++ Src/utils.c 24 Mar 2003 12:13:38 -0000 @@ -3395,8 +3395,8 @@ for (i=(*s == 'u' ? 4 : 8); i>0; i--) { if (*++s && idigit(*s)) wval = wval * 16 + (*s - '0'); - else if (*s && (*s >= 'a' && *s <= 'f') || - (*s >= 'A' && *s <= 'F')) + else if (*s && ((*s >= 'a' && *s <= 'f') || + (*s >= 'A' && *s <= 'F'))) wval = wval * 16 + (*s & 0x1f) + 9; else { s--; @@ -3430,7 +3430,7 @@ *len = t - buf; return buf; } - iconv(cd, &inptr, &inbytes, &outptr, &outbytes); + iconv(cd, (const char **)&inptr, &inbytes, &outptr, &outbytes); iconv_close(cd); count = wctomb(t, *outbuf); #endif -- Peter Stephenson Software Engineer CSR Ltd., Science Park, Milton Road, Cambridge, CB4 0WH, UK Tel: +44 (0)1223 692070 ********************************************************************** The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer. **********************************************************************