From: schwarze Date: Tue, 19 Jul 2016 13:30:16 +0000 (+0000) Subject: Use __attribute__((__format__ throughout. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=57c6a104c13c862b24b580195806a9b0fee7e843;p=openbsd Use __attribute__((__format__ throughout. Triggered by a smaller patch from Christos Zoulas. --- diff --git a/usr.bin/mandoc/html.h b/usr.bin/mandoc/html.h index 577643d1bbe..e46e0b60db4 100644 --- a/usr.bin/mandoc/html.h +++ b/usr.bin/mandoc/html.h @@ -1,4 +1,4 @@ -/* $OpenBSD: html.h,v 1.34 2015/11/07 13:57:55 schwarze Exp $ */ +/* $OpenBSD: html.h,v 1.35 2016/07/19 13:30:16 schwarze Exp $ */ /* * Copyright (c) 2008-2011, 2014 Kristaps Dzonsons * @@ -158,7 +158,8 @@ void print_tbl(struct html *, const struct tbl_span *); void print_eqn(struct html *, const struct eqn *); void print_paragraph(struct html *); -void bufcat_fmt(struct html *, const char *, ...); +void bufcat_fmt(struct html *, const char *, ...) + __attribute__((__format__ (printf, 2, 3))); void bufcat(struct html *, const char *); void bufcat_id(struct html *, const char *); void bufcat_style(struct html *, diff --git a/usr.bin/mandoc/libmandoc.h b/usr.bin/mandoc/libmandoc.h index 9bfebd03a50..dd2a55a1a1e 100644 --- a/usr.bin/mandoc/libmandoc.h +++ b/usr.bin/mandoc/libmandoc.h @@ -1,4 +1,4 @@ -/* $OpenBSD: libmandoc.h,v 1.48 2015/11/07 13:57:55 schwarze Exp $ */ +/* $OpenBSD: libmandoc.h,v 1.49 2016/07/19 13:30:16 schwarze Exp $ */ /* * Copyright (c) 2009, 2010, 2011, 2012 Kristaps Dzonsons * Copyright (c) 2013, 2014, 2015 Ingo Schwarze @@ -38,12 +38,12 @@ struct tbl_span; struct eqn; struct roff; struct roff_man; -struct roff_node; void mandoc_msg(enum mandocerr, struct mparse *, int, int, const char *); void mandoc_vmsg(enum mandocerr, struct mparse *, - int, int, const char *, ...); + int, int, const char *, ...) + __attribute__((__format__ (printf, 5, 6))); char *mandoc_getarg(struct mparse *, char **, int, int *); char *mandoc_normdate(struct mparse *, char *, int, int); int mandoc_eos(const char *, size_t); diff --git a/usr.bin/mandoc/mandoc_aux.h b/usr.bin/mandoc/mandoc_aux.h index 7ad0c495bd1..11ddd4cbf92 100644 --- a/usr.bin/mandoc/mandoc_aux.h +++ b/usr.bin/mandoc/mandoc_aux.h @@ -1,4 +1,4 @@ -/* $OpenBSD: mandoc_aux.h,v 1.6 2015/11/07 13:57:55 schwarze Exp $ */ +/* $OpenBSD: mandoc_aux.h,v 1.7 2016/07/19 13:30:16 schwarze Exp $ */ /* * Copyright (c) 2009, 2011 Kristaps Dzonsons * Copyright (c) 2014 Ingo Schwarze @@ -16,7 +16,8 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -int mandoc_asprintf(char **, const char *, ...); +int mandoc_asprintf(char **, const char *, ...) + __attribute__((__format__ (printf, 2, 3))); void *mandoc_calloc(size_t, size_t); void *mandoc_malloc(size_t); void *mandoc_realloc(void *, size_t); diff --git a/usr.bin/mandoc/mandocdb.c b/usr.bin/mandoc/mandocdb.c index f2b81a12ee7..d5e9a10fc74 100644 --- a/usr.bin/mandoc/mandocdb.c +++ b/usr.bin/mandoc/mandocdb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mandocdb.c,v 1.171 2016/07/15 18:02:32 schwarze Exp $ */ +/* $OpenBSD: mandocdb.c,v 1.172 2016/07/19 13:30:16 schwarze Exp $ */ /* * Copyright (c) 2011, 2012 Kristaps Dzonsons * Copyright (c) 2011-2016 Ingo Schwarze @@ -174,7 +174,8 @@ static void putkeys(const struct mpage *, char *, size_t, uint64_t); static void putmdockey(const struct mpage *, const struct roff_node *, uint64_t); static int render_string(char **, size_t *); -static void say(const char *, const char *, ...); +static void say(const char *, const char *, ...) + __attribute__((__format__ (printf, 2, 3))); static int set_basedir(const char *, int); static int treescan(void); static size_t utf8(unsigned int, char [7]); @@ -1786,7 +1787,7 @@ putkeys(const struct mpage *mpage, char *cp, size_t sz, uint64_t v) name_mask &= ~NAME_FIRST; if (debug > 1) say(mpage->mlinks->file, - "Adding name %*s, bits=%d", sz, cp, v); + "Adding name %*s, bits=0x%llu", (int)sz, cp, v); } else { htab = &strings; if (debug > 1) @@ -1794,7 +1795,7 @@ putkeys(const struct mpage *mpage, char *cp, size_t sz, uint64_t v) if ((uint64_t)1 << i & v) say(mpage->mlinks->file, "Adding key %s=%*s", - mansearch_keynames[i], sz, cp); + mansearch_keynames[i], (int)sz, cp); } end = cp + sz; diff --git a/usr.bin/mandoc/term_ps.c b/usr.bin/mandoc/term_ps.c index 3823edfb6ae..37a4dbde198 100644 --- a/usr.bin/mandoc/term_ps.c +++ b/usr.bin/mandoc/term_ps.c @@ -1,4 +1,4 @@ -/* $OpenBSD: term_ps.c,v 1.44 2015/12/23 20:31:17 mmcc Exp $ */ +/* $OpenBSD: term_ps.c,v 1.45 2016/07/19 13:30:16 schwarze Exp $ */ /* * Copyright (c) 2010, 2011 Kristaps Dzonsons * Copyright (c) 2014, 2015 Ingo Schwarze @@ -99,7 +99,8 @@ static void ps_growbuf(struct termp *, size_t); static void ps_letter(struct termp *, int); static void ps_pclose(struct termp *); static void ps_pletter(struct termp *, int); -static void ps_printf(struct termp *, const char *, ...); +static void ps_printf(struct termp *, const char *, ...) + __attribute__((__format__ (printf, 2, 3))); static void ps_putchar(struct termp *, char); static void ps_setfont(struct termp *, enum termfont); static void ps_setwidth(struct termp *, int, int);