[LTP] [PATCH 2/2] rpc/rpc-tirpc: Fix compile error on clang when using registerrpc
Yang Xu
xuyang2018.jy@fujitsu.com
Tue Apr 25 11:12:10 CEST 2023
When clang upgrade to 16.0.0-2.fc38, these case will report
incompatible-function-pointer-types error as below:
rpc_registerrpc.c:72:4: error: incompatible function pointer types passing
'bool_t (XDR *, int *)' (aka 'int (struct __rpc_xdr *, int *)') to parameter
of type 'xdrproc_t' (aka 'int (*)(struct __rpc_xdr *, ...)') [-Wincompatible-function-pointer-types]
xdr_int);
the registerrpc declare as below:
int registerrpc(int, int, int, char *(*)(char [UDPMSGSIZE]),
xdrproc_t, xdrproc_t);
so we should add xdrproc_t cast to avoid this.
Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com>
---
ps: has verified it on my ltp fork.
.../rpc_suite/rpc/rpc_regunreg_registerrpc/rpc_registerrpc.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_regunreg_registerrpc/rpc_registerrpc.c b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_regunreg_registerrpc/rpc_registerrpc.c
index 3becf4600..c6f76839c 100644
--- a/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_regunreg_registerrpc/rpc_registerrpc.c
+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_regunreg_registerrpc/rpc_registerrpc.c
@@ -68,8 +68,8 @@ int main(int argn, char *argc[])
//call routine
rslt =
- registerrpc(progNum, VERSNUM, PROCNUM, simplePing, xdr_int,
- xdr_int);
+ registerrpc(progNum, VERSNUM, PROCNUM, simplePing,
+ (xdrproc_t) xdr_int, (xdrproc_t) xdr_int);
if (run_mode) {
printf("SVC : %p\n", svcr);
--
2.39.1
More information about the ltp
mailing list