diff options
| author | Niels de Vos <ndevos@redhat.com> | 2017-03-13 14:01:24 +0100 |
|---|---|---|
| committer | Niels de Vos <ndevos@redhat.com> | 2017-03-17 15:11:09 +0100 |
| commit | 5d3d0bc59c1115117e6e624d12227d53a474b2ec (patch) | |
| tree | 85139ac97fa680ce3b52c1ff4250bb29069a12a9 /rpc/rpcl | |
| parent | 30e5f195a1b80ffe304b2ed70e0a2d8253d0cc42 (diff) | |
build: use rpcgen to generate all XDR code
Remove all generated files and have them generated when needed. This
build a libgbrpcxdr.la archive with the .o files that gets linked into
the libgbrpc.la archive. 'rpcgen' generates .c code that triggers
warnings for various compilers. This is not something that can easily be
fixed, so add rpc-pragmas.h (like GlusterFS does) to prevent these
warnings.
There are some functions used by gluster-blockd.c that are not part of
the header and were manually added to block.h. Because block.h get
regenerated now, these functions have been added to a new file
block_svc.h.
Note that generated and compiled files land in $(top_builddir). This
directory does not need to be the same as $(top_srcdir).
Change-Id: I0e764d159d6d785699537eed4e24b16883218038
Fixes: #2
Signed-off-by: Niels de Vos <ndevos@redhat.com>
Diffstat (limited to 'rpc/rpcl')
| -rw-r--r-- | rpc/rpcl/Makefile.am | 22 | ||||
| -rw-r--r-- | rpc/rpcl/block.x | 5 | ||||
| -rw-r--r-- | rpc/rpcl/block_svc.h | 20 | ||||
| -rw-r--r-- | rpc/rpcl/rpc-pragmas.h | 28 |
4 files changed, 75 insertions, 0 deletions
diff --git a/rpc/rpcl/Makefile.am b/rpc/rpcl/Makefile.am new file mode 100644 index 0000000..3aa6f0d --- /dev/null +++ b/rpc/rpcl/Makefile.am @@ -0,0 +1,22 @@ +libgbrpcxdr_la_SOURCES = block_clnt.c block_xdr.c block_svc.c + +noinst_LTLIBRARIES = libgbrpcxdr.la +noinst_HEADERS = block.h block_svc.h rpc-pragmas.h + +EXTRA_DIST = block.x +BUILT_SOURCES = block.h block_clnt.c block_svc.c block_xdr.c + +DISTCLEANFILES = Makefile.in $(BUILT_SOURCES) +CLEANFILES = *~ $(BUILT_SOURCES) + +block.h: block.x + rpcgen -h -o $(top_builddir)/rpc/rpcl/$@ $^ + +block_xdr.c: block.x + rpcgen -c -o $(top_builddir)/rpc/rpcl/$@ $^ + +block_clnt.c: block.x + rpcgen -l -o $(top_builddir)/rpc/rpcl/$@ $^ + +block_svc.c: block.x + rpcgen -m -o $(top_builddir)/rpc/rpcl/$@ $^ diff --git a/rpc/rpcl/block.x b/rpc/rpcl/block.x index e876ba4..4d840ff 100644 --- a/rpc/rpcl/block.x +++ b/rpc/rpcl/block.x @@ -1,3 +1,8 @@ +/* rpcgen generates code that results in unused-variable warnings */ +#ifdef RPC_XDR +%#include "rpc-pragmas.h" +#endif + struct blockCreate { char ipaddr[255]; char volume[255]; diff --git a/rpc/rpcl/block_svc.h b/rpc/rpcl/block_svc.h new file mode 100644 index 0000000..8d1a378 --- /dev/null +++ b/rpc/rpcl/block_svc.h @@ -0,0 +1,20 @@ +/* + Copyright (c) 2017 Red Hat, Inc. <http://www.redhat.com> + This file is part of gluster-block. + + This file is licensed to you under your choice of the GNU Lesser + General Public License, version 3 or any later version (LGPLv3 or + later), or the GNU General Public License, version 2 (GPLv2), in all + cases as published by the Free Software Foundation. +*/ + +# ifndef _BLOCK_SVC_H +# define _BLOCK_SVC_H + +void +gluster_block_cli_1(struct svc_req *rqstp, register SVCXPRT *transp); + +void +gluster_block_1(struct svc_req *rqstp, register SVCXPRT *transp); + +# endif /* _BLOCK_SVC_H */ diff --git a/rpc/rpcl/rpc-pragmas.h b/rpc/rpcl/rpc-pragmas.h new file mode 100644 index 0000000..91bd501 --- /dev/null +++ b/rpc/rpcl/rpc-pragmas.h @@ -0,0 +1,28 @@ +/* + Copyright (c) 2017 Red Hat, Inc. <http://www.redhat.com> + This file is part of gluster-block. + + This file is licensed to you under your choice of the GNU Lesser + General Public License, version 3 or any later version (LGPLv3 or + later), or the GNU General Public License, version 2 (GPLv2), in all + cases as published by the Free Software Foundation. +*/ + +#ifndef RPC_PRAGMAS_H +#define RPC_PRAGMAS_H + +#if defined(__GNUC__) +#if __GNUC__ >= 4 +#if !defined(__clang__) +#if !defined(__NetBSD__) +#pragma GCC diagnostic ignored "-Wunused-but-set-variable" +#pragma GCC diagnostic ignored "-Wunused-variable" +#endif +#else +#pragma clang diagnostic ignored "-Wunused-variable" +#pragma clang diagnostic ignored "-Wunused-value" +#endif +#endif +#endif + +#endif /* RPC_PRAGMAS_H */ |
