[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master d966f8d: Make mini-gmp safe for --enable-gcc-warnin
From: |
Paul Eggert |
Subject: |
[Emacs-diffs] master d966f8d: Make mini-gmp safe for --enable-gcc-warnings |
Date: |
Sun, 12 Aug 2018 14:13:20 -0400 (EDT) |
branch: master
commit d966f8d29110f74d84187e013ca8c7e7411951aa
Author: Paul Eggert <address@hidden>
Commit: Paul Eggert <address@hidden>
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.
---
configure.ac | 2 +-
lib-src/etags.c | 4 +++-
src/conf_post.h | 11 +++++++++--
src/mini-gmp-emacs.c | 32 ++++++++++++++++++++++++++++++++
4 files changed, 45 insertions(+), 4 deletions(-)
diff --git a/configure.ac b/configure.ac
index 58bdefa..c40b3bd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -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) ;;
diff --git a/lib-src/etags.c b/lib-src/etags.c
index ee50670..102d867 100644
--- a/lib-src/etags.c
+++ b/lib-src/etags.c
@@ -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>
diff --git a/src/conf_post.h b/src/conf_post.h
index 0927fca..f9838bc 100644
--- a/src/conf_post.h
+++ b/src/conf_post.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
diff --git a/src/mini-gmp-emacs.c b/src/mini-gmp-emacs.c
new file mode 100644
index 0000000..7a1b7ab
--- /dev/null
+++ b/src/mini-gmp-emacs.c
@@ -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"
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] master d966f8d: Make mini-gmp safe for --enable-gcc-warnings,
Paul Eggert <=