Re: Problems compiling scotty-2.1.5 on RedHat Linux 4.1

Erik Schoenfelder (schoenfr@ohura.gaertner.de)
Sat, 10 May 97 23:13:10 +0200

Hi!

On Sat, 10 May 1997 14:14:13 -0400, "Mike Frisch"
<mfrisch@rogerswave.ca> said:

Mike> I am attempting to compile/install scotty-2.1.5 on RedHat
Mike> Linux 4.1 [...]

Mike> xdr_etherstat(XDR *xdrs, etherstat *objp)
Mike> {
Mike>
Mike> register long *buf;
Mike> (void)buf;
Mike>
Mike> int i;

Mike> Notice the strange "(void)buf" declaration... what should
Mike> this be (if anything)? I assume it means a bad/broken rpcgen,
Mike> but I'm no expert.

expert enough to be right ;-)

appended is a old mail to this list, dealing with this problem.
in short: use an other (eg. older) rpcgen.

Erik

-- snip --
Date: Wed, 9 Apr 97 23:32:26 +0200
From: Erik Schoenfelder <schoenfr@gaertner.de>
To: rani@Ares.Riddler.COM
Cc: tkined@ibr.cs.tu-bs.de
Subject: Re: Compile error
Reply-To: schoenfr@gaertner.de

Hi!

Rani> I am running Linux 2.1.30 with gcc-2.7.2 and libc 5.4.23. I
Rani> installed tk4.1 and Tcl7.5 and am having trouble compiling
Rani> scotty-2.1.5. I read the docs and porting.notes but nothing
Rani> refers to this:

Rani> ether_xdr.c: In function `xdr_etherstat':
Rani> ether_xdr.c:34: parse error before `int'
Rani> ether_xdr.c:64: `i' undeclared (first use this function)

and you are using rpcgen from NetKit-0.09 right ?

this rpcgen is buggy -- just use a newer or older one.

i've appended the mail to David A. Holland <dholland@hcs.harvard.edu>,
the maintainer of the package about that topic, and he told me to
include a fix in the next release.

Erik

----

Date: Mon, 13 Jan 97 13:04:47 +0100
From: Erik Schoenfelder <schoenfr@gaertner.de>
To: dholland@hcs.harvard.edu
Subject: NetKit-0.09 rpcgen bug and diff: keeping gcc happy breaks c-code
Reply-To: schoenfr@gaertner.de

Hi!

Running rpcgen from NetKit-0.09 on rstat.x and ether.x failes to
create compileable ..._xdr.c code:

> bool_t
> xdr_statstime(XDR *xdrs, statstime *objp)
> {
>
> register long *buf;
> (void)buf;
>
> int i;
>
> if (xdrs->x_op == XDR_ENCODE) {

after the `(void)buf' expression the declaration of i is not allowed.

But I think, keeping gcc happy is a good idea, so better trying
something else instead of removing :-)

Moving the declaration of i to the place used should fix this
problem.

Moving the declaration of buf may fix this too, but i do not see if
the generated code will work. But i guess it will. buf is used either
in decode or encode and in these contexts a local decl should suffice
(i' ll append a diff for that at the end).

The diff for moving the decl of i:

--- rpc_cout.c-x Mon Jan 13 12:23:42 1997
+++ rpc_cout.c Mon Jan 13 12:37:39 1997
@@ -416,7 +416,8 @@

for (dl = def->def.st.decls; dl != NULL; dl = dl->next)
if(dl->decl.rel == REL_VECTOR){
- f_print(fout,"\t int i;\n");
+ /** moved to emit_inline(): **/
+ /** f_print(fout,"\t int i;\n"); **/
break;
}

@@ -648,6 +649,7 @@
break;
case REL_VECTOR :
f_print(fout,"\t\t{ register %s *genp; \n",decl->type);
+ f_print(fout,"\t\t int i;\n");
f_print(fout,"\t\t for ( i = 0,genp=objp->%s;\n \t\t\ti < %s; i++){\n\t\t",
decl->name,decl->array_max);
emit_single_in_line(decl,flag,REL_VECTOR);

Question of the day: Will this break other code ?

Well, I don't know. At least for rstat.x, pcnfsd.x, ether.x and
mount.x this seems to work.

Maybe this helps to step further.

Erik

--

move decl of buf:

--- rpc_cout.c-x Mon Jan 13 12:23:42 1997 +++ rpc_cout.c Mon Jan 13 12:47:59 1997 @@ -173,7 +173,7 @@ return; /*May cause lint to complain. but ... */ /* dholland 12/29/96 add (void)buf to avoid gcc warnings if buf unused */ - f_print(fout, "\t register long *buf;\n(void)buf;\n\n"); + /** f_print(fout, "\t register long *buf;\n(void)buf;\n\n"); **/ } @@ -458,6 +459,7 @@ else f_print(fout,"\n \t return (TRUE);\n\t} else if (xdrs->x_op == XDR_DECODE) {\n"); + f_print(fout,"\n\t\tregister long *buf;\n"); i=0; size=0;

-- snip --

--
!! This message is brought to you via the `tkined & scotty' mailing list.
!! Please do not reply to this message to unsubscribe. To subscribe or
!! unsubscribe, send a mail message to <tkined-request@ibr.cs.tu-bs.de>.
!! See http://wwwsnmp.cs.utwente.nl/~schoenw/scotty/ for more information.