source@mandoc.bsd.lv
 help / color / Atom feed
From: schwarze@mandoc.bsd.lv
To: source@mandoc.bsd.lv
Subject: mandoc: Only compile compat_*.c implementations that are actually
Date: Sun, 14 Jun 2020 20:37:46 -0500 (EST)
Message-ID: <490dd254e5b643b9@mandoc.bsd.lv> (raw)

Log Message:
-----------
Only compile compat_*.c implementations that are actually needed.
That's cleaner and it is supposed to fix compiler warnings with gcc 10
reported by Wynn Wolf Arbor <wolf at oriole dot systems> on discuss@.

Modified Files:
--------------
    mandoc:
        Makefile
        compat_err.c
        compat_fts.c
        compat_getline.c
        compat_getsubopt.c
        compat_isblank.c
        compat_mkdtemp.c
        compat_ohash.c
        compat_progname.c
        compat_reallocarray.c
        compat_recallocarray.c
        compat_strcasestr.c
        compat_stringlist.c
        compat_strlcat.c
        compat_strlcpy.c
        compat_strndup.c
        compat_strsep.c
        compat_strtonum.c
        compat_vasprintf.c
        configure

Revision Data
-------------
Index: compat_getline.c
===================================================================
RCS file: /home/cvs/mandoc/mandoc/compat_getline.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -Lcompat_getline.c -Lcompat_getline.c -u -p -r1.1 -r1.2
--- compat_getline.c
+++ compat_getline.c
@@ -1,12 +1,4 @@
-#include "config.h"
-
-#if HAVE_GETLINE
-
-int dummy;
-
-#else
-
-/*	$Id$ */
+/* $Id$ */
 /*
  * Copyright (c) 2015 Ingo Schwarze <schwarze@openbsd.org>
  *
@@ -22,6 +14,7 @@ int dummy;
  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
+#include "config.h"
 
 #include <sys/types.h>
 #include <errno.h>
@@ -64,5 +57,3 @@ getline(char **buf, size_t *bufsz, FILE 
 			return pos;
 	}
 }
-
-#endif
Index: compat_progname.c
===================================================================
RCS file: /home/cvs/mandoc/mandoc/compat_progname.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -Lcompat_progname.c -Lcompat_progname.c -u -p -r1.1 -r1.2
--- compat_progname.c
+++ compat_progname.c
@@ -1,12 +1,4 @@
-#include "config.h"
-
-#if HAVE_PROGNAME
-
-int dummy;
-
-#else
-
-/*	$Id$	*/
+/* $Id$ */
 /*
  * Copyright (c) 2015 Ingo Schwarze <schwarze@openbsd.org>
  *
@@ -22,21 +14,18 @@ int dummy;
  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
+#include "config.h"
 
 static const char *progname;
 
 void
 setprogname(const char *name)
 {
-
 	progname = name;
 }
 
 const char *
 getprogname(void)
 {
-
 	return progname;
 }
-
-#endif
Index: compat_strlcat.c
===================================================================
RCS file: /home/cvs/mandoc/mandoc/compat_strlcat.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -Lcompat_strlcat.c -Lcompat_strlcat.c -u -p -r1.4 -r1.5
--- compat_strlcat.c
+++ compat_strlcat.c
@@ -1,11 +1,4 @@
-#include "config.h"
-
-#if HAVE_STRLCAT
-
-int dummy;
-
-#else
-
+/*	$Id$	*/
 /*	$OpenBSD: strlcat.c,v 1.13 2005/08/08 08:05:37 espie Exp $	*/
 
 /*
@@ -23,6 +16,7 @@ int dummy;
  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
+#include "config.h"
 
 #include <sys/types.h>
 #include <string.h>
@@ -61,5 +55,3 @@ strlcat(char *dst, const char *src, size
 
 	return(dlen + (s - src));	/* count does not include NUL */
 }
