Make mini-gmp safe for --enable-gcc-warnings
* configure.ac (GMP_OBJ): When building mini-gmp, compile mini-gmp-emacs.c, not mini-gmp.c. * lib-src/etags.c (NDEBUG): Don't attempt to redefine, in case the builder compiles with -DNDEBUG. * src/conf_post.h (NDEBUG) [!ENABLE_CHECKING && !NDEBUG]: Define. This avoids bloat in mini-gmp-emacs.o. * src/mini-gmp-emacs.c: New file, which pacifies --enable-gcc-warnings.
This commit is contained in:
parent
135037397a
commit
d966f8d291
4 changed files with 45 additions and 4 deletions
|
@ -4308,7 +4308,7 @@ AC_ARG_WITH([mini-gmp],
|
|||
GNU Multiple Precision (GMP) library; this is the
|
||||
default on systems with recent-enough GMP.])])
|
||||
GMP_LIB=
|
||||
GMP_OBJ=mini-gmp.o
|
||||
GMP_OBJ=mini-gmp-emacs.o
|
||||
HAVE_GMP=no
|
||||
case $with_mini_gmp in
|
||||
yes) ;;
|
||||
|
|
|
@ -85,7 +85,9 @@ char pot_etags_version[] = "@(#) pot revision number is 17.38.1.4";
|
|||
# define DEBUG true
|
||||
#else
|
||||
# define DEBUG false
|
||||
# define NDEBUG /* disable assert */
|
||||
# ifndef NDEBUG
|
||||
# define NDEBUG /* disable assert */
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#include <config.h>
|
||||
|
|
|
@ -20,9 +20,16 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
|
|||
|
||||
/* Put the code here rather than in configure.ac using AH_BOTTOM.
|
||||
This way, the code does not get processed by autoheader. For
|
||||
example, undefs here are not commented out.
|
||||
example, undefs here are not commented out. */
|
||||
|
||||
To help make dependencies clearer elsewhere, this file typically
|
||||
/* Disable 'assert' unless enabling checking. Do this early, in
|
||||
case some misguided implementation depends on NDEBUG in some
|
||||
include file other than assert.h. */
|
||||
#if !defined ENABLE_CHECKING && !defined NDEBUG
|
||||
# define NDEBUG
|
||||
#endif
|
||||
|
||||
/* To help make dependencies clearer elsewhere, this file typically
|
||||
does not #include other files. The exceptions are first stdbool.h
|
||||
because it is unlikely to interfere with configuration and bool is
|
||||
such a core part of the C language, and second ms-w32.h (DOS_NT
|
||||
|
|
32
src/mini-gmp-emacs.c
Normal file
32
src/mini-gmp-emacs.c
Normal file
|
@ -0,0 +1,32 @@
|
|||
/* Tailor mini-gmp.c for GNU Emacs
|
||||
|
||||
Copyright 2018 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Emacs.
|
||||
|
||||
GNU Emacs 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.
|
||||
|
||||
GNU Emacs 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 GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
/* Pacify GCC -Wsuggest-attribute=malloc. */
|
||||
static void *gmp_default_alloc (size_t) ATTRIBUTE_MALLOC;
|
||||
|
||||
/* Pacify GCC -Wunused-variable for variables used only in 'assert' calls. */
|
||||
#if defined NDEBUG && GNUC_PREREQ (4, 6, 0)
|
||||
# pragma GCC diagnostic ignored "-Wunused-variable"
|
||||
#endif
|
||||
|
||||
#include "mini-gmp.c"
|
Loading…
Add table
Reference in a new issue