@@ -110,6 +110,7 @@ RDMA_EnableCStd()
# FIXME: I wonder how many of the signed compares are bugs?
RDMA_AddOptCFlag(CMAKE_C_FLAGS HAVE_C_WARNINGS
"-Wall -Wextra -Wno-sign-compare -Wno-unused-parameter")
+RDMA_AddOptCFlag(CMAKE_C_FLAGS HAVE_C_WMISSING_PROTOTYPES "-Wmissing-prototypes")
# At some point around 5.4 gcc fixed missing-field-initializers to ignore this
# common idiom we use extensively. Since this is a useful warning for
@@ -27,8 +27,10 @@ endif()
# And matching source, this also checks that .symver asm works
check_c_source_compiles("
+void ibv_get_device_list_1(void);
void ibv_get_device_list_1(void){}
asm(\".symver ibv_get_device_list_1, ibv_get_device_list@IBVERBS_1.1\");
+void ibv_get_device_list_0(void);
void ibv_get_device_list_0(void){}
asm(\".symver ibv_get_device_list_0, ibv_get_device_list@@IBVERBS_1.0\");
@@ -53,4 +53,6 @@ typedef void (*acm_if_iter_cb)(char *ifname, union ibv_gid *gid, uint16_t pkey,
char *ip_str, void *ctx);
int acm_if_iter_sys(acm_if_iter_cb cb, void *ctx);
+char **parse(char *args, int *count);
+
#endif /* ACM_IF_H */
@@ -74,9 +74,6 @@ int verbose;
struct ibv_context **verbs;
int dev_cnt;
-extern int gen_addr_ip(FILE *f);
-extern char **parse(char *args, int *count);
-
#define VPRINT(format, ...) do { if (verbose) printf(format, ## __VA_ARGS__ ); } while (0)
static void show_usage(char *program)
@@ -958,7 +955,7 @@ static int query_svcs(void)
return ret;
}
-char *opt_arg(int argc, char **argv)
+static char *opt_arg(int argc, char **argv)
{
if (optarg)
return optarg;
@@ -969,7 +966,7 @@ char *opt_arg(int argc, char **argv)
return NULL;
}
-void parse_perf_arg(char *arg)
+static void parse_perf_arg(char *arg)
{
if (!strnicmp("col", arg, 3)) {
perf_query = PERF_QUERY_COL;
@@ -30,6 +30,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include "acm_util.h"
static char *expand(char *basename, char *args, int *str_cnt, int *str_size)
{
@@ -40,6 +40,8 @@
#include "ibverbs.h"
+#pragma GCC diagnostic ignored "-Wmissing-prototypes"
+
struct ibv_pd_1_0 {
struct ibv_context_1_0 *context;
uint32_t handle;
@@ -47,6 +47,8 @@
#include "ibverbs.h"
+#pragma GCC diagnostic ignored "-Wmissing-prototypes"
+
static pthread_once_t device_list_once = PTHREAD_ONCE_INIT;
static int num_devices;
static struct ibv_device **device_list;
@@ -283,7 +283,7 @@ static void print_device_cap_flags(uint32_t dev_cap_flags)
dev_cap_flags & unknown_flags);
}
-void print_odp_trans_caps(uint32_t trans)
+static void print_odp_trans_caps(uint32_t trans)
{
uint32_t unknown_transport_caps = ~(IBV_ODP_SUPPORT_SEND |
IBV_ODP_SUPPORT_RECV |
@@ -310,7 +310,7 @@ void print_odp_trans_caps(uint32_t trans)
}
}
-void print_odp_caps(const struct ibv_odp_caps *caps)
+static void print_odp_caps(const struct ibv_odp_caps *caps)
{
uint64_t unknown_general_caps = ~(IBV_ODP_SUPPORT);
@@ -78,7 +78,7 @@ struct pingpong_context {
uint64_t completion_timestamp_mask;
};
-struct ibv_cq *pp_cq(struct pingpong_context *ctx)
+static struct ibv_cq *pp_cq(struct pingpong_context *ctx)
{
return use_ts ? ibv_cq_ex_to_cq(ctx->cq_s.cq_ex) :
ctx->cq_s.cq;
@@ -496,7 +496,7 @@ clean_ctx:
return NULL;
}
-int pp_close_ctx(struct pingpong_context *ctx)
+static int pp_close_ctx(struct pingpong_context *ctx)
{
if (ibv_destroy_qp(ctx->qp)) {
fprintf(stderr, "Couldn't destroy QP\n");
@@ -497,7 +497,7 @@ clean_ctx:
return NULL;
}
-int pp_close_ctx(struct pingpong_context *ctx, int num_qp)
+static int pp_close_ctx(struct pingpong_context *ctx, int num_qp)
{
int i;
@@ -426,7 +426,7 @@ clean_ctx:
return NULL;
}
-int pp_close_ctx(struct pingpong_context *ctx)
+static int pp_close_ctx(struct pingpong_context *ctx)
{
if (ibv_destroy_qp(ctx->qp)) {
fprintf(stderr, "Couldn't destroy QP\n");
@@ -438,7 +438,7 @@ clean_ctx:
return NULL;
}
-int pp_close_ctx(struct pingpong_context *ctx)
+static int pp_close_ctx(struct pingpong_context *ctx)
{
if (ibv_destroy_qp(ctx->qp)) {
fprintf(stderr, "Couldn't destroy QP\n");
@@ -130,6 +130,8 @@ enum ibv_rate mbps_to_ibv_rate(int mbps)
}
}
+#pragma GCC diagnostic ignored "-Wmissing-prototypes"
+
int __ibv_query_device(struct ibv_context *context,
struct ibv_device_attr *device_attr)
{
This is useful to detect functions which probably should be static. One wrinkle is the use of .symver macros in verbs. These require non-static definitions that cannot have the same name as the public prototype. Locally disable the warning to deal with that. Signed-off-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com> --- CMakeLists.txt | 1 + buildlib/FindLDSymVer.cmake | 2 ++ ibacm/src/acm_util.h | 2 ++ ibacm/src/acme.c | 7 ++----- ibacm/src/parse.c | 1 + libibverbs/compat-1_0.c | 2 ++ libibverbs/device.c | 2 ++ libibverbs/examples/devinfo.c | 4 ++-- libibverbs/examples/rc_pingpong.c | 4 ++-- libibverbs/examples/srq_pingpong.c | 2 +- libibverbs/examples/uc_pingpong.c | 2 +- libibverbs/examples/ud_pingpong.c | 2 +- libibverbs/verbs.c | 2 ++ 13 files changed, 21 insertions(+), 12 deletions(-)