diff options
author | G. Branden Robinson <g.branden.robinson@gmail.com> | 2023-02-09 16:43:09 -0600 |
---|---|---|
committer | G. Branden Robinson <g.branden.robinson@gmail.com> | 2023-02-09 18:29:48 -0600 |
commit | ccc63e65c723e235fafc5099b383959c92664c38 (patch) | |
tree | 0c796683cd3134ecabc5900fef8b1c9371365d20 /src | |
parent | 53b1e75fbfe617b22e363469a36a09b2043143e4 (diff) | |
download | groff-git-ccc63e65c723e235fafc5099b383959c92664c38.tar.gz |
src/include/assert.h: Delete.
Switch to using system's assert.h header file. It is futile to attempt
to preserve compatibility with ISO C90 systems by providing a bespoke
predicate-reporting assert() (a C99 feature) when gnulib, which we
require, itself demands C99. This ensures that `static_assert` remains
defined so that gnulib can use it. Thanks to Bruno Haible for the
consultation.
<https://lists.gnu.org/archive/html/groff/2023-02/msg00034.html>
* src/include/assert.h: Delete.
* src/devices/grodvi/dvi.cpp:
* src/devices/grolbp/lbp.cpp:
* src/devices/grolj4/lj4.cpp:
* src/include/itable.h:
* src/include/stringclass.h:
* src/libs/libbib/linear.cpp:
* src/libs/libbib/search.cpp:
* src/libs/libdriver/printer.cpp:
* src/libs/libgroff/assert.cpp:
* src/libs/libgroff/color.cpp:
* src/libs/libgroff/errarg.cpp:
* src/libs/libgroff/font.cpp:
* src/libs/libgroff/nametoindex.cpp:
* src/libs/libgroff/prime.cpp:
* src/libs/libgroff/relocate.cpp:
* src/libs/libgroff/searchpath.cpp:
* src/preproc/eqn/box.cpp:
* src/preproc/eqn/delim.cpp:
* src/preproc/eqn/pile.cpp:
* src/preproc/eqn/script.cpp:
* src/preproc/html/pre-html.cpp:
* src/preproc/pic/pic.h:
* src/preproc/preconv/preconv.cpp:
* src/preproc/soelim/soelim.cpp:
* src/roff/groff/groff.cpp:
* src/roff/troff/troff.h:
* src/utils/hpftodit/hpftodit.cpp:
* src/utils/indxbib/indxbib.cpp:
* src/utils/lkbib/lkbib.cpp:
* src/utils/lookbib/lookbib.cpp:
* src/utils/tfmtodit/tfmtodit.cpp: Respell "assert.h" inclusion with
angle brackets instead of quotation marks.
Fixes <https://savannah.gnu.org/bugs/?63078>.
* ANNOUNCE: Update bug counts.
Diffstat (limited to 'src')
32 files changed, 31 insertions, 74 deletions
diff --git a/src/devices/grodvi/dvi.cpp b/src/devices/grodvi/dvi.cpp index 1a6729de4..3ac788faf 100644 --- a/src/devices/grodvi/dvi.cpp +++ b/src/devices/grodvi/dvi.cpp @@ -16,7 +16,7 @@ for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include "assert.h" +#include <assert.h> #include "driver.h" #include "nonposix.h" #include "paper.h" diff --git a/src/devices/grolbp/lbp.cpp b/src/devices/grolbp/lbp.cpp index 1c7d0592c..35cd54e0a 100644 --- a/src/devices/grolbp/lbp.cpp +++ b/src/devices/grolbp/lbp.cpp @@ -23,7 +23,7 @@ TODO - Add X command to include bitmaps */ -#include "assert.h" +#include <assert.h> #include "driver.h" #include "lbp.h" diff --git a/src/devices/grolj4/lj4.cpp b/src/devices/grolj4/lj4.cpp index d66794ad4..3c92d1597 100644 --- a/src/devices/grolj4/lj4.cpp +++ b/src/devices/grolj4/lj4.cpp @@ -30,7 +30,7 @@ X command to specify inline escape sequence (how to specify unprintable chars?) X command to include bitmap graphics */ -#include "assert.h" +#include <assert.h> #include "driver.h" #include "nonposix.h" diff --git a/src/include/assert.h b/src/include/assert.h deleted file mode 100644 index 754cbe65d..000000000 --- a/src/include/assert.h +++ /dev/null @@ -1,43 +0,0 @@ -/* Copyright (C) 1989-2020 Free Software Foundation, Inc. - Written by James Clark (jjc@jclark.com) - -This file is part of groff. - -groff is free software; you can redistribute it and/or modify it under -the terms of the GNU General Public License as published by the Free -Software Foundation, either version 3 of the License, or -(at your option) any later version. - -groff is distributed in the hope that it will be useful, but WITHOUT ANY -WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. */ - -#ifndef ASSERT_H -#define ASSERT_H - -// C99 requires that the diagnostic emitted by assert() contain the -// failing expression and name of the function in scope. Define our own -// macro to ensure this even in ISO C90 systems that don't. - -void assertion_failed(int, const char *, const char *, const char *); - -inline void do_assert(int expr, int line, const char *file, - const char *func, const char *msg) -{ - if (!expr) - assertion_failed(line, file, func, msg); -} -#endif /* ASSERT_H */ - -#undef assert - -#ifdef NDEBUG -#define assert(ignore) /* as nothing */ -#else -#define assert(expr) do_assert(expr, __LINE__, __FILE__, __func__, \ - #expr) -#endif diff --git a/src/include/itable.h b/src/include/itable.h index 5808f2301..c97db5597 100644 --- a/src/include/itable.h +++ b/src/include/itable.h @@ -16,7 +16,7 @@ for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include "assert.h" +#include <assert.h> // 'class ITABLE(T)' is the type of a hash table mapping an integer (int >= 0) // to an object of type T. diff --git a/src/include/stringclass.h b/src/include/stringclass.h index aadf07116..2ba106bf6 100644 --- a/src/include/stringclass.h +++ b/src/include/stringclass.h @@ -19,7 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include <string.h> #include <stdio.h> -#include "assert.h" +#include <assert.h> // Ensure that the first declaration of functions that are later // declared as inline declares them as inline. diff --git a/src/libs/libbib/linear.cpp b/src/libs/libbib/linear.cpp index 13f6a06bd..d679b21c9 100644 --- a/src/libs/libbib/linear.cpp +++ b/src/libs/libbib/linear.cpp @@ -21,7 +21,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include <stdlib.h> #include <errno.h> -#include "assert.h" +#include <assert.h> #include "posix.h" #include "errarg.h" diff --git a/src/libs/libbib/search.cpp b/src/libs/libbib/search.cpp index 27c000f68..d345a9f7a 100644 --- a/src/libs/libbib/search.cpp +++ b/src/libs/libbib/search.cpp @@ -21,7 +21,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include <stdlib.h> #include <errno.h> -#include "assert.h" +#include <assert.h> #include "posix.h" #include "errarg.h" diff --git a/src/libs/libdriver/printer.cpp b/src/libs/libdriver/printer.cpp index b7922d740..e8f0cbccc 100644 --- a/src/libs/libdriver/printer.cpp +++ b/src/libs/libdriver/printer.cpp @@ -17,7 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include "assert.h" +#include <assert.h> #include "driver.h" /* If we are sending output to an onscreen pager (as is the normal case diff --git a/src/libs/libgroff/assert.cpp b/src/libs/libgroff/assert.cpp index 4b989e04c..0761235fd 100644 --- a/src/libs/libgroff/assert.cpp +++ b/src/libs/libgroff/assert.cpp @@ -22,7 +22,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include <stdio.h> #include <stdlib.h> -#include "assert.h" +#include <assert.h> extern "C" const char *program_name; diff --git a/src/libs/libgroff/color.cpp b/src/libs/libgroff/color.cpp index b9cd0dda6..b91030a38 100644 --- a/src/libs/libgroff/color.cpp +++ b/src/libs/libgroff/color.cpp @@ -27,7 +27,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include <fcntl.h> #include <stdlib.h> -#include "assert.h" +#include <assert.h> #include "errarg.h" #include "error.h" diff --git a/src/libs/libgroff/errarg.cpp b/src/libs/libgroff/errarg.cpp index b6279dcfb..f4c6dcb1f 100644 --- a/src/libs/libgroff/errarg.cpp +++ b/src/libs/libgroff/errarg.cpp @@ -21,7 +21,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ #endif #include <stdio.h> -#include "assert.h" +#include <assert.h> #include "errarg.h" errarg::errarg(const char *p) : type(STRING) diff --git a/src/libs/libgroff/font.cpp b/src/libs/libgroff/font.cpp index 1bf5c6587..3f0226a4b 100644 --- a/src/libs/libgroff/font.cpp +++ b/src/libs/libgroff/font.cpp @@ -23,7 +23,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include <stdlib.h> #include <wchar.h> -#include "assert.h" +#include <assert.h> #include "errarg.h" #include "error.h" diff --git a/src/libs/libgroff/nametoindex.cpp b/src/libs/libgroff/nametoindex.cpp index 8f1256c86..686a69197 100644 --- a/src/libs/libgroff/nametoindex.cpp +++ b/src/libs/libgroff/nametoindex.cpp @@ -21,7 +21,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include <ctype.h> #include <stdlib.h> -#include "assert.h" +#include <assert.h> #include "errarg.h" #include "error.h" diff --git a/src/libs/libgroff/prime.cpp b/src/libs/libgroff/prime.cpp index 83227b178..54ce5eb7b 100644 --- a/src/libs/libgroff/prime.cpp +++ b/src/libs/libgroff/prime.cpp @@ -20,7 +20,7 @@ internet at <http://www.gnu.org/licenses/gpl-2.0.txt>. */ #endif #include <math.h> -#include "assert.h" +#include <assert.h> bool is_prime(unsigned n) { diff --git a/src/libs/libgroff/relocate.cpp b/src/libs/libgroff/relocate.cpp index c24470ea8..3c1cd073f 100644 --- a/src/libs/libgroff/relocate.cpp +++ b/src/libs/libgroff/relocate.cpp @@ -21,7 +21,7 @@ #include <errno.h> #include <stdlib.h> -#include "assert.h" +#include <assert.h> #include "defs.h" #include "posix.h" #include "nonposix.h" diff --git a/src/libs/libgroff/searchpath.cpp b/src/libs/libgroff/searchpath.cpp index 742ab0b6c..7718c42c6 100644 --- a/src/libs/libgroff/searchpath.cpp +++ b/src/libs/libgroff/searchpath.cpp @@ -21,7 +21,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include <stdlib.h> #include <errno.h> -#include "assert.h" +#include <assert.h> #include "searchpath.h" #include "nonposix.h" diff --git a/src/preproc/eqn/box.cpp b/src/preproc/eqn/box.cpp index cbdde11b2..23ce99916 100644 --- a/src/preproc/eqn/box.cpp +++ b/src/preproc/eqn/box.cpp @@ -16,7 +16,7 @@ for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include "assert.h" +#include <assert.h> #include "eqn.h" #include "pbox.h" diff --git a/src/preproc/eqn/delim.cpp b/src/preproc/eqn/delim.cpp index 8bb5a3a7f..f066da7da 100644 --- a/src/preproc/eqn/delim.cpp +++ b/src/preproc/eqn/delim.cpp @@ -16,7 +16,7 @@ for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include "assert.h" +#include <assert.h> #include "eqn.h" #include "pbox.h" diff --git a/src/preproc/eqn/pile.cpp b/src/preproc/eqn/pile.cpp index a280319e7..cd38b89c6 100644 --- a/src/preproc/eqn/pile.cpp +++ b/src/preproc/eqn/pile.cpp @@ -17,7 +17,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ // piles and matrices -#include "assert.h" +#include <assert.h> #include "eqn.h" #include "pbox.h" diff --git a/src/preproc/eqn/script.cpp b/src/preproc/eqn/script.cpp index 10352b500..9d4e05f9f 100644 --- a/src/preproc/eqn/script.cpp +++ b/src/preproc/eqn/script.cpp @@ -16,7 +16,7 @@ for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include "assert.h" +#include <assert.h> #include "eqn.h" #include "pbox.h" diff --git a/src/preproc/html/pre-html.cpp b/src/preproc/html/pre-html.cpp index 2c87b2d8f..9f2439be3 100644 --- a/src/preproc/html/pre-html.cpp +++ b/src/preproc/html/pre-html.cpp @@ -28,7 +28,7 @@ #include <stdlib.h> #include <errno.h> -#include "assert.h" +#include <assert.h> #include "errarg.h" #include "error.h" diff --git a/src/preproc/pic/pic.h b/src/preproc/pic/pic.h index 8baca154e..11825780d 100644 --- a/src/preproc/pic/pic.h +++ b/src/preproc/pic/pic.h @@ -46,7 +46,7 @@ extern "C" { } #endif -#include "assert.h" +#include <assert.h> #include "cset.h" #include "stringclass.h" #include "lf.h" diff --git a/src/preproc/preconv/preconv.cpp b/src/preproc/preconv/preconv.cpp index e52b3eee6..a08f3d483 100644 --- a/src/preproc/preconv/preconv.cpp +++ b/src/preproc/preconv/preconv.cpp @@ -25,7 +25,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include <uchardet/uchardet.h> #endif -#include "assert.h" +#include <assert.h> #include "errarg.h" #include "error.h" diff --git a/src/preproc/soelim/soelim.cpp b/src/preproc/soelim/soelim.cpp index dd485f710..8793e0e8e 100644 --- a/src/preproc/soelim/soelim.cpp +++ b/src/preproc/soelim/soelim.cpp @@ -22,7 +22,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include <stdlib.h> #include <errno.h> -#include "assert.h" +#include <assert.h> #include "errarg.h" #include "error.h" diff --git a/src/roff/groff/groff.cpp b/src/roff/groff/groff.cpp index 8b468111b..535a533b4 100644 --- a/src/roff/groff/groff.cpp +++ b/src/roff/groff/groff.cpp @@ -24,7 +24,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include <signal.h> #include <errno.h> -#include "assert.h" +#include <assert.h> #include "errarg.h" #include "error.h" #include "stringclass.h" diff --git a/src/roff/troff/troff.h b/src/roff/troff/troff.h index 793ac19ff..4ffec1062 100644 --- a/src/roff/troff/troff.h +++ b/src/roff/troff/troff.h @@ -26,7 +26,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include <stdlib.h> #include <errno.h> -#include "assert.h" +#include <assert.h> #include "color.h" #include "device.h" #include "searchpath.h" diff --git a/src/utils/hpftodit/hpftodit.cpp b/src/utils/hpftodit/hpftodit.cpp index f8292e1b4..74c6c899f 100644 --- a/src/utils/hpftodit/hpftodit.cpp +++ b/src/utils/hpftodit/hpftodit.cpp @@ -31,7 +31,7 @@ put filename in error messages (or fix lib) #include <ctype.h> #include <math.h> #include <errno.h> -#include "assert.h" +#include <assert.h> #include "posix.h" #include "errarg.h" #include "error.h" diff --git a/src/utils/indxbib/indxbib.cpp b/src/utils/indxbib/indxbib.cpp index 92aafeddd..77041d555 100644 --- a/src/utils/indxbib/indxbib.cpp +++ b/src/utils/indxbib/indxbib.cpp @@ -21,7 +21,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include <stdlib.h> #include <errno.h> -#include "assert.h" +#include <assert.h> #include "posix.h" #include "errarg.h" diff --git a/src/utils/lkbib/lkbib.cpp b/src/utils/lkbib/lkbib.cpp index 6865ebbda..c8b984f24 100644 --- a/src/utils/lkbib/lkbib.cpp +++ b/src/utils/lkbib/lkbib.cpp @@ -21,7 +21,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include <stdlib.h> #include <errno.h> -#include "assert.h" +#include <assert.h> #include "errarg.h" #include "error.h" diff --git a/src/utils/lookbib/lookbib.cpp b/src/utils/lookbib/lookbib.cpp index e3e95c058..da5218dd9 100644 --- a/src/utils/lookbib/lookbib.cpp +++ b/src/utils/lookbib/lookbib.cpp @@ -21,7 +21,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include <stdlib.h> #include <errno.h> -#include "assert.h" +#include <assert.h> #include "errarg.h" #include "error.h" diff --git a/src/utils/tfmtodit/tfmtodit.cpp b/src/utils/tfmtodit/tfmtodit.cpp index 6bee68e4d..54505fda0 100644 --- a/src/utils/tfmtodit/tfmtodit.cpp +++ b/src/utils/tfmtodit/tfmtodit.cpp @@ -53,7 +53,7 @@ both be zero. */ #include <errno.h> #include "errarg.h" #include "error.h" -#include "assert.h" +#include <assert.h> #include "cset.h" #include "nonposix.h" |