diff options
| author | Paul Eggert | 2018-08-12 11:10:11 -0700 |
|---|---|---|
| committer | Paul Eggert | 2018-08-12 11:13:15 -0700 |
| commit | d966f8d29110f74d84187e013ca8c7e7411951aa (patch) | |
| tree | ae81697cb1e67eeae3bc72396c069e00706b45f4 /src | |
| parent | 135037397a568bbeb4af43f9cb98ff35fd86e03f (diff) | |
| download | emacs-d966f8d29110f74d84187e013ca8c7e7411951aa.tar.gz emacs-d966f8d29110f74d84187e013ca8c7e7411951aa.zip | |
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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/conf_post.h | 11 | ||||
| -rw-r--r-- | src/mini-gmp-emacs.c | 32 |
2 files changed, 41 insertions, 2 deletions
diff --git a/src/conf_post.h b/src/conf_post.h index 0927fca7ca3..f9838bc662a 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/>. */ | |||
| 20 | 20 | ||
| 21 | /* Put the code here rather than in configure.ac using AH_BOTTOM. | 21 | /* Put the code here rather than in configure.ac using AH_BOTTOM. |
| 22 | This way, the code does not get processed by autoheader. For | 22 | This way, the code does not get processed by autoheader. For |
| 23 | example, undefs here are not commented out. | 23 | example, undefs here are not commented out. */ |
| 24 | 24 | ||
| 25 | To help make dependencies clearer elsewhere, this file typically | 25 | /* Disable 'assert' unless enabling checking. Do this early, in |
| 26 | case some misguided implementation depends on NDEBUG in some | ||
| 27 | include file other than assert.h. */ | ||
| 28 | #if !defined ENABLE_CHECKING && !defined NDEBUG | ||
| 29 | # define NDEBUG | ||
| 30 | #endif | ||
| 31 | |||
| 32 | /* To help make dependencies clearer elsewhere, this file typically | ||
| 26 | does not #include other files. The exceptions are first stdbool.h | 33 | does not #include other files. The exceptions are first stdbool.h |
| 27 | because it is unlikely to interfere with configuration and bool is | 34 | because it is unlikely to interfere with configuration and bool is |
| 28 | such a core part of the C language, and second ms-w32.h (DOS_NT | 35 | 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 00000000000..7a1b7ab5de5 --- /dev/null +++ b/src/mini-gmp-emacs.c | |||
| @@ -0,0 +1,32 @@ | |||
| 1 | /* Tailor mini-gmp.c for GNU Emacs | ||
| 2 | |||
| 3 | Copyright 2018 Free Software Foundation, Inc. | ||
| 4 | |||
| 5 | This file is part of GNU Emacs. | ||
| 6 | |||
| 7 | GNU Emacs is free software: you can redistribute it and/or modify | ||
| 8 | it under the terms of the GNU General Public License as published by | ||
| 9 | the Free Software Foundation, either version 3 of the License, or (at | ||
| 10 | your option) any later version. | ||
| 11 | |||
| 12 | GNU Emacs is distributed in the hope that it will be useful, | ||
| 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 15 | GNU General Public License for more details. | ||
| 16 | |||
| 17 | You should have received a copy of the GNU General Public License | ||
| 18 | along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */ | ||
| 19 | |||
| 20 | #include <config.h> | ||
| 21 | |||
| 22 | #include <stddef.h> | ||
| 23 | |||
| 24 | /* Pacify GCC -Wsuggest-attribute=malloc. */ | ||
| 25 | static void *gmp_default_alloc (size_t) ATTRIBUTE_MALLOC; | ||
| 26 | |||
| 27 | /* Pacify GCC -Wunused-variable for variables used only in 'assert' calls. */ | ||
| 28 | #if defined NDEBUG && GNUC_PREREQ (4, 6, 0) | ||
| 29 | # pragma GCC diagnostic ignored "-Wunused-variable" | ||
| 30 | #endif | ||
| 31 | |||
| 32 | #include "mini-gmp.c" | ||