-
-#endif
Index: compat_strtonum.c
===================================================================
RCS file: /home/cvs/mandoc/mandoc/compat_strtonum.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -Lcompat_strtonum.c -Lcompat_strtonum.c -u -p -r1.1 -r1.2
--- compat_strtonum.c
+++ compat_strtonum.c
@@ -1,13 +1,5 @@
-#include "config.h"
-
-#if HAVE_STRTONUM
-
-int dummy;
-
-#else
-
 /*	$Id$	*/
-/*	$OpenBSD: strtonum.c,v 1.7 2013/04/17 18:40:58 tedu Exp $	*/
+/*	$OpenBSD: strtonum.c,v 1.8 2015/09/13 08:31:48 guenther Exp $	*/
 
 /*
  * Copyright (c) 2004 Ted Unangst and Todd Miller
@@ -25,6 +17,7 @@ int dummy;
  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
+#include "config.h"
 
 #include <errno.h>
 #include <limits.h>
@@ -72,5 +65,3 @@ strtonum(const char *numstr, long long m
 
 	return (ll);
 }
-
-#endif /* !HAVE_STRTONUM */
Index: compat_recallocarray.c
===================================================================
RCS file: /home/cvs/mandoc/mandoc/compat_recallocarray.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -Lcompat_recallocarray.c -Lcompat_recallocarray.c -u -p -r1.1 -r1.2
--- compat_recallocarray.c
+++ compat_recallocarray.c
@@ -1,15 +1,7 @@
-#include "config.h"
-
-#if HAVE_RECALLOCARRAY
-
-int dummy;
-
-#else
-
 /*	$Id$ */
-/*	$OpenBSD: malloc.c,v 1.225 2017/05/13 07:11:29 otto Exp $ */
+/*	$OpenBSD: recallocarray.c,v 1.1 2017/03/06 18:44:21 otto Exp $	*/
 /*
- * Copyright (c) 2017 Otto Moerbeek <otto@drijf.net>
+ * Copyright (c) 2008, 2017 Otto Moerbeek <otto@drijf.net>
  *
  * Permission to use, copy, modify, and distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above
@@ -23,18 +15,19 @@ int dummy;
  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
+#include "config.h"
 
 #include <sys/types.h>
 #include <errno.h>
-#include <stdint.h>
 #include <stdlib.h>
+#include <stdint.h>
 #include <string.h>
 
 /*
  * This is sqrt(SIZE_MAX+1), as s1*s2 <= SIZE_MAX
  * if both s1 < MUL_NO_OVERFLOW and s2 < MUL_NO_OVERFLOW
  */
-#define MUL_NO_OVERFLOW	((size_t)1 << (sizeof(size_t) * 4))
+#define MUL_NO_OVERFLOW ((size_t)1 << (sizeof(size_t) * 4))
 
 /*
  * Even though specified in POSIX, the PAGESIZE and PAGE_SIZE
@@ -42,7 +35,7 @@ int dummy;
  * to avoid free() overhead for small shrinking, simply pick
  * an arbitrary number.
  */
-#define MALLOC_PAGESIZE         (1UL << 12)
+#define getpagesize()	(1UL << 12)
 
 
 void *
