]> git.eshelyaron.com Git - emacs.git/commitdiff
Apply previous change even if valgrind is not in use, since it avoids undefined behav...
authorPaul Eggert <eggert@cs.ucla.edu>
Mon, 20 Jan 2014 16:55:28 +0000 (08:55 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Mon, 20 Jan 2014 16:55:28 +0000 (08:55 -0800)
src/ChangeLog
src/alloc.c
src/buffer.c
src/conf_post.h

index 3ac22572d2f4878e4045b4200ec4f96fd63dd446..62b9febea2545d29fb44587621abf9d6df81bb98 100644 (file)
@@ -1,12 +1,9 @@
 2014-01-20  Paul Eggert  <eggert@cs.ucla.edu>
 
-       Pacify valgrind by initializing buffer redisplay bit.
+       Avoid undefined behavior by initializing buffer redisplay bit.
        Problem reported by Dmitry Antipov in
        <http://lists.gnu.org/archive/html/emacs-devel/2014-01/msg01756.html>.
-       * 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.
index d31cf3b7193cb7a7038d2134768b65ed1c07a629..7f0a74ca834a88c2492967bb2af0da7d392864ae 100644 (file)
@@ -48,6 +48,12 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include <verify.h>
 
+#if (defined ENABLE_CHECKING                   \
+     && defined HAVE_VALGRIND_VALGRIND_H       \
+     && !defined USE_VALGRIND)
+# define USE_VALGRIND 1
+#endif
+
 #if USE_VALGRIND
 #include <valgrind/valgrind.h>
 #include <valgrind/memcheck.h>
index 87405174ad2d0ab9dba0d955621d750621956894..8f557634b2a75f71e1ce1aa3463409b61af4845a 100644 (file)
@@ -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;
index cdb2f973c2b1a3494759f8ba60d4cc41263792da..7419b53c5df44fc6f06045204110ee8670891456 100644 (file)
@@ -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