CPP wrapper to undefine some GNU CPP macros
RPCGEN sources (*.x) uses ifdef's which should go into resulting C files as is, but go expanded because GNU CPP defines some macros by default. E. g.: "%#ifdef _LP64" must become "#ifdef _LP64", not "#ifdef 1" in resulting C source.
This commit is contained in:
parent
ca9ac28639
commit
61f94f10c3
|
@ -0,0 +1,19 @@
|
|||
#!/bin/sh
|
||||
|
||||
# A wrapper for CPP (C preprocessor)
|
||||
# specially for rpcgen source files (*.x)
|
||||
# which uses "%#ifdef <CRAP>" while <CRAP>
|
||||
# is defined by default in GCC's CPP
|
||||
# For example:
|
||||
# "%#ifdef _LP64" will become "#ifdef 1"
|
||||
# instead of "#ifdef _LP64", because GNU CPP
|
||||
# defines _LP64 by default.
|
||||
#
|
||||
# Used as:
|
||||
# RCPGEN='rpcgen -Y $(CURDIR)/debian'
|
||||
|
||||
set -x
|
||||
set -e
|
||||
|
||||
exec /usr/bin/cpp -U_LP64 -U__STDC__ "$@"
|
||||
|
|
@ -1,124 +0,0 @@
|
|||
Description: Assume STD C in rpcgen sources.
|
||||
When GNU CPP is used, it defines __STDC__ macro to 1, so
|
||||
this macro in lines starting with '%' is expanded, and
|
||||
we have, "#ifdef 1" instead of "#ifdef __STDC__"
|
||||
in resulting output files. It is wrong.
|
||||
|
||||
Index: uts/usr/src/uts/common/avs/ns/rdc/rdc_prot.x
|
||||
===================================================================
|
||||
--- uts.orig/usr/src/uts/common/avs/ns/rdc/rdc_prot.x 2012-06-26 00:14:28.000000000 +0000
|
||||
+++ uts/usr/src/uts/common/avs/ns/rdc/rdc_prot.x 2012-07-14 20:27:18.468117189 +0000
|
||||
@@ -43,14 +43,9 @@
|
||||
%#define xdr_netbuf rdc_xdr_netbuf
|
||||
%#ifdef __cplusplus
|
||||
%extern "C" bool_t xdr_netbuf(XDR *, struct netbuf *);
|
||||
-%
|
||||
-%#elif __STDC__
|
||||
+%#else
|
||||
%extern bool_t xdr_netbuf(XDR *, struct netbuf *);
|
||||
-%
|
||||
-%#else /* K&R C */
|
||||
-%bool_t xdr_netbuf();
|
||||
-%
|
||||
-%#endif /* K&R C */
|
||||
+%#endif
|
||||
const RDC_PORT = 121;
|
||||
const RDC_MAXDATA = 32768;
|
||||
const RDC_MAXNAMLEN = 64;
|
||||
Index: uts/usr/src/uts/common/rpc/pmap_prot.x
|
||||
===================================================================
|
||||
--- uts.orig/usr/src/uts/common/rpc/pmap_prot.x 2012-06-26 00:14:37.000000000 +0000
|
||||
+++ uts/usr/src/uts/common/rpc/pmap_prot.x 2012-07-14 20:26:31.503266729 +0000
|
||||
@@ -133,11 +133,7 @@
|
||||
%#ifdef __cplusplus
|
||||
%extern "C" {
|
||||
%#endif
|
||||
-%#ifdef __STDC__
|
||||
%extern bool_t xdr_pmaplist(XDR *, pmaplist**);
|
||||
-%#else /* K&R C */
|
||||
-%bool_t xdr_pmaplist();
|
||||
-%#endif
|
||||
%#ifdef __cplusplus
|
||||
%}
|
||||
%#endif
|
||||
@@ -253,11 +249,7 @@
|
||||
% rpcport_t pm_port;
|
||||
%};
|
||||
%typedef struct pmap PMAP;
|
||||
-%#ifdef __STDC__
|
||||
%extern bool_t xdr_pmap (XDR *, struct pmap *);
|
||||
-%#else
|
||||
-%extern bool_t xdr_pmap ();
|
||||
-%#endif
|
||||
%
|
||||
%struct pmaplist {
|
||||
% struct pmap pml_map;
|
||||
Index: uts/usr/src/uts/common/rpc/rpcb_prot.x
|
||||
===================================================================
|
||||
--- uts.orig/usr/src/uts/common/rpc/rpcb_prot.x 2012-06-26 00:14:37.000000000 +0000
|
||||
+++ uts/usr/src/uts/common/rpc/rpcb_prot.x 2012-07-14 20:25:54.407798542 +0000
|
||||
@@ -162,11 +162,7 @@
|
||||
%#ifdef __cplusplus
|
||||
%extern "C" {
|
||||
%#endif
|
||||
-%#ifdef __STDC__
|
||||
%extern bool_t xdr_rpcblist(XDR *, rpcblist**);
|
||||
-%#else /* K&R C */
|
||||
-%bool_t xdr_rpcblist();
|
||||
-%#endif
|
||||
%#ifdef __cplusplus
|
||||
%}
|
||||
%#endif
|
||||
@@ -321,14 +317,9 @@
|
||||
% */
|
||||
%#ifdef __cplusplus
|
||||
%extern "C" bool_t xdr_netbuf(XDR *, struct netbuf *);
|
||||
-%
|
||||
-%#elif __STDC__
|
||||
+%#else
|
||||
%extern bool_t xdr_netbuf(XDR *, struct netbuf *);
|
||||
-%
|
||||
-%#else /* K&R C */
|
||||
-%bool_t xdr_netbuf();
|
||||
-%
|
||||
-%#endif /* K&R C */
|
||||
+%#endif
|
||||
#endif /* def RPC_HDR */
|
||||
|
||||
/*
|
||||
Index: uts/usr/src/uts/common/sys/lvm/meta_basic.x
|
||||
===================================================================
|
||||
--- uts.orig/usr/src/uts/common/sys/lvm/meta_basic.x 2012-07-14 15:40:44.254192108 +0000
|
||||
+++ uts/usr/src/uts/common/sys/lvm/meta_basic.x 2012-07-14 20:28:39.383888252 +0000
|
||||
@@ -297,7 +297,6 @@
|
||||
|
||||
#ifdef RPC_HDR
|
||||
%
|
||||
-%#if defined(__STDC__) || defined(__cplusplus)
|
||||
#ifndef _KERNEL
|
||||
%extern bool_t xdr_uint_t(XDR *xdrs, uint_t *objp);
|
||||
%extern bool_t xdr_ushort_t(XDR *xdrs, ushort_t *objp);
|
||||
@@ -315,23 +314,4 @@
|
||||
%extern bool_t xdr_minor_t(XDR *xdrs, minor_t *objp);
|
||||
%extern bool_t xdr_timeval(XDR *xdrs, struct timeval *objp);
|
||||
%extern bool_t xdr_clnt_stat(XDR *xdrs, enum clnt_stat *objp);
|
||||
-%#else /* K&R C */
|
||||
-#ifndef _KERNEL
|
||||
-%extern bool_t xdr_uint_t();
|
||||
-%extern bool_t xdr_ushort_t();
|
||||
-%extern bool_t xdr_dev_t();
|
||||
-%extern bool_t xdr_dev32_t();
|
||||
-%extern bool_t xdr_md_dev64_t();
|
||||
-%extern bool_t xdr_size_t();
|
||||
-%extern bool_t xdr_daddr_t();
|
||||
-%extern bool_t xdr_daddr32_t();
|
||||
-%extern bool_t xdr_diskaddr_t();
|
||||
-%extern bool_t xdr_ddi_devid_t();
|
||||
-%extern bool_t xdr_off_t();
|
||||
-%extern bool_t xdr_md_timeval32_t();
|
||||
-#endif /* !_KERNEL */
|
||||
-%extern bool_t xdr_minor_t();
|
||||
-%extern bool_t xdr_timeval();
|
||||
-%extern bool_t xdr_clnt_stat();
|
||||
-%#endif /* K&R C */
|
||||
#endif /* RPC_HDR */
|
|
@ -2,7 +2,6 @@ asm-linkage.patch
|
|||
u_int_t.patch
|
||||
relax-standard-conformance.patch
|
||||
sys-gssapi.patch
|
||||
rpcgen__stdc__.patch
|
||||
netinet_ip.h-include-netinet_in.h-for-struct_in_addr.patch
|
||||
sys-mnttab.h-include-stdio.h.patch
|
||||
sys-regset.patch
|
||||
|
|
|
@ -15,6 +15,10 @@ unpack-stamp:
|
|||
# and passing that source to as.
|
||||
# Default output format is expected to be 32-bit:
|
||||
echo "export ELFWRAP='$(CURDIR)/debian/elfwrap -32'" >> usr/env.sh
|
||||
|
||||
# We need a wrapper for GNU CPP to undefine some macros.
|
||||
# The wrapper is debian/cpp
|
||||
echo "export RPCGEN='rpcgen -Y $(CURDIR)/debian'" >> usr/env.sh
|
||||
touch $@
|
||||
|
||||
patch: patch-stamp
|
||||
|
|
Loading…
Reference in New Issue