@@ -75,7 +68,7 @@ recallocarray(void *ptr, size_t oldnmemb
 	if (newsize <= oldsize) {
 		size_t d = oldsize - newsize;
 
-		if (d < oldsize / 2 && d < MALLOC_PAGESIZE) {
+		if (d < oldsize / 2 && d < getpagesize()) {
 			memset((char *)ptr + newsize, 0, d);
 			return ptr;
 		}
@@ -104,5 +97,3 @@ recallocarray(void *ptr, size_t oldnmemb
 
 	return newptr;
 }
-
-#endif /* !HAVE_RECALLOCARRAY */
Index: compat_ohash.c
===================================================================
RCS file: /home/cvs/mandoc/mandoc/compat_ohash.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -Lcompat_ohash.c -Lcompat_ohash.c -u -p -r1.6 -r1.7
--- compat_ohash.c
+++ compat_ohash.c
@@ -1,11 +1,4 @@
-#include "config.h"
-
-#if HAVE_OHASH
-
-int dummy;
-
-#else
-
+/* $Id$ */
 /* $OpenBSD: ohash.c,v 1.1 2014/06/02 18:52:03 deraadt Exp $ */
 
 /* Copyright (c) 1999, 2004 Marc Espie <espie@openbsd.org>
@@ -22,9 +15,9 @@ int dummy;
  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
+#include "config.h"
 
 #include <sys/types.h>
-
 #include <stddef.h>
 #include <stdint.h>
 #include <stdlib.h>
@@ -335,5 +328,3 @@ ohash_qlookupi(struct ohash *h, const ch
 	hv = ohash_interval(s, e);
 	return ohash_lookup_interval(h, s, *e, hv);
 }
-
-#endif /*!HAVE_OHASH*/
Index: compat_isblank.c
===================================================================
RCS file: /home/cvs/mandoc/mandoc/compat_isblank.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -Lcompat_isblank.c -Lcompat_isblank.c -u -p -r1.2 -r1.3
--- compat_isblank.c
+++ compat_isblank.c
@@ -1,12 +1,4 @@
-#include "config.h"
-
-#if HAVE_ISBLANK
-
-int dummy;
-
-#else
-
-/*	$Id$	*/
+/* $Id$ */
 /*
  * Copyright (c) 2015 Ingo Schwarze <schwarze@openbsd.org>
  *
@@ -22,12 +14,10 @@ int dummy;
  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
+#include "config.h"
 
 int
 isblank(int c)
 {
-
 	return c == ' ' || c == '\t';
 }
-
-#endif
Index: compat_stringlist.c
===================================================================
RCS file: /home/cvs/mandoc/mandoc/compat_stringlist.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -Lcompat_stringlist.c -Lcompat_stringlist.c -u -p -r1.6 -r1.7
--- compat_stringlist.c
+++ compat_stringlist.c
@@ -1,12 +1,4 @@
-#include "config.h"
-
-#if HAVE_STRINGLIST
-
-int dummy;
-
-#else
-
-/*	$Id$	*/
+/* $Id$ */
 /*
  * Copyright (c) 1994 Christos Zoulas <christos@netbsd.org>
  * All rights reserved.
@@ -32,6 +24,7 @@ int dummy;
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  */
+#include "config.h"
 
 #if HAVE_ERR
 #include <err.h>
@@ -115,5 +108,3 @@ sl_find(StringList *sl, const char *name
 
 	return NULL;
 }
-
-#endif
Index: configure
===================================================================
RCS file: /home/cvs/mandoc/mandoc/configure,v
retrieving revision 1.74
retrieving revision 1.75
diff -Lconfigure -Lconfigure -u -p -r1.74 -r1.75
--- configure
+++ configure
@@ -96,6 +96,9 @@ NEED_GNU_SOURCE=0
 NEED_OPENBSD_SOURCE=0
 NEED_XPG4_2=0
 
+MANDOC_COBJS=
+SOELIM_COBJS=
+
 PREFIX="/usr/local"
 BINDIR=
 SBINDIR=
@@ -499,52 +502,78 @@ if [ ${HAVE_ERR} -eq 0 ]; then
 	echo "extern	void	  errx(int, const char *, ...);"
 	echo "extern	void	  warn(const char *, ...);"
 	echo "extern	void	  warnx(const char *, ...);"
+	MANDOC_COBJS="${MANDOC_COBJS} compat_err.o"
+	SOELIM_COBJS="${SOELIM_COBJS} compat_err.o"
 fi
-
-[ ${HAVE_GETLINE} -eq 0 ] && \
+if [ ${HAVE_FTS} -eq 0 ]; then
+	MANDOC_COBJS="${MANDOC_COBJS} compat_fts.o"
+fi
+if [ ${HAVE_GETLINE} -eq 0 ]; then
 	echo "extern	ssize_t	  getline(char **, size_t *, FILE *);"
-
-[ ${HAVE_GETSUBOPT} -eq 0 ] && \
+	MANDOC_COBJS="${MANDOC_COBJS} compat_getline.o"
+	SOELIM_COBJS="${SOELIM_COBJS} compat_getline.o"
+fi
+if [ ${HAVE_GETSUBOPT} -eq 0 ]; then
 	echo "extern	int	  getsubopt(char **, char * const *, char **);"
-
-[ ${HAVE_ISBLANK} -eq 0 ] && \
+	MANDOC_COBJS="${MANDOC_COBJS} compat_getsubopt.o"
+fi
+if [ ${HAVE_ISBLANK} -eq 0 ]; then
 	echo "extern	int	  isblank(int);"
-
-[ ${HAVE_MKDTEMP} -eq 0 ] && \
+	MANDOC_COBJS="${MANDOC_COBJS} compat_isblank.o"
+fi
+if [ ${HAVE_MKDTEMP} -eq 0 ]; then
 	echo "extern	char	 *mkdtemp(char *);"
-
+	MANDOC_COBJS="${MANDOC_COBJS} compat_mkdtemp.o"
+fi
+if [ ${HAVE_OHASH} -eq 0 ]; then
+	MANDOC_COBJS="${MANDOC_COBJS} compat_ohash.o"
+fi
 if [ ${HAVE_PROGNAME} -eq 0 ]; then
 	echo "extern	const char *getprogname(void);"
 	echo "extern	void	  setprogname(const char *);"
+	MANDOC_COBJS="${MANDOC_COBJS} compat_progname.o"
+	SOELIM_COBJS="${SOELIM_COBJS} compat_progname.o"
 fi
-
-[ ${HAVE_REALLOCARRAY} -eq 0 ] && \
+if [ ${HAVE_REALLOCARRAY} -eq 0 ]; then
 	echo "extern	void	 *reallocarray(void *, size_t, size_t);"
-
-[ ${HAVE_RECALLOCARRAY} -eq 0 ] && \
+	MANDOC_COBJS="${MANDOC_COBJS} compat_reallocarray.o"
+	SOELIM_COBJS="${SOELIM_COBJS} compat_reallocarray.o"
+fi
+if [ ${HAVE_RECALLOCARRAY} -eq 0 ]; then
 	echo "extern	void	 *recallocarray(void *, size_t, size_t, size_t);"
-
-[ ${HAVE_STRCASESTR} -eq 0 ] && \
+	MANDOC_COBJS="${MANDOC_COBJS} compat_recallocarray.o"
+fi
+if [ ${HAVE_STRCASESTR} -eq 0 ]; then
 	echo "extern	char	 *strcasestr(const char *, const char *);"
-
-[ ${HAVE_STRLCAT} -eq 0 ] && \
+	MANDOC_COBJS="${MANDOC_COBJS} compat_strcasestr.o"
+fi
+if [ ${HAVE_STRINGLIST} -eq 0 ]; then
+	SOELIM_COBJS="${SOELIM_COBJS} compat_stringlist.o"
+fi
+if [ ${HAVE_STRLCAT} -eq 0 ]; then
 	echo "extern	size_t	  strlcat(char *, const char *, size_t);"
-
-[ ${HAVE_STRLCPY} -eq 0 ] && \
+	MANDOC_COBJS="${MANDOC_COBJS} compat_strlcat.o"
+fi
+if [ ${HAVE_STRLCPY} -eq 0 ]; then
 	echo "extern	size_t	  strlcpy(char *, const char *, size_t);"
-
-[ ${HAVE_STRNDUP} -eq 0 ] && \
+	MANDOC_COBJS="${MANDOC_COBJS} compat_strlcpy.o"
+fi
+if [ ${HAVE_STRNDUP} -eq 0 ]; then
 	echo "extern	char	 *strndup(const char *, size_t);"
-
-[ ${HAVE_STRSEP} -eq 0 ] && \
+	MANDOC_COBJS="${MANDOC_COBJS} compat_strndup.o"
+fi
+if [ ${HAVE_STRSEP} -eq 0 ]; then
 	echo "extern	char	 *strsep(char **, const char *);"
-
-[ ${HAVE_STRTONUM} -eq 0 ] && \
+	MANDOC_COBJS="${MANDOC_COBJS} compat_strsep.o"
+fi
+if [ ${HAVE_STRTONUM} -eq 0 ]; then
 	echo "extern	long long strtonum(const char *, long long, long long, const char **);"
-
-[ ${HAVE_VASPRINTF} -eq 0 ] && \
+	MANDOC_COBJS="${MANDOC_COBJS} compat_strtonum.o"
+fi
+if [ ${HAVE_VASPRINTF} -eq 0 ]; then
 	echo "extern	int	  vasprintf(char **, const char *, va_list);"
-
+	MANDOC_COBJS="${MANDOC_COBJS} compat_vasprintf.o"
+fi
 echo "file config.h: written" 1>&2
 echo "file config.h: written" 1>&3
 
@@ -584,6 +613,8 @@ CC		= ${CC}
 CFLAGS		= ${CFLAGS}
 LDADD		= ${LDADD}
 LDFLAGS		= ${LDFLAGS}
+MANDOC_COBJS	= ${MANDOC_COBJS}
+SOELIM_COBJS	= ${SOELIM_COBJS}
 STATIC		= ${STATIC}
 PREFIX		= ${PREFIX}
 BINDIR		= ${BINDIR}
Index: compat_strndup.c
===================================================================
RCS file: /home/cvs/mandoc/mandoc/compat_strndup.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -Lcompat_strndup.c -Lcompat_strndup.c -u -p -r1.1 -r1.2
--- compat_strndup.c
+++ compat_strndup.c
@@ -1,11 +1,3 @@
-#include "config.h"
-
-#if HAVE_STRNDUP
-
-int dummy;
-
-#else
-
 /* $Id$ */
 /* OpenBSD: strndup.c,v 1.2 2015/08/31 02:53:57 guenther Exp */
 /*
@@ -23,6 +15,7 @@ int dummy;
  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
+#include "config.h"
 
 #include <sys/types.h>
 
@@ -46,5 +39,3 @@ strndup(const char *str, size_t maxlen)
 
 	return copy;
 }
-
-#endif
Index: compat_strsep.c
===================================================================
RCS file: /home/cvs/mandoc/mandoc/compat_strsep.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -Lcompat_strsep.c -Lcompat_strsep.c -u -p -r1.4 -r1.5
--- compat_strsep.c
+++ compat_strsep.c
@@ -1,13 +1,5 @@
-#include "config.h"
-
-#if HAVE_STRSEP
-
-int dummy;
-
-#else
-
 /*	$Id$	*/
-/*	$OpenBSD: strsep.c,v 1.7 2014/02/05 20:42:32 stsp Exp $	*/
+/*	$OpenBSD: strsep.c,v 1.8 2015/08/31 02:53:57 guenther Exp $	*/
 
 /*-
  * Copyright (c) 1990, 1993
@@ -37,6 +29,7 @@ int dummy;
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  */
+#include "config.h"
 
 /*
  * Get next token from string *stringp, where tokens are possibly-empty
@@ -75,5 +68,3 @@ strsep(char **stringp, const char *delim
 	}
 	/* NOTREACHED */
 }
-
-#endif
Index: compat_strlcpy.c
===================================================================
RCS file: /home/cvs/mandoc/mandoc/compat_strlcpy.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -Lcompat_strlcpy.c -Lcompat_strlcpy.c -u -p -r1.4 -r1.5
--- compat_strlcpy.c
+++ compat_strlcpy.c
@@ -1,11 +1,4 @@
-#include "config.h"
-
-#if HAVE_STRLCPY
-
-int dummy;
-
-#else
-
+/*	$Id$	*/
 /*	$OpenBSD: strlcpy.c,v 1.11 2006/05/05 15:27:38 millert Exp $	*/
 
 /*
@@ -23,6 +16,7 @@ int dummy;
  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
+#include "config.h"
 
 #include <sys/types.h>
 #include <string.h>
@@ -57,5 +51,3 @@ strlcpy(char *dst, const char *src, size
 
 	return(s - src - 1);	/* count does not include NUL */
 }
-
-#endif
Index: compat_vasprintf.c
===================================================================
RCS file: /home/cvs/mandoc/mandoc/compat_vasprintf.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -Lcompat_vasprintf.c -Lcompat_vasprintf.c -u -p -r1.3 -r1.4
--- compat_vasprintf.c
+++ compat_vasprintf.c
@@ -1,12 +1,4 @@
-#include "config.h"
-
-#if HAVE_VASPRINTF
-
-int dummy;
-
-#else
-
-/*	$Id$	*/
+/* $Id$ */
 /*
  * Copyright (c) 2015 Ingo Schwarze <schwarze@openbsd.org>
  *
@@ -28,6 +20,7 @@ int dummy;
  * printf(3) or completely reimplementing printf(3), i can't think
  * of another portable solution.
  */
+#include "config.h"
 
 #include <stdarg.h>
 #include <stdio.h>
@@ -52,5 +45,3 @@ vasprintf(char **ret, const char *format
 	*ret = NULL;
 	return -1;
 }
-
-#endif
Index: compat_strcasestr.c
===================================================================
RCS file: /home/cvs/mandoc/mandoc/compat_strcasestr.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -Lcompat_strcasestr.c -Lcompat_strcasestr.c -u -p -r1.4 -r1.5
--- compat_strcasestr.c
+++ compat_strcasestr.c
@@ -1,12 +1,4 @@
-#include "config.h"
-
-#if HAVE_STRCASESTR
-
-int dummy;
-
-#else
-
-/*	$Id$	*/
+/*	$Id$ */
 /*	$NetBSD: strcasestr.c,v 1.3 2005/11/29 03:12:00 christos Exp $	*/
 
 /*-
@@ -40,6 +32,7 @@ int dummy;
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  */
+#include "config.h"
 
 #include <sys/types.h>
 #include <ctype.h>
@@ -69,5 +62,3 @@ strcasestr(const char *s, const char *fi
 	}
 	return __UNCONST(s);
 }
