zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <Peter.Stephenson@csr.com>
To: <zsh-workers@zsh.org>
Subject: Re: PATCH: Errors compiling on HP-UX with HP's compiler
Date: Mon, 20 Dec 2010 10:07:50 +0000	[thread overview]
Message-ID: <20101220100750.79fd858a@pwslap01u.europe.root.pri> (raw)
In-Reply-To: <20101220060037.GA14117@sverige>

On Mon, 20 Dec 2010 06:00:37 +0000
Paul Ackersviller <pda@sdf.lonestar.org> wrote:
> I must be using gcc more often than not to have just run across this.
> HP's compiler, I think rightly, refuses to do arithmetic on these two
> void pointers.  Does gcc treat them as char * for that purpose?
> The casts can obviously be done without.

Thanks, we should really have been picked that up by now...

Some older systems used char * in read() and write(), and in fact
there's a definition in prototypes.h that's somewhat out of date to cope
with that.  I wouldn't be at all surprised if it didn't compile on any
such system any more, but it might as well be left open.  Given that
write_loop() and read_loop() now always take char *, and a char * will
be converted to a void * without any problem, I think I'll remove the
outdated type definitions and do without the casts...

Index: Src/init.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/init.c,v
retrieving revision 1.116
diff -p -u -r1.116 init.c
--- Src/init.c	15 Jul 2010 18:44:13 -0000	1.116
+++ Src/init.c	20 Dec 2010 10:02:04 -0000
@@ -1380,7 +1380,7 @@ VA_DCL
 	pptbuf = unmetafy(promptexpand(lp ? *lp : NULL, 0, NULL, NULL,
 				       NULL),
 			  &pptlen);
-	write_loop(2, (WRITE_ARG_2_T)pptbuf, pptlen);
+	write_loop(2, pptbuf, pptlen);
 	free(pptbuf);
 
 	ret = shingetline();
Index: Src/input.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/input.c,v
retrieving revision 1.20
diff -p -u -r1.20 input.c
--- Src/input.c	25 Mar 2010 14:03:51 -0000	1.20
+++ Src/input.c	20 Dec 2010 10:02:04 -0000
@@ -260,7 +260,7 @@ inputline(void)
 	    int pptlen;
 	    pptbuf = unmetafy(promptexpand(ingetcpmptl ? *ingetcpmptl : NULL,
 					   0, NULL, NULL, NULL), &pptlen);
-	    write_loop(2, (WRITE_ARG_2_T)pptbuf, pptlen);
+	    write_loop(2, pptbuf, pptlen);
 	    free(pptbuf);
 	}
 	ingetcline = shingetline();
Index: Src/prototypes.h
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/prototypes.h,v
retrieving revision 1.4
diff -p -u -r1.4 prototypes.h
--- Src/prototypes.h	13 Apr 2001 16:29:28 -0000	1.4
+++ Src/prototypes.h	20 Dec 2010 10:02:04 -0000
@@ -44,13 +44,6 @@ extern int tputs _((char *cp, int affcnt
 
 /* MISSING PROTOTYPES FOR VARIOUS OPERATING SYSTEMS */
 
-/* HP/UX 9 c89 */
-#if defined(__hpux) && defined(_XPG3) && !defined(_POSIX1_1988)
-# define WRITE_ARG_2_T void *
-#else
-# define WRITE_ARG_2_T char *
-#endif
-
 #if defined(__hpux) && defined(_HPUX_SOURCE) && !defined(_XPG4_EXTENDED)
 # define SELECT_ARG_2_T int *
 #else
Index: Src/utils.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/utils.c,v
retrieving revision 1.251
diff -p -u -r1.251 utils.c
--- Src/utils.c	6 Dec 2010 19:34:33 -0000	1.251
+++ Src/utils.c	20 Dec 2010 10:02:04 -0000
@@ -2272,7 +2272,7 @@ checkrmall(char *s)
 
 /**/
 mod_export ssize_t
-read_loop(int fd, void *buf, size_t len)
+read_loop(int fd, char *buf, size_t len)
 {
     ssize_t got = len;
 
@@ -2298,7 +2298,7 @@ read_loop(int fd, void *buf, size_t len)
 
 /**/
 mod_export ssize_t
-write_loop(int fd, const void *buf, size_t len)
+write_loop(int fd, const char *buf, size_t len)
 {
     ssize_t wrote = len;
 
Index: Src/Zle/zle_main.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/zle_main.c,v
retrieving revision 1.126
diff -p -u -r1.126 zle_main.c
--- Src/Zle/zle_main.c	20 Sep 2010 09:27:46 -0000	1.126
+++ Src/Zle/zle_main.c	20 Dec 2010 10:02:04 -0000
@@ -1132,7 +1132,7 @@ zleread(char **lp, char **rp, int flags,
 	pptbuf = unmetafy(promptexpand(lp ? *lp : NULL, 0, NULL, NULL,
 				       &pmpt_attr),
 			  &pptlen);
-	write_loop(2, (WRITE_ARG_2_T)pptbuf, pptlen);
+	write_loop(2, pptbuf, pptlen);
 	free(pptbuf);
 	return shingetline();
     }

-- 
Peter Stephenson <pws@csr.com>            Software Engineer
Tel: +44 (0)1223 692070                   Cambridge Silicon Radio Limited
Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, UK


Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom


      parent reply	other threads:[~2010-12-20 10:19 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-20  6:00 Paul Ackersviller
2010-12-20  8:57 ` Vincent Lefevre
2010-12-20 10:07 ` Peter Stephenson [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20101220100750.79fd858a@pwslap01u.europe.root.pri \
    --to=peter.stephenson@csr.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).