ports/net/libfabric/files/patch-prov_hook_src_hook__domain.c
Dimitry Andric 26bc5ce8ba net/libfabric: fix build with clang 16
Clang 16 has a new error about incompatible function types, which shows
up when building net/libfabric (on i386):

  prov/hook/src/hook_domain.c:124:12: error: incompatible function pointer types passing 'ssize_t (struct fid_ep *, size_t)' (aka 'int (struct fid_ep *, unsigned int)') to parameter of type 'ssize_t (*)(struct fid_ep *, uint64_t)' (aka 'int (*)(struct fid_ep *, unsigned long long)') [-Wincompatible-function-pointer-types]
                                                       hook_credit_handler);
                                                       ^~~~~~~~~~~~~~~~~~~
  prov/hook/src/hook_domain.c:150:17: error: incompatible function pointer types initializing 'void (*)(struct fid_ep *, uint64_t)' (aka 'void (*)(struct fid_ep *, unsigned long long)') with an expression of type 'void (struct fid_ep *, size_t)' (aka 'void (struct fid_ep *, unsigned int)') [-Wincompatible-function-pointer-types]
          .add_credits = hook_add_credits,
                         ^~~~~~~~~~~~~~~~
  prov/hook/src/hook_domain.c:152:22: error: incompatible function pointer types initializing 'void (*)(struct fid_domain *, ssize_t (*)(struct fid_ep *, uint64_t))' (aka 'void (*)(struct fid_domain *, int (*)(struct fid_ep *, unsigned long long))') with an expression of type 'void (struct fid_domain *, ssize_t (*)(struct fid_ep *, size_t))' (aka 'void (struct fid_domain *, int (*)(struct fid_ep *, unsigned int))') [-Wincompatible-function-pointer-types]
          .set_send_handler = hook_set_send_handler,
                              ^~~~~~~~~~~~~~~~~~~~~

The problem is that the 'credits' parameter used in these functions is
size_t in some cases, but uint64_t in other cases. On LP64 architectures
this does not result in any errors, but on e.g. i386 you get the above.

Make the 'credits' parameter uint64_t everywhere to fix this issue.

PR:		271537
Approved by:	yuri (maintainer)
MFH:		2023Q2
2023-05-20 22:02:45 +02:00

29 lines
1.1 KiB
C

--- prov/hook/src/hook_domain.c.orig 2022-04-30 21:46:31 UTC
+++ prov/hook/src/hook_domain.c
@@ -102,7 +102,7 @@ static struct fi_ops_mr hook_mr_ops = {
.regattr = hook_mr_regattr,
};
-static ssize_t hook_credit_handler(struct fid_ep *ep_fid, size_t credits)
+static ssize_t hook_credit_handler(struct fid_ep *ep_fid, uint64_t credits)
{
/*
* called from the base provider, ep_fid is the base ep, and
@@ -114,7 +114,7 @@ static void hook_set_send_handler(struct fid_domain *d
}
static void hook_set_send_handler(struct fid_domain *domain_fid,
- ssize_t (*credit_handler)(struct fid_ep *ep, size_t credits))
+ ssize_t (*credit_handler)(struct fid_ep *ep, uint64_t credits))
{
struct hook_domain *domain = container_of(domain_fid,
struct hook_domain, domain);
@@ -131,7 +131,7 @@ static int hook_enable_ep_flow_ctrl(struct fid_ep *ep_
return ep->domain->base_ops_flow_ctrl->enable(ep->hep, threshold);
}
-static void hook_add_credits(struct fid_ep *ep_fid, size_t credits)
+static void hook_add_credits(struct fid_ep *ep_fid, uint64_t credits)
{
struct hook_ep *ep = container_of(ep_fid, struct hook_ep, ep);