-
-#endif
Index: compat_mkdtemp.c
===================================================================
RCS file: /home/cvs/mandoc/mandoc/compat_mkdtemp.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -Lcompat_mkdtemp.c -Lcompat_mkdtemp.c -u -p -r1.2 -r1.3
--- compat_mkdtemp.c
+++ compat_mkdtemp.c
@@ -1,12 +1,4 @@
-#include "config.h"
-
-#if HAVE_MKDTEMP
-
-int dummy;
-
-#else
-
-/*	$Id$	*/
+/* $Id$ */
 /*
  * Copyright (c) 2015 Ingo Schwarze <schwarze@openbsd.org>
  *
@@ -25,6 +17,7 @@ int dummy;
  * The algorithm of this function is inspired by OpenBSD mkdtemp(3)
  * by Theo de Raadt and Todd Miller, but the code differs.
  */
+#include "config.h"
 
 #include <sys/stat.h>
 #include <errno.h>
@@ -57,5 +50,3 @@ mkdtemp(char *path)
 	errno = EEXIST;
 	return NULL;
 }
-
-#endif
Index: Makefile
===================================================================
RCS file: /home/cvs/mandoc/mandoc/Makefile,v
retrieving revision 1.532
retrieving revision 1.533
diff -LMakefile -LMakefile -u -p -r1.532 -r1.533
--- Makefile
+++ Makefile
@@ -250,7 +250,7 @@ LIBMANDOC_OBJS	 = $(LIBMAN_OBJS) \
 		   read.o \
 		   tag.o
 
