Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lib: printf bugfixes & improvement #771

Merged
merged 1 commit into from
Jun 30, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions lib/termtable.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
#ifndef _TERMTABLE_H_
#define _TERMTABLE_H_

#include <zebra.h>

enum ttable_align {
LEFT,
RIGHT,
Expand Down Expand Up @@ -131,7 +133,8 @@ void ttable_cell_del(struct ttable_cell *cell);
* columns were specified
*/
struct ttable_cell *ttable_insert_row(struct ttable *tt, unsigned int row,
const char *format, ...);
const char *format, ...)
PRINTF_ATTRIBUTE(3, 4);
/**
* Inserts a new row at the end of the table.
*
Expand All @@ -156,7 +159,8 @@ struct ttable_cell *ttable_insert_row(struct ttable *tt, unsigned int row,
* @return pointer to the first cell in the created row, or NULL if not enough
* columns were specified
*/
struct ttable_cell *ttable_add_row(struct ttable *tt, const char *format, ...);
struct ttable_cell *ttable_add_row(struct ttable *tt, const char *format, ...)
PRINTF_ATTRIBUTE(2, 3);

/**
* Removes a row from the table.
Expand Down
4 changes: 2 additions & 2 deletions lib/thread.c
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ DEFUN (show_thread_cpu,
filter = parse_filter (argv[idx]->arg);
if (!filter) {
vty_outln(vty, "Invalid filter \"%s\" specified; must contain at least"
"one of 'RWTEXB'%s", argv[idx]->arg);
"one of 'RWTEXB'", argv[idx]->arg);
return CMD_WARNING;
}
}
Expand All @@ -295,7 +295,7 @@ DEFUN (clear_thread_cpu,
filter = parse_filter (argv[idx]->arg);
if (!filter) {
vty_outln(vty, "Invalid filter \"%s\" specified; must contain at least"
"one of 'RWTEXB'%s", argv[idx]->arg);
"one of 'RWTEXB'", argv[idx]->arg);
return CMD_WARNING;
}
}
Expand Down
7 changes: 0 additions & 7 deletions lib/vty.h
Original file line number Diff line number Diff line change
Expand Up @@ -197,13 +197,6 @@ struct vty_arg
#define IS_DIRECTORY_SEP(c) ((c) == DIRECTORY_SEP)
#endif

/* GCC have printf type attribute check. */
#ifdef __GNUC__
#define PRINTF_ATTRIBUTE(a,b) __attribute__ ((__format__ (__printf__, a, b)))
#else
#define PRINTF_ATTRIBUTE(a,b)
#endif /* __GNUC__ */

/* Exported variables */
extern char integrate_default[];

Expand Down
6 changes: 6 additions & 0 deletions lib/zebra.h
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,12 @@ size_t strlcpy (char *__restrict dest, const char *__restrict src, size_t size);
#endif /* HAVE_BROKEN_CMSG_FIRSTHDR */


/* GCC have printf type attribute check. */
#ifdef __GNUC__
#define PRINTF_ATTRIBUTE(a,b) __attribute__ ((__format__ (__printf__, a, b)))
#else
#define PRINTF_ATTRIBUTE(a,b)
#endif /* __GNUC__ */

/*
* RFC 3542 defines several macros for using struct cmsghdr.
Expand Down