From: Paul Eggert Date: Mon, 20 Jan 2014 16:55:28 +0000 (-0800) Subject: Apply previous change even if valgrind is not in use, since it avoids undefined behav... X-Git-Tag: emacs-24.3.90~173^2^2~42^2~45^2~325 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=009581fa6558c0ed4f804e7fecdc652ec3532810;p=emacs.git Apply previous change even if valgrind is not in use, since it avoids undefined behavior. This is simpler. --- diff --git a/src/ChangeLog b/src/ChangeLog index 3ac22572d2f..62b9febea25 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,12 +1,9 @@ 2014-01-20 Paul Eggert - Pacify valgrind by initializing buffer redisplay bit. + Avoid undefined behavior by initializing buffer redisplay bit. Problem reported by Dmitry Antipov in . - * alloc.c (USE_VALGRIND): Move this to ... - * conf_post.h (USE_VALGRIND): ... here. Use booleans. - * buffer.c (Fget_buffer_create): Initialize redisplay bit - to pacify valgrind. + * buffer.c (Fget_buffer_create): Initialize redisplay bit. Revert some of the CANNOT_DUMP fix (Bug#16494). * 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 . */ #include +#if (defined ENABLE_CHECKING \ + && defined HAVE_VALGRIND_VALGRIND_H \ + && !defined USE_VALGRIND) +# define USE_VALGRIND 1 +#endif + #if USE_VALGRIND #include #include 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. */) BUF_BEG_UNCHANGED (b) = 0; *(BUF_GPT_ADDR (b)) = *(BUF_Z_ADDR (b)) = 0; /* Put an anchor '\0'. */ b->text->inhibit_shrinking = false; - if (USE_VALGRIND) - b->text->redisplay = false; + b->text->redisplay = false; b->newline_cache = 0; 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; # define ADDRESS_SANITIZER false #endif -/* True if Emacs might be run under valgrind. */ -#ifndef USE_VALGRIND -# if defined ENABLE_CHECKING && defined HAVE_VALGRIND_VALGRIND_H -# define USE_VALGRIND true -# else -# define USE_VALGRIND false -# endif -#endif - #ifdef DARWIN_OS #ifdef emacs #define malloc unexec_malloc