aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Eggert2014-01-20 08:55:28 -0800
committerPaul Eggert2014-01-20 08:55:28 -0800
commit009581fa6558c0ed4f804e7fecdc652ec3532810 (patch)
tree72ee808fb816066bdb59b9de553be74f5dec0da1
parent3c35702fe921254340ad949ce3cab0b668788c90 (diff)
downloademacs-009581fa6558c0ed4f804e7fecdc652ec3532810.tar.gz
emacs-009581fa6558c0ed4f804e7fecdc652ec3532810.zip
Apply previous change even if valgrind is not in use, since it avoids undefined behavior. This is simpler.
-rw-r--r--src/ChangeLog7
-rw-r--r--src/alloc.c6
-rw-r--r--src/buffer.c3
-rw-r--r--src/conf_post.h9
4 files changed, 9 insertions, 16 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 3ac22572d2f..62b9febea25 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,12 +1,9 @@
12014-01-20 Paul Eggert <eggert@cs.ucla.edu> 12014-01-20 Paul Eggert <eggert@cs.ucla.edu>
2 2
3 Pacify valgrind by initializing buffer redisplay bit. 3 Avoid undefined behavior by initializing buffer redisplay bit.
4 Problem reported by Dmitry Antipov in 4 Problem reported by Dmitry Antipov in
5 <http://lists.gnu.org/archive/html/emacs-devel/2014-01/msg01756.html>. 5 <http://lists.gnu.org/archive/html/emacs-devel/2014-01/msg01756.html>.
6 * alloc.c (USE_VALGRIND): Move this to ... 6 * buffer.c (Fget_buffer_create): Initialize redisplay bit.
7 * conf_post.h (USE_VALGRIND): ... here. Use booleans.
8 * buffer.c (Fget_buffer_create): Initialize redisplay bit
9 to pacify valgrind.
10 7
11 Revert some of the CANNOT_DUMP fix (Bug#16494). 8 Revert some of the CANNOT_DUMP fix (Bug#16494).
12 * lread.c (init_lread): Fix typo: NILP, not !NILP. 9 * lread.c (init_lread): Fix typo: NILP, not !NILP.
diff --git a/src/alloc.c b/src/alloc.c
index d31cf3b7193..7f0a74ca834 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -48,6 +48,12 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
48 48
49#include <verify.h> 49#include <verify.h>
50 50
51#if (defined ENABLE_CHECKING \
52 && defined HAVE_VALGRIND_VALGRIND_H \
53 && !defined USE_VALGRIND)
54# define USE_VALGRIND 1
55#endif
56
51#if USE_VALGRIND 57#if USE_VALGRIND
52#include <valgrind/valgrind.h> 58#include <valgrind/valgrind.h>
53#include <valgrind/memcheck.h> 59#include <valgrind/memcheck.h>
diff --git a/src/buffer.c b/src/buffer.c
index 87405174ad2..8f557634b2a 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -574,8 +574,7 @@ even if it is dead. The return value is never nil. */)
574 BUF_BEG_UNCHANGED (b) = 0; 574 BUF_BEG_UNCHANGED (b) = 0;
575 *(BUF_GPT_ADDR (b)) = *(BUF_Z_ADDR (b)) = 0; /* Put an anchor '\0'. */ 575 *(BUF_GPT_ADDR (b)) = *(BUF_Z_ADDR (b)) = 0; /* Put an anchor '\0'. */
576 b->text->inhibit_shrinking = false; 576 b->text->inhibit_shrinking = false;
577 if (USE_VALGRIND) 577 b->text->redisplay = false;
578 b->text->redisplay = false;
579 578
580 b->newline_cache = 0; 579 b->newline_cache = 0;
581 b->width_run_cache = 0; 580 b->width_run_cache = 0;
diff --git a/src/conf_post.h b/src/conf_post.h
index cdb2f973c2b..7419b53c5df 100644
--- a/src/conf_post.h
+++ b/src/conf_post.h
@@ -65,15 +65,6 @@ typedef bool bool_bf;
65# define ADDRESS_SANITIZER false 65# define ADDRESS_SANITIZER false
66#endif 66#endif
67 67
68/* True if Emacs might be run under valgrind. */
69#ifndef USE_VALGRIND
70# if defined ENABLE_CHECKING && defined HAVE_VALGRIND_VALGRIND_H
71# define USE_VALGRIND true
72# else
73# define USE_VALGRIND false
74# endif
75#endif
76
77#ifdef DARWIN_OS 68#ifdef DARWIN_OS
78#ifdef emacs 69#ifdef emacs
79#define malloc unexec_malloc 70#define malloc unexec_malloc