-COMPAT_OBJS	 = compat_err.o \
+ALL_COBJS	 = compat_err.o \
 		   compat_fts.o \
 		   compat_getline.o \
 		   compat_getsubopt.o \
@@ -320,13 +320,6 @@ MANDOCD_OBJS	 = $(MANDOC_HTML_OBJS) \
 
 DEMANDOC_OBJS	 = demandoc.o
 
-SOELIM_OBJS	 = soelim.o \
-		   compat_err.o \
-		   compat_getline.o \
-		   compat_progname.o \
-		   compat_reallocarray.o \
-		   compat_stringlist.o
-
 WWW_MANS	 = apropos.1.html \
 		   demandoc.1.html \
 		   man.1.html \
@@ -394,12 +387,12 @@ distclean: clean
 	rm -f Makefile.local config.h config.h.old config.log config.log.old
 
 clean:
-	rm -f libmandoc.a $(LIBMANDOC_OBJS) $(COMPAT_OBJS)
+	rm -f libmandoc.a $(LIBMANDOC_OBJS) $(ALL_COBJS)
 	rm -f mandoc man $(MAIN_OBJS)
 	rm -f man.cgi $(CGI_OBJS)
 	rm -f mandocd catman catman.o $(MANDOCD_OBJS)
 	rm -f demandoc $(DEMANDOC_OBJS)
