Subject: Re: Error cross-compiling lib/libc/rpc/svc_vc.c
To: Tom Ivar Helbekkmo <tih@eunetnorge.no>
From: Johnny Billquist <johnny.billquist@softjar.se>
List: port-vax
Date: 12/10/2005 04:45:30
Ok. Here is a patch for the error you reported, Tom...
I don't know if this should be in the repository or not. No other 
architecture should be affected by this patch, but I'm not sure this is 
the "right" way of dealing with this:

--------------
Index: lib/libc/rpc/svc_vc.c
===================================================================
RCS file: /cvsroot/src/lib/libc/rpc/svc_vc.c,v
retrieving revision 1.13
diff -c -r1.13 svc_vc.c
*** lib/libc/rpc/svc_vc.c       9 Sep 2005 15:41:27 -0000       1.13
--- lib/libc/rpc/svc_vc.c       10 Dec 2005 03:43:43 -0000
***************
*** 762,767 ****
--- 762,770 ----
   #ifdef _REENTRANT
         extern mutex_t ops_lock;
   #endif
+ #ifdef __vax__
+ extern void abort(void);
+ #endif

         mutex_lock(&ops_lock);
         if (ops.xp_recv == NULL) {
***************
*** 772,778 ****
                 ops.xp_reply =
                     (bool_t (*) __P((SVCXPRT *, struct rpc_msg *)))abort;
                 ops.xp_freeargs =
!                   (bool_t (*) __P((SVCXPRT *, xdrproc_t, caddr_t)))abort,
                 ops.xp_destroy = svc_vc_destroy;
                 ops2.xp_control = svc_vc_rendezvous_control;
         }
--- 775,781 ----
                 ops.xp_reply =
                     (bool_t (*) __P((SVCXPRT *, struct rpc_msg *)))abort;
                 ops.xp_freeargs =
!                   (bool_t (*) __P((SVCXPRT *, xdrproc_t, caddr_t)))abort;
                 ops.xp_destroy = svc_vc_destroy;
                 ops2.xp_control = svc_vc_rendezvous_control;
         }
-----------------


Tom Ivar Helbekkmo wrote:
> Building current CVS HEAD for VAX, on an i386, stops with error
> messages for lib/libc/rpc/svc_vc.c:
> 
> /usr/src/lib/libc/rpc/svc_vc.c: In function `svc_vc_rendezvous_ops':
> /usr/src/lib/libc/rpc/svc_vc.c:771: warning: cast discards qualifiers from pointer target type
> /usr/src/lib/libc/rpc/svc_vc.c:773: warning: cast discards qualifiers from pointer target type
> /usr/src/lib/libc/rpc/svc_vc.c:775: warning: cast discards qualifiers from pointer target type
> 
> This is reproducible using this source file:
> 
> #include <stdlib.h>
> __dead void ofp(void) __attribute__((__noreturn__));
> int main(int argc, char **argv) {
>   int (*fp) (char *a, long b, int c);
>   fp = (int (*) (char *, long, int)) ofp;
>   return 0;
> }
> 
> I compile the above, using the command line picked directly from the
> build, thus:
> 
> /usr/local/tools/bin/vax--netbsdelf-gcc -O2 -pipe -Wall \
> -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith \
> -Wno-sign-compare -Wno-traditional -Wno-uninitialized -Wreturn-type \
> -Wswitch -Wshadow -Wcast-qual -Wwrite-strings -Werror -D_LIBC \
> -DLIBC_SCCS -DSYSLIBC_SCCS -D_REENTRANT -I/usr/src/lib/libc/include \
> -I/usr/src/lib/libc -DHESIOD -DINET6 -DNLS -DYP \
> -I. -D__DBINTERFACE_PRIVATE -DI18NMODULE_MAJOR=4 -DCITRUS \
> -I/usr/src/sys -I/usr/src/lib/libc/stdlib -I/usr/src/libexec/ld.elf_so \
> -I/usr/src/lib/libc/dlfcn -DCITRUS_ICONV -DWITH_RUNE \
> -I/usr/src/lib/libc -DPOSIX_MISTAKE -DCOMPAT__RES -DPORTMAP \
> -DFLOATING_POINT -DALL_STATE -DUSG_COMPAT -nostdinc -isystem \
> /usr/local/arena/vax/usr/include -c example.c
> 
> The following warning is issued:
> 
> example.c: In function `main':
> example.c:5: warning: cast discards qualifiers from pointer target type
> 
> Removing the "__attribute__((__noreturn__))" from the declaration of
> the function ofp() gets rid of the warning, so the problem is, it
> seems, to keep the cast from discarding this attribute.  I have tried
> in many ways, but can't find the solution.
> 
> Anyone know how to fix this?
> 
> -tih

-- 
Johnny Billquist                  || "I'm on a bus
                                   ||  on a psychedelic trip
email: bqt@update.uu.se           ||  Reading murder books
pdp is alive!                     ||  tryin' to stay hip" - B. Idol