From: Ingo Schwarze Date: Sat, 7 Nov 2015 14:01:16 +0000 (+0000) Subject: In private header files, __BEGIN_DECLS and __END_DECLS are pointless. X-Git-Tag: VERSION_1_13_4~74 X-Git-Url: https://git.cameronkatri.com/mandoc.git/commitdiff_plain/e7e94cd5a1663f3e3046a449030b33f9bd0dba7b In private header files, __BEGIN_DECLS and __END_DECLS are pointless. Because these work slightly differently on different systems, they are becoming a maintenance burden in the portable version, so delete them. Besides, one of the chief design goals of the mandoc toolbox is to make sure that nothing related to documentation requires C++. Consequently, linking mandoc against any kind of C++ program would defeat the purpose and is not supported. I don't understand why kristaps@ added them in the first place. --- diff --git a/INSTALL b/INSTALL index fffff39f..085fb3e1 100644 --- a/INSTALL +++ b/INSTALL @@ -1,4 +1,4 @@ -$Id: INSTALL,v 1.12 2015/07/19 06:05:16 schwarze Exp $ +$Id: INSTALL,v 1.13 2015/11/07 14:01:16 schwarze Exp $ About mdocml, the portable mandoc distribution ---------------------------------------------- @@ -110,6 +110,11 @@ If you run into that problem, set "HAVE_FTS=0" in configure.local. If your system does not have it, the bundled compatibility version will be used, so you probably need not worry about it. +One of the chief design goals of the mandoc toolbox is to make +sure that nothing related to documentation requires C++. +Consequently, linking mandoc against any kind of C++ program +would defeat the purpose and is not supported. + Checking autoconfiguration quality ---------------------------------- diff --git a/compat_fts.h b/compat_fts.h index 426eaac3..1eed2ae3 100644 --- a/compat_fts.h +++ b/compat_fts.h @@ -92,11 +92,10 @@ typedef struct _ftsent { char fts_name[1]; /* file name */ } FTSENT; -__BEGIN_DECLS + int fts_close(FTS *); FTS *fts_open(char * const *, int, void *); FTSENT *fts_read(FTS *); int fts_set(FTS *, FTSENT *, int); -__END_DECLS #endif /* !_FTS_H_ */ diff --git a/compat_ohash.h b/compat_ohash.h index e3124c96..58fb220c 100644 --- a/compat_ohash.h +++ b/compat_ohash.h @@ -49,7 +49,6 @@ struct ohash { * a hashing table index (opaque) to be used in find/insert/remove. * The keys are stored at a known position in the client data. */ -__BEGIN_DECLS void ohash_init(struct ohash *, unsigned, struct ohash_info *); void ohash_delete(struct ohash *); @@ -69,5 +68,5 @@ uint32_t ohash_interval(const char *, const char **); unsigned int ohash_qlookupi(struct ohash *, const char *, const char **); unsigned int ohash_qlookup(struct ohash *, const char *); -__END_DECLS + #endif diff --git a/compat_stringlist.h b/compat_stringlist.h index 424f1a23..f04e8435 100644 --- a/compat_stringlist.h +++ b/compat_stringlist.h @@ -1,4 +1,4 @@ -/* $Id: compat_stringlist.h,v 1.3 2015/05/20 23:43:03 schwarze Exp $ */ +/* $Id: compat_stringlist.h,v 1.4 2015/11/07 14:01:16 schwarze Exp $ */ /* $NetBSD: stringlist.h,v 1.2 1997/01/17 06:11:36 lukem Exp $ */ /* @@ -38,9 +38,8 @@ typedef struct _stringlist { size_t sl_cur; } StringList; -__BEGIN_DECLS + StringList *sl_init(void); int sl_add(StringList *, char *); void sl_free(StringList *, int); char *sl_find(StringList *, const char *); -__END_DECLS diff --git a/configure b/configure index 54ebfca1..cae2f5c9 100755 --- a/configure +++ b/configure @@ -276,6 +276,10 @@ fi exec > config.h cat << __HEREDOC__ +#ifdef __cplusplus +#error "Do not use C++. See the INSTALL file." +#endif + #ifndef MANDOC_CONFIG_H #define MANDOC_CONFIG_H @@ -331,21 +335,6 @@ cat << __HEREDOC__ #define BINM_SOELIM "${BINM_SOELIM}" #define BINM_WHATIS "${BINM_WHATIS}" -#if !defined(__BEGIN_DECLS) -# ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# else -# define __BEGIN_DECLS -# endif -#endif -#if !defined(__END_DECLS) -# ifdef __cplusplus -# define __END_DECLS } -# else -# define __END_DECLS -# endif -#endif - __HEREDOC__ if [ ${HAVE_ERR} -eq 0 ]; then diff --git a/html.h b/html.h index e6644dc8..27dc1401 100644 --- a/html.h +++ b/html.h @@ -1,4 +1,4 @@ -/* $Id: html.h,v 1.71 2015/10/13 22:59:54 schwarze Exp $ */ +/* $Id: html.h,v 1.72 2015/11/07 14:01:16 schwarze Exp $ */ /* * Copyright (c) 2008-2011, 2014 Kristaps Dzonsons * @@ -142,7 +142,6 @@ struct html { #define HTML_FRAGMENT (1 << 0) /* don't emit HTML/HEAD/BODY */ }; -__BEGIN_DECLS struct tbl_span; struct eqn; @@ -175,5 +174,3 @@ void buffmt_man(struct html *, void buffmt_includes(struct html *, const char *); int html_strlen(const char *); - -__END_DECLS diff --git a/libman.h b/libman.h index 90c9803a..65849602 100644 --- a/libman.h +++ b/libman.h @@ -1,4 +1,4 @@ -/* $Id: libman.h,v 1.78 2015/10/22 21:54:23 schwarze Exp $ */ +/* $Id: libman.h,v 1.79 2015/11/07 14:01:16 schwarze Exp $ */ /* * Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons * Copyright (c) 2014, 2015 Ingo Schwarze @@ -34,11 +34,8 @@ struct man_macro { extern const struct man_macro *const man_macros; -__BEGIN_DECLS int man_hash_find(const char *); void man_node_validate(struct roff_man *); void man_state(struct roff_man *, struct roff_node *); void man_unscope(struct roff_man *, const struct roff_node *); - -__END_DECLS diff --git a/libmandoc.h b/libmandoc.h index 38d397e2..939ec83c 100644 --- a/libmandoc.h +++ b/libmandoc.h @@ -1,4 +1,4 @@ -/* $Id: libmandoc.h,v 1.61 2015/10/13 22:59:54 schwarze Exp $ */ +/* $Id: libmandoc.h,v 1.62 2015/11/07 14:01:16 schwarze Exp $ */ /* * Copyright (c) 2009, 2010, 2011, 2012 Kristaps Dzonsons * Copyright (c) 2013, 2014, 2015 Ingo Schwarze @@ -32,7 +32,6 @@ struct buf { size_t sz; }; -__BEGIN_DECLS struct mparse; struct tbl_span; @@ -84,5 +83,3 @@ int roff_getformat(const struct roff *); const struct tbl_span *roff_span(const struct roff *); const struct eqn *roff_eqn(const struct roff *); - -__END_DECLS diff --git a/libmdoc.h b/libmdoc.h index 5240fd0c..5a6cc3ed 100644 --- a/libmdoc.h +++ b/libmdoc.h @@ -1,4 +1,4 @@ -/* $Id: libmdoc.h,v 1.107 2015/10/20 02:01:31 schwarze Exp $ */ +/* $Id: libmdoc.h,v 1.108 2015/11/07 14:01:16 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons * Copyright (c) 2013, 2014, 2015 Ingo Schwarze @@ -62,7 +62,6 @@ enum mdelim { extern const struct mdoc_macro *const mdoc_macros; -__BEGIN_DECLS void mdoc_macro(MACRO_PROT_ARGS); void mdoc_elem_alloc(struct roff_man *, int, int, @@ -87,5 +86,3 @@ void mdoc_argv(struct roff_man *, int, int, enum margserr mdoc_args(struct roff_man *, int, int *, char *, int, char **); enum mdelim mdoc_isdelim(const char *); - -__END_DECLS diff --git a/libroff.h b/libroff.h index 08ed1f79..897a55ae 100644 --- a/libroff.h +++ b/libroff.h @@ -1,4 +1,4 @@ -/* $Id: libroff.h,v 1.38 2015/01/30 04:11:50 schwarze Exp $ */ +/* $Id: libroff.h,v 1.39 2015/11/07 14:01:16 schwarze Exp $ */ /* * Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons * Copyright (c) 2014, 2015 Ingo Schwarze @@ -60,7 +60,6 @@ struct eqn_def { size_t valsz; }; -__BEGIN_DECLS struct tbl_node *tbl_alloc(int, int, struct mparse *); void tbl_restart(int, int, struct tbl_node *); @@ -78,5 +77,3 @@ enum rofferr eqn_end(struct eqn_node **); void eqn_free(struct eqn_node *); enum rofferr eqn_read(struct eqn_node **, int, const char *, int, int *); - -__END_DECLS diff --git a/main.h b/main.h index bf2a0646..e9e7e866 100644 --- a/main.h +++ b/main.h @@ -1,4 +1,4 @@ -/* $Id: main.h,v 1.23 2015/10/13 22:59:54 schwarze Exp $ */ +/* $Id: main.h,v 1.24 2015/11/07 14:01:16 schwarze Exp $ */ /* * Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons * Copyright (c) 2014, 2015 Ingo Schwarze @@ -18,8 +18,6 @@ #define UNCONST(a) ((void *)(uintptr_t)(const void *)(a)) -__BEGIN_DECLS - struct roff_man; struct manoutput; @@ -53,5 +51,3 @@ void pspdf_free(void *); void terminal_mdoc(void *, const struct roff_man *); void terminal_man(void *, const struct roff_man *); - -__END_DECLS diff --git a/man.h b/man.h index 5a8d2593..8f63f3b9 100644 --- a/man.h +++ b/man.h @@ -1,4 +1,4 @@ -/* $Id: man.h,v 1.76 2015/10/22 21:54:23 schwarze Exp $ */ +/* $Id: man.h,v 1.77 2015/11/07 14:01:16 schwarze Exp $ */ /* * Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons * Copyright (c) 2014, 2015 Ingo Schwarze @@ -59,11 +59,8 @@ /* Names of macros. */ extern const char *const *man_macronames; -__BEGIN_DECLS struct roff_man; const struct mparse *man_mparse(const struct roff_man *); void man_validate(struct roff_man *); - -__END_DECLS diff --git a/manconf.h b/manconf.h index 0784b8d6..782269e7 100644 --- a/manconf.h +++ b/manconf.h @@ -42,10 +42,7 @@ struct manconf { struct manpaths manpath; }; -__BEGIN_DECLS void manconf_parse(struct manconf *, const char *, char *, char *); void manconf_output(struct manoutput *, const char *); void manconf_free(struct manconf *); - -__END_DECLS diff --git a/mandoc.h b/mandoc.h index d37187f3..f7f72785 100644 --- a/mandoc.h +++ b/mandoc.h @@ -1,4 +1,4 @@ -/* $Id: mandoc.h,v 1.207 2015/10/30 19:04:16 schwarze Exp $ */ +/* $Id: mandoc.h,v 1.208 2015/11/07 14:01:16 schwarze Exp $ */ /* * Copyright (c) 2010, 2011, 2014 Kristaps Dzonsons * Copyright (c) 2010-2015 Ingo Schwarze @@ -408,7 +408,6 @@ enum mandoc_esc { typedef void (*mandocmsg)(enum mandocerr, enum mandoclevel, const char *, int, int, const char *); -__BEGIN_DECLS struct mparse; struct roff_man; @@ -434,5 +433,3 @@ void mparse_result(struct mparse *, const char *mparse_getkeep(const struct mparse *); const char *mparse_strerror(enum mandocerr); const char *mparse_strlevel(enum mandoclevel); - -__END_DECLS diff --git a/mandoc_aux.h b/mandoc_aux.h index e72fe4e4..2ae3a0cd 100644 --- a/mandoc_aux.h +++ b/mandoc_aux.h @@ -1,4 +1,4 @@ -/* $Id: mandoc_aux.h,v 1.3 2014/12/01 04:05:32 schwarze Exp $ */ +/* $Id: mandoc_aux.h,v 1.4 2015/11/07 14:01:16 schwarze Exp $ */ /* * Copyright (c) 2009, 2011 Kristaps Dzonsons * Copyright (c) 2014 Ingo Schwarze @@ -16,8 +16,6 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -__BEGIN_DECLS - int mandoc_asprintf(char **, const char *, ...); void *mandoc_calloc(size_t, size_t); void *mandoc_malloc(size_t); @@ -25,5 +23,3 @@ void *mandoc_realloc(void *, size_t); void *mandoc_reallocarray(void *, size_t, size_t); char *mandoc_strdup(const char *); char *mandoc_strndup(const char *, size_t); - -__END_DECLS diff --git a/mandoc_ohash.h b/mandoc_ohash.h index 7e24517c..571c4cda 100644 --- a/mandoc_ohash.h +++ b/mandoc_ohash.h @@ -1,4 +1,4 @@ -/* $Id: mandoc_ohash.h,v 1.1 2015/10/13 15:53:05 schwarze Exp $ */ +/* $Id: mandoc_ohash.h,v 1.2 2015/11/07 14:01:16 schwarze Exp $ */ /* * Copyright (c) 2015 Ingo Schwarze * @@ -20,8 +20,4 @@ #include "compat_ohash.h" #endif -__BEGIN_DECLS - void mandoc_ohash_init(struct ohash *, unsigned int, ptrdiff_t); - -__END_DECLS diff --git a/mansearch.h b/mansearch.h index 14ec8cea..7f68ff67 100644 --- a/mansearch.h +++ b/mansearch.h @@ -1,4 +1,4 @@ -/* $Id: mansearch.h,v 1.23 2014/12/01 08:05:52 schwarze Exp $ */ +/* $Id: mansearch.h,v 1.24 2015/11/07 14:01:16 schwarze Exp $ */ /* * Copyright (c) 2012 Kristaps Dzonsons * Copyright (c) 2013, 2014 Ingo Schwarze @@ -95,7 +95,6 @@ struct mansearch { int firstmatch; /* first matching database only */ }; -__BEGIN_DECLS struct manpaths; @@ -107,5 +106,3 @@ int mansearch(const struct mansearch *cfg, /* options */ struct manpage **res, /* results */ size_t *ressz); /* results returned */ void mansearch_free(struct manpage *, size_t); - -__END_DECLS diff --git a/mdoc.h b/mdoc.h index f793cc23..ebe4391e 100644 --- a/mdoc.h +++ b/mdoc.h @@ -1,4 +1,4 @@ -/* $Id: mdoc.h,v 1.143 2015/10/20 02:01:31 schwarze Exp $ */ +/* $Id: mdoc.h,v 1.144 2015/11/07 14:01:16 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons * Copyright (c) 2014, 2015 Ingo Schwarze @@ -280,8 +280,5 @@ extern const char *const *mdoc_macronames; /* Names of macro args. Index is enum mdocargt. */ extern const char *const *mdoc_argnames; -__BEGIN_DECLS void mdoc_validate(struct roff_man *); - -__END_DECLS diff --git a/out.h b/out.h index cc218f4f..2c1cf3fe 100644 --- a/out.h +++ b/out.h @@ -1,4 +1,4 @@ -/* $Id: out.h,v 1.26 2014/12/01 08:05:52 schwarze Exp $ */ +/* $Id: out.h,v 1.27 2015/11/07 14:01:16 schwarze Exp $ */ /* * Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons * @@ -60,12 +60,9 @@ struct rofftbl { (p)->scale = (v); } \ while (/* CONSTCOND */ 0) -__BEGIN_DECLS struct tbl_span; int a2roffsu(const char *, struct roffsu *, enum roffscale); void tblcalc(struct rofftbl *tbl, const struct tbl_span *, size_t); - -__END_DECLS diff --git a/roff.h b/roff.h index f32ffd25..cbee3822 100644 --- a/roff.h +++ b/roff.h @@ -161,8 +161,5 @@ struct roff_man { enum roff_next next; /* Where to put the next node. */ }; -__BEGIN_DECLS void deroff(char **, const struct roff_node *); - -__END_DECLS diff --git a/roff_int.h b/roff_int.h index 8c9cc097..5567b758 100644 --- a/roff_int.h +++ b/roff_int.h @@ -1,4 +1,4 @@ -/* $Id: roff_int.h,v 1.6 2015/10/22 21:54:23 schwarze Exp $ */ +/* $Id: roff_int.h,v 1.7 2015/11/07 14:01:16 schwarze Exp $ */ /* * Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons * Copyright (c) 2013, 2014, 2015 Ingo Schwarze @@ -16,8 +16,6 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -__BEGIN_DECLS - struct roff_node *roff_node_alloc(struct roff_man *, int, int, enum roff_type, int); void roff_node_append(struct roff_man *, struct roff_node *); @@ -41,5 +39,3 @@ void roff_node_delete(struct roff_man *, struct roff_node *); void man_breakscope(struct roff_man *, int); void mdoc_argv_free(struct mdoc_arg *); - -__END_DECLS diff --git a/tag.h b/tag.h index 0cf5c90b..f00c7f38 100644 --- a/tag.h +++ b/tag.h @@ -1,4 +1,4 @@ -/* $Id: tag.h,v 1.5 2015/07/28 18:38:55 schwarze Exp $ */ +/* $Id: tag.h,v 1.6 2015/11/07 14:01:16 schwarze Exp $ */ /* * Copyright (c) 2015 Ingo Schwarze * @@ -22,11 +22,8 @@ struct tag_files { int tfd; }; -__BEGIN_DECLS struct tag_files *tag_init(void); void tag_put(const char *, int, size_t); void tag_write(void); void tag_unlink(void); - -__END_DECLS diff --git a/term.h b/term.h index 1d0d78d5..fabc117d 100644 --- a/term.h +++ b/term.h @@ -1,4 +1,4 @@ -/* $Id: term.h,v 1.117 2015/10/13 22:59:54 schwarze Exp $ */ +/* $Id: term.h,v 1.118 2015/11/07 14:01:16 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons * Copyright (c) 2011-2015 Ingo Schwarze @@ -105,7 +105,6 @@ struct termp { struct termp_ps *ps; }; -__BEGIN_DECLS struct tbl_span; struct eqn; @@ -134,5 +133,3 @@ void term_fontpop(struct termp *); void term_fontpopq(struct termp *, int); void term_fontrepl(struct termp *, enum termfont); void term_fontlast(struct termp *); - -__END_DECLS