]> git.eshelyaron.com Git - emacs.git/commitdiff
Move marker debugging code under MARKER_DEBUG.
authorDmitry Antipov <dmantipov@yandex.ru>
Mon, 9 Jul 2012 03:15:10 +0000 (07:15 +0400)
committerDmitry Antipov <dmantipov@yandex.ru>
Mon, 9 Jul 2012 03:15:10 +0000 (07:15 +0400)
* marker.c (MARKER_DEBUG): Move marker debugging code under
#ifdef MARKER_DEBUG because byte_char_debug_check is too slow
for bootstrap with --enable-checking (~3x slowdown reported
by Juanma Barranquero <lekktu@gmail.com>).
(verify_bytepos): Move under #ifdef MARKER_DEBUG.

src/ChangeLog
src/marker.c

index 95c8ce2cb51d330b202030737985947a2c51aad8..1375bbe78d9a5cf22a058ab2322c1545d743ef5c 100644 (file)
@@ -1,3 +1,12 @@
+2012-07-09  Dmitry Antipov  <dmantipov@yandex.ru>
+
+       Move marker debugging code under MARKER_DEBUG.
+       * marker.c (MARKER_DEBUG): Move marker debugging code under
+       #ifdef MARKER_DEBUG because byte_char_debug_check is too slow
+       for bootstrap with --enable-checking (~3x slowdown reported
+       by Juanma Barranquero <lekktu@gmail.com>).
+       (verify_bytepos): Move under #ifdef MARKER_DEBUG.
+
 2012-07-08  Paul Eggert  <eggert@cs.ucla.edu>
 
        * systime.h (EMACS_SUB_TIME): Clarify behavior with unsigned time_t.
index ba98a78f0e4533f1616f491a75feaf3c35e286cd..72f48a2d7b9d9932b5de2a72797f099e869b6b46 100644 (file)
@@ -31,9 +31,14 @@ static ptrdiff_t cached_bytepos;
 static struct buffer *cached_buffer;
 static int cached_modiff;
 
-#ifdef ENABLE_CHECKING
+/* Juanma Barranquero <lekktu@gmail.com> reported ~3x increased
+   bootstrap time when byte_char_debug_check is enabled; so this
+   is never turned on by --enable-checking configure option.  */
+
+#ifdef MARKER_DEBUG
 
 extern int count_markers (struct buffer *) EXTERNALLY_VISIBLE;
+extern ptrdiff_t verify_bytepos (ptrdiff_t charpos) EXTERNALLY_VISIBLE;
 
 static void
 byte_char_debug_check (struct buffer *b, ptrdiff_t charpos, ptrdiff_t bytepos)
@@ -57,11 +62,11 @@ byte_char_debug_check (struct buffer *b, ptrdiff_t charpos, ptrdiff_t bytepos)
     abort ();
 }
 
-#else /* not ENABLE_CHECKING */
+#else /* not MARKER_DEBUG */
 
 #define byte_char_debug_check(b,charpos,bytepos) do { } while (0)
 
-#endif /* ENABLE_CHECKING */
+#endif /* MARKER_DEBUG */
  
 void
 clear_charpos_cache (struct buffer *b)
@@ -237,25 +242,6 @@ buf_charpos_to_bytepos (struct buffer *b, ptrdiff_t charpos)
 
 #undef CONSIDER
 
-/* Used for debugging: recompute the bytepos corresponding to CHARPOS
-   in the simplest, most reliable way.  */
-
-extern ptrdiff_t verify_bytepos (ptrdiff_t charpos) EXTERNALLY_VISIBLE;
-ptrdiff_t
-verify_bytepos (ptrdiff_t charpos)
-{
-  ptrdiff_t below = 1;
-  ptrdiff_t below_byte = 1;
-
-  while (below != charpos)
-    {
-      below++;
-      BUF_INC_POS (current_buffer, below_byte);
-    }
-
-  return below_byte;
-}
-\f
 /* buf_bytepos_to_charpos returns the char position corresponding to
    BYTEPOS.  */
 
@@ -781,7 +767,7 @@ DEFUN ("buffer-has-markers-at", Fbuffer_has_markers_at, Sbuffer_has_markers_at,
   return Qnil;
 }
 
-#ifdef ENABLE_CHECKING
+#ifdef MARKER_DEBUG
 
 /* For debugging -- count the markers in buffer BUF.  */
 
@@ -797,7 +783,25 @@ count_markers (struct buffer *buf)
   return total;
 }
 
-#endif /* ENABLE_CHECKING */
+/* For debugging -- recompute the bytepos corresponding
+   to CHARPOS in the simplest, most reliable way.  */
+
+ptrdiff_t
+verify_bytepos (ptrdiff_t charpos)
+{
+  ptrdiff_t below = 1;
+  ptrdiff_t below_byte = 1;
+
+  while (below != charpos)
+    {
+      below++;
+      BUF_INC_POS (current_buffer, below_byte);
+    }
+
+  return below_byte;
+}
+
+#endif /* MARKER_DEBUG */
 \f
 void
 syms_of_marker (void)