Skip to content

Commit

Permalink
ibdiags: Mark functions taking format strings with attribute format
Browse files Browse the repository at this point in the history
And fix the resulting format string errors. Resolves clang warning
-Wformat-nonliteral

Reviewed-by: Nicolas Morey-Chaisemartin <NMoreyChaisemartin@suse.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Signed-off-by: Ira Weiny <ira.weiny@intel.com>
  • Loading branch information
jgunthorpe authored and weiny2 committed Apr 15, 2019
1 parent 552e224 commit 35fba20
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
9 changes: 6 additions & 3 deletions include/ibdiag_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,8 @@ extern int ibdiag_process_opts(int argc, char *const argv[], void *context,
const char *usage_args,
const char *usage_examples[]);
extern void ibdiag_show_usage(void);
extern void ibexit(const char *fn, const char *msg, ...);
extern void ibexit(const char *fn, const char *msg, ...)
__attribute__((format(printf, 2, 3)));

/* convert counter values to a float with a unit specifier returned (using
* binary prefix)
Expand All @@ -162,9 +163,11 @@ int resolve_portid_str(char *ca_name, uint8_t ca_port, ib_portid_t * portid,
char *addr_str, enum MAD_DEST dest_type,
ib_portid_t *sm_id, const struct ibmad_port *srcport);
int vsnprint_field(char *buf, size_t n, enum MAD_FIELDS f, int spacing,
const char *format, va_list va_args);
const char *format, va_list va_args)
__attribute__((format(printf, 5, 0)));
int snprint_field(char *buf, size_t n, enum MAD_FIELDS f, int spacing,
const char *format, ...);
const char *format, ...)
__attribute__((format(printf, 5, 6)));
void dump_portinfo(void *pi, int tabs);

/**
Expand Down
2 changes: 1 addition & 1 deletion src/ibportstate.c
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ int main(int argc, char **argv)
port_args[j].set = 1;
if (!port_args[j].val) {
if (port_op >= 0)
IBEXIT("%s only one of: ",
IBEXIT("%s only one of: "
"query, enable, disable, "
"reset, down, arm, active, "
"can be specified",
Expand Down

0 comments on commit 35fba20

Please sign in to comment.