discuss@mandoc.bsd.lv
 help / color / mirror / Atom feed
From: Peter Bray <pdb_ml@yahoo.com.au>
To: discuss@mdocml.bsd.lv
Subject: mdocml [CVS_2015_11_07] Code needs HAVE_ERR guards
Date: Sat, 07 Nov 2015 14:00:56 +1100	[thread overview]
Message-ID: <563D6968.8020401@yahoo.com.au> (raw)

[-- Attachment #1: Type: text/plain, Size: 1012 bytes --]

Greetings,

Ingo has posted a patch to regarding

     mandoc whatis(1): autodetect RE syntax for word boundaries

So I thought I would try compiling mdocml_cvs on Solaris 10 and 11 again.

The "configure" script checks for the presence of "err.h", setting
HAVE_ERR to 0 or 1 based on the check result.

Unlike the HAVE_FTS check the, code that uses '#include <err.h>' does
not wrap this preprocessor directive in a guard.

Two possible simple solutions exist (based on what I have seen so far).

1. Wrap the include directive in a simple '#if HAVE_ERR' and '#endif'.
    Patch included.

2. Take the HAVE_FTS approach and move the declarations from the generated
    config.h to compat_err.h and like fts.h, use a conditional of the form:

#if HAVE_ERR
#  include <err.h>
#else
#  include "compat_err.h"
#fi

I'll leave it to the developers and maintainers to choose the
appropriate solution for their code base.

Regards,

Peter Bray
Sydney, Australia

PS: Discovered on Solaris 10 which does not have <err.h>

[-- Attachment #2: mdocml_cvs_2015_11_07-HAVE_ERR-guards.diff --]
[-- Type: text/plain, Size: 4425 bytes --]

diff -r -U 2 mdocml-cvs_2015_11_07.orig/compat_err.c mdocml-cvs_2015_11_07/compat_err.c
--- mdocml-cvs_2015_11_07.orig/compat_err.c	2015-11-06 16:30:33.000000000 +0000
+++ mdocml-cvs_2015_11_07/compat_err.c	2015-11-07 02:40:13.751774337 +0000
@@ -37,5 +37,7 @@
  */
 
+#if HAVE_ERR
 #include <err.h>
+#endif
 #include <errno.h>
 #include <stdarg.h>
Only in mdocml-cvs_2015_11_07: compat_err.c.orig
diff -r -U 2 mdocml-cvs_2015_11_07.orig/compat_stringlist.c mdocml-cvs_2015_11_07/compat_stringlist.c
--- mdocml-cvs_2015_11_07.orig/compat_stringlist.c	2015-05-21 00:13:43.000000000 +0000
+++ mdocml-cvs_2015_11_07/compat_stringlist.c	2015-11-07 02:40:13.757923786 +0000
@@ -34,5 +34,7 @@
  */
 
+#if HAVE_ERR
 #include <err.h>
+#endif
 #include <stdlib.h>
 #include <string.h>
Only in mdocml-cvs_2015_11_07: compat_stringlist.c.orig
diff -r -U 2 mdocml-cvs_2015_11_07.orig/main.c mdocml-cvs_2015_11_07/main.c
--- mdocml-cvs_2015_11_07.orig/main.c	2015-11-07 00:47:44.000000000 +0000
+++ mdocml-cvs_2015_11_07/main.c	2015-11-07 02:40:13.764627128 +0000
@@ -25,5 +25,7 @@
 #include <assert.h>
 #include <ctype.h>
+#if HAVE_ERR
 #include <err.h>
+#endif
 #include <fcntl.h>
 #include <glob.h>
Only in mdocml-cvs_2015_11_07: main.c.orig
diff -r -U 2 mdocml-cvs_2015_11_07.orig/mandoc_aux.c mdocml-cvs_2015_11_07/mandoc_aux.c
--- mdocml-cvs_2015_11_07.orig/mandoc_aux.c	2015-11-07 00:47:44.000000000 +0000
+++ mdocml-cvs_2015_11_07/mandoc_aux.c	2015-11-07 02:40:13.770768706 +0000
@@ -20,5 +20,7 @@
 #include <sys/types.h>
 
+#if HAVE_ERR
 #include <err.h>
+#endif
 #include <stdarg.h>
 #include <stdlib.h>
Only in mdocml-cvs_2015_11_07: mandoc_aux.c.orig
diff -r -U 2 mdocml-cvs_2015_11_07.orig/mandocdb.c mdocml-cvs_2015_11_07/mandocdb.c
--- mdocml-cvs_2015_11_07.orig/mandocdb.c	2015-11-07 00:47:44.000000000 +0000
+++ mdocml-cvs_2015_11_07/mandocdb.c	2015-11-07 02:40:13.778167590 +0000
@@ -24,5 +24,7 @@
 #include <assert.h>
 #include <ctype.h>
+#if HAVE_ERR
 #include <err.h>
+#endif
 #include <errno.h>
 #include <fcntl.h>
Only in mdocml-cvs_2015_11_07: mandocdb.c.orig
diff -r -U 2 mdocml-cvs_2015_11_07.orig/manpath.c mdocml-cvs_2015_11_07/manpath.c
--- mdocml-cvs_2015_11_07.orig/manpath.c	2015-11-07 00:47:44.000000000 +0000
+++ mdocml-cvs_2015_11_07/manpath.c	2015-11-07 02:40:13.784549032 +0000
@@ -22,5 +22,7 @@
 
 #include <ctype.h>
+#if HAVE_ERR
 #include <err.h>
+#endif
 #include <limits.h>
 #include <stdio.h>
Only in mdocml-cvs_2015_11_07: manpath.c.orig
diff -r -U 2 mdocml-cvs_2015_11_07.orig/mansearch.c mdocml-cvs_2015_11_07/mansearch.c
--- mdocml-cvs_2015_11_07.orig/mansearch.c	2015-11-07 00:47:44.000000000 +0000
+++ mdocml-cvs_2015_11_07/mansearch.c	2015-11-07 02:40:13.791014961 +0000
@@ -22,5 +22,7 @@
 
 #include <assert.h>
+#if HAVE_ERR
 #include <err.h>
+#endif
 #include <errno.h>
 #include <fcntl.h>
Only in mdocml-cvs_2015_11_07: mansearch.c.orig
diff -r -U 2 mdocml-cvs_2015_11_07.orig/read.c mdocml-cvs_2015_11_07/read.c
--- mdocml-cvs_2015_11_07.orig/read.c	2015-11-07 00:47:45.000000000 +0000
+++ mdocml-cvs_2015_11_07/read.c	2015-11-07 02:40:13.797540657 +0000
@@ -27,5 +27,7 @@
 #include <assert.h>
 #include <ctype.h>
+#if HAVE_ERR
 #include <err.h>
+#endif
 #include <errno.h>
 #include <fcntl.h>
Only in mdocml-cvs_2015_11_07: read.c.orig
diff -r -U 2 mdocml-cvs_2015_11_07.orig/soelim.c mdocml-cvs_2015_11_07/soelim.c
--- mdocml-cvs_2015_11_07.orig/soelim.c	2015-05-21 00:18:52.000000000 +0000
+++ mdocml-cvs_2015_11_07/soelim.c	2015-11-07 02:40:13.803657540 +0000
@@ -30,5 +30,7 @@
 
 #include <ctype.h>
+#if HAVE_ERR
 #include <err.h>
+#endif
 #include <limits.h>
 #include <stdio.h>
Only in mdocml-cvs_2015_11_07: soelim.c.orig
diff -r -U 2 mdocml-cvs_2015_11_07.orig/term_ps.c mdocml-cvs_2015_11_07/term_ps.c
--- mdocml-cvs_2015_11_07.orig/term_ps.c	2015-11-07 00:47:45.000000000 +0000
+++ mdocml-cvs_2015_11_07/term_ps.c	2015-11-07 02:40:13.810363973 +0000
@@ -21,5 +21,7 @@
 
 #include <assert.h>
+#if HAVE_ERR
 #include <err.h>
+#endif
 #include <stdarg.h>
 #include <stdint.h>
Only in mdocml-cvs_2015_11_07: term_ps.c.orig
diff -r -U 2 mdocml-cvs_2015_11_07.orig/test-err.c mdocml-cvs_2015_11_07/test-err.c
--- mdocml-cvs_2015_11_07.orig/test-err.c	2015-10-11 21:12:55.000000000 +0000
+++ mdocml-cvs_2015_11_07/test-err.c	2015-11-07 02:40:13.816369014 +0000
@@ -16,5 +16,7 @@
  */
 
+#if HAVE_ERR
 #include <err.h>
+#endif
 
 int
Only in mdocml-cvs_2015_11_07: test-err.c.orig

             reply	other threads:[~2015-11-07  3:01 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-07  3:00 Peter Bray [this message]
2015-11-07  4:14 ` Peter Bray
2015-11-07 14:26   ` Ingo Schwarze

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=563D6968.8020401@yahoo.com.au \
    --to=pdb_ml@yahoo.com.au \
    --cc=discuss@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).