-	rm -f soelim $(SOELIM_OBJS)
+	rm -f soelim soelim.o
 	rm -f $(WWW_MANS) $(WWW_INCS) mandoc*.tar.gz mandoc*.sha256
 	rm -f Makefile.tmp1 Makefile.tmp2
 	rm -rf *.dSYM
@@ -514,8 +507,8 @@ Makefile.local config.h: configure $(TES
 	@echo "$@ is out of date; please run ./configure"
 	@exit 1
 
-libmandoc.a: $(COMPAT_OBJS) $(LIBMANDOC_OBJS)
-	ar rs $@ $(COMPAT_OBJS) $(LIBMANDOC_OBJS)
+libmandoc.a: $(MANDOC_COBJS) $(LIBMANDOC_OBJS)
+	ar rs $@ $(MANDOC_COBJS) $(LIBMANDOC_OBJS)
 
 mandoc: $(MAIN_OBJS) libmandoc.a
 	$(CC) -o $@ $(LDFLAGS) $(MAIN_OBJS) libmandoc.a $(LDADD)
@@ -535,8 +528,8 @@ catman: catman.o libmandoc.a
 demandoc: $(DEMANDOC_OBJS) libmandoc.a
 	$(CC) -o $@ $(LDFLAGS) $(DEMANDOC_OBJS) libmandoc.a $(LDADD)
 
-soelim: $(SOELIM_OBJS)
-	$(CC) -o $@ $(LDFLAGS) $(SOELIM_OBJS)
+soelim: $(SOELIM_COBJS) soelim.o
+	$(CC) -o $@ $(LDFLAGS) $(SOELIM_COBJS) soelim.o
 
 # --- maintainer targets ---
 
Index: compat_reallocarray.c
===================================================================
RCS file: /home/cvs/mandoc/mandoc/compat_reallocarray.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -Lcompat_reallocarray.c -Lcompat_reallocarray.c -u -p -r1.4 -r1.5
--- compat_reallocarray.c
+++ compat_reallocarray.c
@@ -1,13 +1,5 @@
-#include "config.h"
-
-#if HAVE_REALLOCARRAY
-
-int dummy;
-
-#else
-
-/*	$Id$	*/
-/*	$OpenBSD: reallocarray.c,v 1.2 2014/12/08 03:45:00 bcook Exp $	*/
+/*	$Id$ */
+/*	$OpenBSD: reallocarray.c,v 1.3 2015/09/13 08:31:47 guenther Exp $	*/
 /*
  * Copyright (c) 2008 Otto Moerbeek <otto@drijf.net>
  *
@@ -23,6 +15,7 @@ int dummy;
  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
+#include "config.h"
 
 #include <sys/types.h>
 #include <errno.h>
@@ -45,5 +38,3 @@ reallocarray(void *optr, size_t nmemb, s
 	}
 	return realloc(optr, size * nmemb);
 }
-
-#endif /*!HAVE_REALLOCARRAY*/
Index: compat_getsubopt.c
===================================================================
RCS file: /home/cvs/mandoc/mandoc/compat_getsubopt.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -Lcompat_getsubopt.c -Lcompat_getsubopt.c -u -p -r1.5 -r1.6
--- compat_getsubopt.c
+++ compat_getsubopt.c
@@ -1,12 +1,4 @@
-#include "config.h"
-
-#if HAVE_GETSUBOPT
-
-int dummy;
-
-#else
-
-/*	$Id$	*/
+/*	$Id$ */
 /*	$OpenBSD: getsubopt.c,v 1.4 2005/08/08 08:05:36 espie Exp $	*/
 
 /*-
@@ -37,6 +29,7 @@ int dummy;
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  */
+#include "config.h"
 
 #include <unistd.h>
 #include <stdlib.h>
@@ -92,5 +85,3 @@ getsubopt(char **optionp, char * const *
 			return(cnt);
 	return(-1);
 }
-
-#endif
Index: compat_err.c
===================================================================
RCS file: /home/cvs/mandoc/mandoc/compat_err.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -Lcompat_err.c -Lcompat_err.c -u -p -r1.4 -r1.5
--- compat_err.c
+++ compat_err.c
@@ -1,11 +1,3 @@
-#include "config.h"
-
-#if HAVE_ERR
-
-int dummy;
-
-#else
-
 /* $Id$ */
 /*
  * Copyright (c) 1993
@@ -35,6 +27,7 @@ int dummy;
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  */
+#include "config.h"
 
 #include <errno.h>
 #include <stdarg.h>
@@ -108,5 +101,3 @@ warnx(const char *fmt, ...)
 	va_end(ap);
 	fputc('\n', stderr);
 }
