aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2016-07-19 13:36:13 +0000
committerIngo Schwarze <schwarze@openbsd.org>2016-07-19 13:36:13 +0000
commit607678e917a8a274f92445854c58aaaa05b824a8 (patch)
treea5dfdca19aaab7604737bb285f32470aabc72029
parent6b89b9b2b63e9e25bf91f88bab4163a497bfcca4 (diff)
downloadmandoc-607678e917a8a274f92445854c58aaaa05b824a8.tar.gz
mandoc-607678e917a8a274f92445854c58aaaa05b824a8.tar.zst
mandoc-607678e917a8a274f92445854c58aaaa05b824a8.zip
Use __attribute__((__format__ throughout.
Triggered by a smaller patch from Christos Zoulas. While here, unify style, move several config tests to config.h, and delete the useless MANDOC_CONFIG_H.
-rwxr-xr-xconfigure8
-rw-r--r--html.h8
-rw-r--r--libmandoc.h8
-rw-r--r--main.c8
-rw-r--r--mandoc_aux.h5
-rw-r--r--mandocdb.c9
-rw-r--r--term_ps.c8
7 files changed, 21 insertions, 33 deletions
diff --git a/configure b/configure
index 9d670b43..9e7128e6 100755
--- a/configure
+++ b/configure
@@ -285,8 +285,9 @@ cat << __HEREDOC__
#error "Do not use C++. See the INSTALL file."
#endif
-#ifndef MANDOC_CONFIG_H
-#define MANDOC_CONFIG_H
+#if !defined(__GNUC__) || (__GNUC__ < 4)
+#define __attribute__(x)
+#endif
#if defined(__linux__) || defined(__MINT__)
#define _GNU_SOURCE /* See test-*.c what needs this. */
@@ -391,9 +392,6 @@ fi
[ ${HAVE_VASPRINTF} -eq 0 ] && \
echo "extern int vasprintf(char **, const char *, va_list);"
-echo
-echo "#endif /* MANDOC_CONFIG_H */"
-
echo "config.h: written" 1>&2
echo "config.h: written" 1>&3
diff --git a/html.h b/html.h
index 27dc1401..89e3f89c 100644
--- a/html.h
+++ b/html.h
@@ -1,4 +1,4 @@
-/* $Id: html.h,v 1.72 2015/11/07 14:01:16 schwarze Exp $ */
+/* $Id: html.h,v 1.73 2016/07/19 13:36:13 schwarze Exp $ */
/*
* Copyright (c) 2008-2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -158,10 +158,8 @@ void print_tbl(struct html *, const struct tbl_span *);
void print_eqn(struct html *, const struct eqn *);
void print_paragraph(struct html *);
-#if __GNUC__ - 0 >= 4
-__attribute__((__format__ (__printf__, 2, 3)))
-#endif
-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/libmandoc.h b/libmandoc.h
index 9ed8f150..96e726cb 100644
--- a/libmandoc.h
+++ b/libmandoc.h
@@ -1,4 +1,4 @@
-/* $Id: libmandoc.h,v 1.63 2016/07/07 19:19:01 schwarze Exp $ */
+/* $Id: libmandoc.h,v 1.64 2016/07/19 13:36:13 schwarze Exp $ */
/*
* Copyright (c) 2009, 2010, 2011, 2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2013, 2014, 2015 Ingo Schwarze <schwarze@openbsd.org>
@@ -41,11 +41,9 @@ struct roff_man;
void mandoc_msg(enum mandocerr, struct mparse *,
int, int, const char *);
-#if __GNUC__ - 0 >= 4
-__attribute__((__format__ (__printf__, 5, 6)))
-#endif
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/main.c b/main.c
index e7e70d04..16f55a09 100644
--- a/main.c
+++ b/main.c
@@ -1,4 +1,4 @@
-/* $Id: main.c,v 1.272 2016/07/15 19:33:01 schwarze Exp $ */
+/* $Id: main.c,v 1.273 2016/07/19 13:36:13 schwarze Exp $ */
/*
* Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2012, 2014-2016 Ingo Schwarze <schwarze@openbsd.org>
@@ -51,12 +51,6 @@
#include "manconf.h"
#include "mansearch.h"
-#if !defined(__GNUC__) || (__GNUC__ < 2)
-# if !defined(lint)
-# define __attribute__(x)
-# endif
-#endif /* !defined(__GNUC__) || (__GNUC__ < 2) */
-
enum outmode {
OUTMODE_DEF = 0,
OUTMODE_FLN,
diff --git a/mandoc_aux.h b/mandoc_aux.h
index 2ae3a0cd..603cc5a7 100644
--- a/mandoc_aux.h
+++ b/mandoc_aux.h
@@ -1,4 +1,4 @@
-/* $Id: mandoc_aux.h,v 1.4 2015/11/07 14:01:16 schwarze Exp $ */
+/* $Id: mandoc_aux.h,v 1.5 2016/07/19 13:36:13 schwarze Exp $ */
/*
* Copyright (c) 2009, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -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/mandocdb.c b/mandocdb.c
index d5052db9..b885dd5c 100644
--- a/mandocdb.c
+++ b/mandocdb.c
@@ -1,4 +1,4 @@
-/* $Id: mandocdb.c,v 1.219 2016/07/15 18:03:45 schwarze Exp $ */
+/* $Id: mandocdb.c,v 1.220 2016/07/19 13:36:13 schwarze Exp $ */
/*
* Copyright (c) 2011, 2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2011-2016 Ingo Schwarze <schwarze@openbsd.org>
@@ -185,7 +185,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]);
@@ -1818,7 +1819,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)
@@ -1826,7 +1827,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/term_ps.c b/term_ps.c
index 6105d558..1c7a007e 100644
--- a/term_ps.c
+++ b/term_ps.c
@@ -1,4 +1,4 @@
-/* $Id: term_ps.c,v 1.80 2015/12/23 20:50:13 schwarze Exp $ */
+/* $Id: term_ps.c,v 1.81 2016/07/19 13:36:13 schwarze Exp $ */
/*
* Copyright (c) 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2014, 2015 Ingo Schwarze <schwarze@openbsd.org>
@@ -103,10 +103,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);
-#if __GNUC__ - 0 >= 4
-__attribute__((__format__ (__printf__, 2, 3)))
-#endif
-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);