diff options
| author | Paul Eggert | 2016-01-30 18:38:51 -0800 |
|---|---|---|
| committer | Paul Eggert | 2016-01-30 18:39:27 -0800 |
| commit | 93b144bbaa4bcef356655613cf2fc4fa14e09df6 (patch) | |
| tree | 153608e5a1b17f44249bab8537caaa9a3a8f1043 | |
| parent | 71b20b31c8ee25bcd0de1a954c9ca7b49140b3b2 (diff) | |
| download | emacs-93b144bbaa4bcef356655613cf2fc4fa14e09df6.tar.gz emacs-93b144bbaa4bcef356655613cf2fc4fa14e09df6.zip | |
Pacify GCC on C library without glibc API
Without this change, with --enable-gcc-warnings GCC would complain
“error: redundant redeclaration of ‘aligned_alloc’”.
* configure.ac: Simplify aligned_alloc testing.
* src/alloc.c (aligned_alloc): Don’t use if DARWIN_OS,
since the simplified configure.ac no longer checks for that.
Don’t declare if HAVE_ALIGNED_ALLOC.
Correct misspelling of HAVE_ALIGNED_ALLOC in ifdef.
| -rw-r--r-- | configure.ac | 10 | ||||
| -rw-r--r-- | src/alloc.c | 9 |
2 files changed, 8 insertions, 11 deletions
diff --git a/configure.ac b/configure.ac index 5d6fcda86c4..57bde94d854 100644 --- a/configure.ac +++ b/configure.ac | |||
| @@ -3806,14 +3806,8 @@ getpwent endpwent getgrent endgrent \ | |||
| 3806 | cfmakeraw cfsetspeed copysign __executable_start log2) | 3806 | cfmakeraw cfsetspeed copysign __executable_start log2) |
| 3807 | LIBS=$OLD_LIBS | 3807 | LIBS=$OLD_LIBS |
| 3808 | 3808 | ||
| 3809 | dnl No need to check for aligned_alloc and posix_memalign if using | 3809 | dnl No need to check for posix_memalign if aligned_alloc works. |
| 3810 | dnl gmalloc.o, as it supplies them, unless we're using hybrid_malloc. | 3810 | AC_CHECK_FUNCS([aligned_alloc posix_memalign], [break]) |
| 3811 | dnl Don't use these functions on Darwin as they are incompatible with | ||
| 3812 | dnl unexmacosx.c. | ||
| 3813 | if (test -z "$GMALLOC_OBJ" || test "$hybrid_malloc" = yes) \ | ||
| 3814 | && test "$opsys" != darwin; then | ||
| 3815 | AC_CHECK_FUNCS([aligned_alloc posix_memalign], [break]) | ||
| 3816 | fi | ||
| 3817 | 3811 | ||
| 3818 | dnl Cannot use AC_CHECK_FUNCS | 3812 | dnl Cannot use AC_CHECK_FUNCS |
| 3819 | AC_CACHE_CHECK([for __builtin_unwind_init], | 3813 | AC_CACHE_CHECK([for __builtin_unwind_init], |
diff --git a/src/alloc.c b/src/alloc.c index d379761c168..5f74d9061e5 100644 --- a/src/alloc.c +++ b/src/alloc.c | |||
| @@ -1105,15 +1105,18 @@ lisp_free (void *block) | |||
| 1105 | 1105 | ||
| 1106 | /* Use aligned_alloc if it or a simple substitute is available. | 1106 | /* Use aligned_alloc if it or a simple substitute is available. |
| 1107 | Address sanitization breaks aligned allocation, as of gcc 4.8.2 and | 1107 | Address sanitization breaks aligned allocation, as of gcc 4.8.2 and |
| 1108 | clang 3.3 anyway. */ | 1108 | clang 3.3 anyway. Aligned allocation is incompatible with |
| 1109 | unexmacosx.c, so don't use it on Darwin. */ | ||
| 1109 | 1110 | ||
| 1110 | #if ! ADDRESS_SANITIZER | 1111 | #if ! ADDRESS_SANITIZER && ! DARWIN_OS |
| 1111 | # if !defined SYSTEM_MALLOC && !defined DOUG_LEA_MALLOC && !defined HYBRID_MALLOC | 1112 | # if !defined SYSTEM_MALLOC && !defined DOUG_LEA_MALLOC && !defined HYBRID_MALLOC |
| 1112 | # define USE_ALIGNED_ALLOC 1 | 1113 | # define USE_ALIGNED_ALLOC 1 |
| 1114 | # ifndef HAVE_ALIGNED_ALLOC | ||
| 1113 | /* Defined in gmalloc.c. */ | 1115 | /* Defined in gmalloc.c. */ |
| 1114 | void *aligned_alloc (size_t, size_t); | 1116 | void *aligned_alloc (size_t, size_t); |
| 1117 | # endif | ||
| 1115 | # elif defined HYBRID_MALLOC | 1118 | # elif defined HYBRID_MALLOC |
| 1116 | # if defined ALIGNED_ALLOC || defined HAVE_POSIX_MEMALIGN | 1119 | # if defined HAVE_ALIGNED_ALLOC || defined HAVE_POSIX_MEMALIGN |
| 1117 | # define USE_ALIGNED_ALLOC 1 | 1120 | # define USE_ALIGNED_ALLOC 1 |
| 1118 | # define aligned_alloc hybrid_aligned_alloc | 1121 | # define aligned_alloc hybrid_aligned_alloc |
| 1119 | /* Defined in gmalloc.c. */ | 1122 | /* Defined in gmalloc.c. */ |