-
-#endif
Index: compat_fts.c
===================================================================
RCS file: /home/cvs/mandoc/mandoc/compat_fts.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -Lcompat_fts.c -Lcompat_fts.c -u -p -r1.16 -r1.17
--- compat_fts.c
+++ compat_fts.c
@@ -1,11 +1,3 @@
-#include "config.h"
-
-#if HAVE_FTS
-
-int dummy;
-
-#else
-
 /*	$Id$	*/
 /*	$OpenBSD: fts.c,v 1.59 2019/06/28 13:32:41 deraadt Exp $	*/
 
@@ -37,6 +29,7 @@ int dummy;
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  */
+#include "config.h"
 
 #include <sys/stat.h>
 #include <sys/types.h>
@@ -701,5 +694,3 @@ fts_maxarglen(char * const *argv)
 			max = len;
 	return (max + 1);
 }
-
-#endif
--
 To unsubscribe send an email to source+unsubscribe@mandoc.bsd.lv


                 reply index

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=490dd254e5b643b9@mandoc.bsd.lv \
    --to=schwarze@mandoc.bsd.lv \
    --cc=source@mandoc.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

source@mandoc.bsd.lv

Archives are clonable: git clone --mirror http://inbox.vuxu.org/mandoc-source

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://inbox.vuxu.org/vuxu.archive.mandoc.source


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git