source@mandoc.bsd.lv
 help / color / mirror / Atom feed
From: schwarze@mdocml.bsd.lv
To: source@mdocml.bsd.lv
Subject: mdocml: Use __attribute__((__format__ throughout.
Date: Tue, 19 Jul 2016 08:36:44 -0500 (EST)	[thread overview]
Message-ID: <4204378533856250992.enqueue@fantadrom.bsd.lv> (raw)

Log Message:
-----------
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.

Modified Files:
--------------
    mdocml:
        configure
        html.h
        libmandoc.h
        main.c
        mandoc_aux.h
        mandocdb.c
        term_ps.c

Revision Data
-------------
Index: mandocdb.c
===================================================================
RCS file: /home/cvs/mdocml/mdocml/mandocdb.c,v
retrieving revision 1.219
retrieving revision 1.220
diff -Lmandocdb.c -Lmandocdb.c -u -p -r1.219 -r1.220
--- mandocdb.c
+++ mandocdb.c
@@ -185,7 +185,8 @@ static	void	 putkeys(const struct mpage 
 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 
 			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 
 			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;
Index: main.c
===================================================================
RCS file: /home/cvs/mdocml/mdocml/main.c,v
retrieving revision 1.272
retrieving revision 1.273
diff -Lmain.c -Lmain.c -u -p -r1.272 -r1.273
--- main.c
+++ main.c
@@ -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,
Index: html.h
===================================================================
RCS file: /home/cvs/mdocml/mdocml/html.h,v
retrieving revision 1.72
retrieving revision 1.73
diff -Lhtml.h -Lhtml.h -u -p -r1.72 -r1.73
--- html.h
+++ html.h
@@ -158,10 +158,8 @@ void		  print_tbl(struct html *, const s
 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 *,
Index: libmandoc.h
===================================================================
RCS file: /home/cvs/mdocml/mdocml/libmandoc.h,v
retrieving revision 1.63
retrieving revision 1.64
diff -Llibmandoc.h -Llibmandoc.h -u -p -r1.63 -r1.64
--- libmandoc.h
+++ libmandoc.h
@@ -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);
Index: term_ps.c
===================================================================
RCS file: /home/cvs/mdocml/mdocml/term_ps.c,v
retrieving revision 1.80
retrieving revision 1.81
diff -Lterm_ps.c -Lterm_ps.c -u -p -r1.80 -r1.81
--- term_ps.c
+++ term_ps.c
@@ -103,10 +103,8 @@ static	void		  ps_growbuf(struct termp *
 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);
Index: configure
===================================================================
RCS file: /home/cvs/mdocml/mdocml/configure,v
retrieving revision 1.42
retrieving revision 1.43
diff -Lconfigure -Lconfigure -u -p -r1.42 -r1.43
--- configure
+++ 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. */
@@ -390,9 +391,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
Index: mandoc_aux.h
===================================================================
RCS file: /home/cvs/mdocml/mdocml/mandoc_aux.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -Lmandoc_aux.h -Lmandoc_aux.h -u -p -r1.4 -r1.5
--- mandoc_aux.h
+++ mandoc_aux.h
@@ -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);
--
 To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv

                 reply	other threads:[~2016-07-19 13:36 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4204378533856250992.enqueue@fantadrom.bsd.lv \
    --to=schwarze@mdocml.bsd.lv \
    --cc=source@mdocml.bsd.lv \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).