From e509cfa6065d20e0d8d2b3ce9ac544355521bc89 Mon Sep 17 00:00:00 2001 From: Dmitry Antipov Date: Thu, 28 Jun 2012 11:50:50 +0400 Subject: [PATCH] * configure.in: Add glyphs category to --enable-checking option. (GLYPH_DEBUG): Define if glyphs debugging is enabled. * src/dispextern.h (GLYPH_DEBUG): Now defined in config.h if enabled with --enable-checking=[all,glyphs] configure option. Fix GLYPH_DEBUG usage assuming that it may be undefined, adjust comments accordingly. * src/dispnew.c: Fix GLYPH_DEBUG usage assuming that it may be undefined, adjust comments accordingly. * src/image.c: Likewise. * src/scroll.c: Likewise. * src/w32fns.c: Likewise. * src/w32term.c: Likewise. * src/xdisp.c: Likewise. * src/xfaces.c: Likewise. * src/xfns.c: Likewise. * src/xterm.c: Likewise. --- ChangeLog | 5 +++++ configure.in | 13 +++++++++--- src/ChangeLog | 17 +++++++++++++++ src/dispextern.h | 31 ++++++++++++--------------- src/dispnew.c | 38 +++++++++++++++++----------------- src/fontset.c | 7 ++----- src/image.c | 6 +++--- src/scroll.c | 6 +++--- src/w32fns.c | 10 ++++----- src/w32term.c | 6 +++--- src/xdisp.c | 54 ++++++++++++++++++++++++------------------------ src/xfaces.c | 24 ++++++++++----------- src/xfns.c | 10 ++++----- src/xterm.c | 6 +++--- 14 files changed, 126 insertions(+), 107 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9d910fe62d9..877fbcc7e15 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2012-06-28 Dmitry Antipov + + * configure.in: Add glyphs category to --enable-checking option. + (GLYPH_DEBUG): Define if glyphs debugging is enabled. + 2012-06-28 Dmitry Antipov * configure.in (ENABLE_CHECKING): Update comment. diff --git a/configure.in b/configure.in index 7494e5e5da0..393d87fd721 100644 --- a/configure.in +++ b/configure.in @@ -251,7 +251,7 @@ AC_ARG_ENABLE(checking, enable only specific categories of checks. Categories are: all,yes,no. Flags are: stringbytes, stringoverrun, stringfreelist, - xmallocoverrun, conslist])], + xmallocoverrun, conslist, glyphs])], [ac_checking_flags="${enableval}"],[]) IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS="$IFS," for check in $ac_checking_flags @@ -264,19 +264,22 @@ do ac_gc_check_string_overrun= ; ac_gc_check_string_free_list= ; ac_xmalloc_overrun= ; - ac_gc_check_cons_list= ;; + ac_gc_check_cons_list= ; + ac_check_glyphs= ;; all) ac_enable_checking=1 ; ac_gc_check_stringbytes=1 ; ac_gc_check_string_overrun=1 ; ac_gc_check_string_free_list=1 ; ac_xmalloc_overrun=1 ; - ac_gc_check_cons_list=1 ;; + ac_gc_check_cons_list=1 ; + ac_check_glyphs=1 ;; # these enable particular checks stringbytes) ac_gc_check_stringbytes=1 ;; stringoverrun) ac_gc_check_string_overrun=1 ;; stringfreelist) ac_gc_check_string_free_list=1 ;; xmallocoverrun) ac_xmalloc_overrun=1 ;; conslist) ac_gc_check_cons_list=1 ;; + glyphs) ac_check_glyphs=1 ;; *) AC_MSG_ERROR(unknown check category $check) ;; esac done @@ -308,6 +311,10 @@ if test x$ac_gc_check_cons_list != x ; then AC_DEFINE(GC_CHECK_CONS_LIST, 1, [Define this to check for errors in cons list.]) fi +if test x$ac_check_glyphs != x ; then + AC_DEFINE(GLYPH_DEBUG, 1, +[Define this to enable glyphs debugging code.]) +fi AC_ARG_ENABLE(check-lisp-object-type, [AS_HELP_STRING([--enable-check-lisp-object-type], diff --git a/src/ChangeLog b/src/ChangeLog index 9a677d9f2d7..fd1f17b8cde 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,20 @@ +2012-06-28 Dmitry Antipov + + * dispextern.h (GLYPH_DEBUG): Now defined in config.h if + enabled with --enable-checking=[all,glyphs] configure option. + Fix GLYPH_DEBUG usage assuming that it may be undefined, + adjust comments accordingly. + * dispnew.c: Fix GLYPH_DEBUG usage assuming that it may be + undefined, adjust comments accordingly. + * image.c: Likewise. + * scroll.c: Likewise. + * w32fns.c: Likewise. + * w32term.c: Likewise. + * xdisp.c: Likewise. + * xfaces.c: Likewise. + * xfns.c: Likewise. + * xterm.c: Likewise. + 2012-06-28 Dmitry Antipov Generalize run-time debugging checks. diff --git a/src/dispextern.h b/src/dispextern.h index 78f6db63cb7..c7adc4dadec 100644 --- a/src/dispextern.h +++ b/src/dispextern.h @@ -121,26 +121,21 @@ enum window_part Debugging ***********************************************************************/ -/* If GLYPH_DEBUG is non-zero, additional checks are activated. Turn - it off by defining the macro GLYPH_DEBUG to zero. */ +/* If GLYPH_DEBUG is defined, additional checks are activated. */ -#ifndef GLYPH_DEBUG -#define GLYPH_DEBUG 0 -#endif - -/* Macros to include code only if GLYPH_DEBUG != 0. */ +/* Macros to include code only if GLYPH_DEBUG is defined. */ -#if GLYPH_DEBUG +#ifdef GLYPH_DEBUG #define IF_DEBUG(X) X #else #define IF_DEBUG(X) (void) 0 #endif /* Macro for displaying traces of redisplay. If Emacs was compiled - with GLYPH_DEBUG != 0, the variable trace_redisplay_p can be set to + with GLYPH_DEBUG defined, the variable trace_redisplay_p can be set to a non-zero value in debugging sessions to activate traces. */ -#if GLYPH_DEBUG +#ifdef GLYPH_DEBUG extern int trace_redisplay_p EXTERNALLY_VISIBLE; #include @@ -151,11 +146,11 @@ extern int trace_redisplay_p EXTERNALLY_VISIBLE; else \ (void) 0 -#else /* GLYPH_DEBUG == 0 */ +#else /* not GLYPH_DEBUG */ #define TRACE(X) (void) 0 -#endif /* GLYPH_DEBUG == 0 */ +#endif /* GLYPH_DEBUG */ @@ -653,7 +648,7 @@ struct glyph_matrix line. */ unsigned header_line_p : 1; -#if GLYPH_DEBUG +#ifdef GLYPH_DEBUG /* A string identifying the method used to display the matrix. */ char method[512]; #endif @@ -671,7 +666,7 @@ struct glyph_matrix /* Check that glyph pointers stored in glyph rows of MATRIX are okay. This aborts if any pointer is found twice. */ -#if GLYPH_DEBUG +#ifdef GLYPH_DEBUG void check_matrix_pointer_lossage (struct glyph_matrix *); #define CHECK_MATRIX(MATRIX) check_matrix_pointer_lossage ((MATRIX)) #else @@ -950,10 +945,10 @@ struct glyph_row /* Get a pointer to row number ROW in matrix MATRIX. If GLYPH_DEBUG - is defined to a non-zero value, the function matrix_row checks that - we don't try to access rows that are out of bounds. */ + is defined, the function matrix_row checks that we don't try to + access rows that are out of bounds. */ -#if GLYPH_DEBUG +#ifdef GLYPH_DEBUG struct glyph_row *matrix_row (struct glyph_matrix *, int); #define MATRIX_ROW(MATRIX, ROW) matrix_row ((MATRIX), (ROW)) #else @@ -3067,7 +3062,7 @@ extern void produce_stretch_glyph (struct it *); #ifdef HAVE_WINDOW_SYSTEM -#if GLYPH_DEBUG +#ifdef GLYPH_DEBUG extern void dump_glyph_string (struct glyph_string *) EXTERNALLY_VISIBLE; #endif diff --git a/src/dispnew.c b/src/dispnew.c index a34552fc564..767f1c8112b 100644 --- a/src/dispnew.c +++ b/src/dispnew.c @@ -123,7 +123,7 @@ static void fill_up_glyph_row_area_with_spaces (struct glyph_row *, int); static int scrolling_window (struct window *, int); static int update_window_line (struct window *, int, int *); static void mirror_make_current (struct window *, int); -#if GLYPH_DEBUG +#ifdef GLYPH_DEBUG static void check_matrix_pointers (struct glyph_matrix *, struct glyph_matrix *); #endif @@ -211,7 +211,7 @@ int fonts_changed_p; /* Convert vpos and hpos from frame to window and vice versa. This may only be used for terminal frames. */ -#if GLYPH_DEBUG +#ifdef GLYPH_DEBUG static int window_to_frame_vpos (struct window *, int); static int window_to_frame_hpos (struct window *, int); @@ -311,12 +311,12 @@ DEFUN ("dump-redisplay-history", Fdump_redisplay_history, } -#else /* GLYPH_DEBUG == 0 */ +#else /* not GLYPH_DEBUG */ #define WINDOW_TO_FRAME_VPOS(W, VPOS) ((VPOS) + WINDOW_TOP_EDGE_LINE (W)) #define WINDOW_TO_FRAME_HPOS(W, HPOS) ((HPOS) + WINDOW_LEFT_EDGE_COL (W)) -#endif /* GLYPH_DEBUG == 0 */ +#endif /* GLYPH_DEBUG */ #if (defined PROFILING \ @@ -419,14 +419,14 @@ margin_glyphs_to_reserve (struct window *w, int total_glyphs, Lisp_Object margin return n; } -#ifdef ENABLE_CHECKING -/* Return non-zero if ROW's hash value is correct, zero if not. */ +/* Return non-zero if ROW's hash value is correct, zero if not. + Optimized away if ENABLE_CHECKING is not defined. */ + static int verify_row_hash (struct glyph_row *row) { return row->hash == row_hash (row); } -#endif /* Adjust glyph matrix MATRIX on window W or on a frame to changed window sizes. @@ -1136,7 +1136,7 @@ assign_row (struct glyph_row *to, struct glyph_row *from) is non-zero if the glyph memory of WINDOW_ROW is part of the glyph memory of FRAME_ROW. */ -#if GLYPH_DEBUG +#ifdef GLYPH_DEBUG static int glyph_row_slice_p (struct glyph_row *window_row, struct glyph_row *frame_row) @@ -1451,7 +1451,7 @@ realloc_glyph_pool (struct glyph_pool *pool, struct dim matrix_dim) Debug Code ***********************************************************************/ -#if GLYPH_DEBUG +#ifdef GLYPH_DEBUG /* Flush standard output. This is sometimes useful to call from the debugger. @@ -1576,7 +1576,7 @@ check_matrix_invariants (struct window *w) #endif /* 0 */ -#endif /* GLYPH_DEBUG != 0 */ +#endif /* GLYPH_DEBUG */ @@ -2599,7 +2599,7 @@ build_frame_matrix_from_leaf_window (struct glyph_matrix *frame_matrix, struct w SET_CHAR_GLYPH_FROM_GLYPH (*border, right_border_glyph); } -#if GLYPH_DEBUG +#ifdef GLYPH_DEBUG /* Window row window_y must be a slice of frame row frame_y. */ eassert (glyph_row_slice_p (window_row, frame_row)); @@ -3026,7 +3026,7 @@ mirror_line_dance (struct window *w, int unchanged_at_top, int nlines, int *copy } -#if GLYPH_DEBUG +#ifdef GLYPH_DEBUG /* Check that window and frame matrices agree about their understanding where glyphs of the rows are to find. For each @@ -3082,7 +3082,7 @@ check_matrix_pointers (struct glyph_matrix *window_matrix, } } -#endif /* GLYPH_DEBUG != 0 */ +#endif /* GLYPH_DEBUG */ @@ -3090,7 +3090,7 @@ check_matrix_pointers (struct glyph_matrix *window_matrix, VPOS and HPOS translations **********************************************************************/ -#if GLYPH_DEBUG +#ifdef GLYPH_DEBUG /* Translate vertical position VPOS which is relative to window W to a vertical position relative to W's frame. */ @@ -3302,7 +3302,7 @@ update_frame (struct frame *f, int force_p, int inhibit_hairy_id_p) } /* Check window matrices for lost pointers. */ -#if GLYPH_DEBUG +#ifdef GLYPH_DEBUG check_window_matrix_pointers (root_window); add_frame_display_history (f, paused_p); #endif @@ -3529,7 +3529,7 @@ update_window (struct window *w, int force_p) int preempt_count = baud_rate / 2400 + 1; #endif struct redisplay_interface *rif = FRAME_RIF (XFRAME (WINDOW_FRAME (w))); -#if GLYPH_DEBUG +#ifdef GLYPH_DEBUG /* Check that W's frame doesn't have glyph matrices. */ eassert (FRAME_WINDOW_P (XFRAME (WINDOW_FRAME (w)))); #endif @@ -3681,7 +3681,7 @@ update_window (struct window *w, int force_p) #endif } -#if GLYPH_DEBUG +#ifdef GLYPH_DEBUG /* Remember the redisplay method used to display the matrix. */ strcpy (w->current_matrix->method, w->desired_matrix->method); #endif @@ -3699,7 +3699,7 @@ update_window (struct window *w, int force_p) else paused_p = 1; -#if GLYPH_DEBUG +#ifdef GLYPH_DEBUG /* check_current_matrix_flags (w); */ add_window_display_history (w, w->current_matrix->method, paused_p); #endif @@ -6476,7 +6476,7 @@ syms_of_display (void) defsubr (&Sinternal_show_cursor_p); defsubr (&Slast_nonminibuf_frame); -#if GLYPH_DEBUG +#ifdef GLYPH_DEBUG defsubr (&Sdump_redisplay_history); #endif diff --git a/src/fontset.c b/src/fontset.c index 98ee89070f9..da54bca2a5c 100644 --- a/src/fontset.c +++ b/src/fontset.c @@ -197,9 +197,8 @@ static void accumulate_script_ranges (Lisp_Object, Lisp_Object, Lisp_Object); static void set_fontset_font (Lisp_Object, Lisp_Object); -#ifdef ENABLE_CHECKING - -/* Return 1 if ID is a valid fontset id, else return 0. */ +/* Return 1 if ID is a valid fontset id, else return 0. + Optimized away if ENABLE_CHECKING is not defined. */ static int fontset_id_valid_p (int id) @@ -207,8 +206,6 @@ fontset_id_valid_p (int id) return (id >= 0 && id < ASIZE (Vfontset_table) - 1); } -#endif - /********** MACROS AND FUNCTIONS TO HANDLE FONTSET **********/ diff --git a/src/image.c b/src/image.c index 63bac9a8a79..9b1c7f1b280 100644 --- a/src/image.c +++ b/src/image.c @@ -8686,7 +8686,7 @@ x_kill_gs_process (Pixmap pixmap, struct frame *f) Tests ***********************************************************************/ -#if GLYPH_DEBUG +#ifdef GLYPH_DEBUG DEFUN ("imagep", Fimagep, Simagep, 1, 1, 0, doc: /* Value is non-nil if SPEC is a valid image specification. */) @@ -8708,7 +8708,7 @@ DEFUN ("lookup-image", Flookup_image, Slookup_image, 1, 1, 0, "") return make_number (id); } -#endif /* GLYPH_DEBUG != 0 */ +#endif /* GLYPH_DEBUG */ /*********************************************************************** @@ -8922,7 +8922,7 @@ non-numeric, there is no explicit limit on the size of images. */); defsubr (&Simage_mask_p); defsubr (&Simage_metadata); -#if GLYPH_DEBUG +#ifdef GLYPH_DEBUG defsubr (&Simagep); defsubr (&Slookup_image); #endif diff --git a/src/scroll.c b/src/scroll.c index 603e04575f6..86d775545b0 100644 --- a/src/scroll.c +++ b/src/scroll.c @@ -264,7 +264,7 @@ do_scrolling (struct frame *frame, struct glyph_matrix *current_matrix, for (k = 0; k < window_size; ++k) copy_from[k] = -1; -#if GLYPH_DEBUG +#ifdef GLYPH_DEBUG # define CHECK_BOUNDS \ do \ { \ @@ -322,7 +322,7 @@ do_scrolling (struct frame *frame, struct glyph_matrix *current_matrix, copy_from[i] = j; retained_p[j] = 1; -#if GLYPH_DEBUG +#ifdef GLYPH_DEBUG CHECK_BOUNDS; #endif } @@ -374,7 +374,7 @@ do_scrolling (struct frame *frame, struct glyph_matrix *current_matrix, mirrored_line_dance (current_matrix, unchanged_at_top, window_size, copy_from, retained_p); - /* Some sanity checks if GLYPH_DEBUG != 0. */ + /* Some sanity checks if GLYPH_DEBUG is defined. */ CHECK_MATRIX (current_matrix); if (terminal_window_p) diff --git a/src/w32fns.c b/src/w32fns.c index c00ed66dcbb..acd42792b9b 100644 --- a/src/w32fns.c +++ b/src/w32fns.c @@ -183,7 +183,7 @@ unsigned int msh_mousewheel = 0; #define MENU_FREE_DELAY 1000 static unsigned menu_free_timer = 0; -#if GLYPH_DEBUG +#ifdef GLYPH_DEBUG static int image_cache_refcount, dpyinfo_refcount; #endif @@ -3996,14 +3996,14 @@ unwind_create_frame (Lisp_Object frame) /* If frame is ``official'', nothing to do. */ if (NILP (Fmemq (frame, Vframe_list))) { -#if GLYPH_DEBUG +#ifdef GLYPH_DEBUG struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (f); #endif x_free_frame_resources (f); free_glyphs (f); -#if GLYPH_DEBUG +#ifdef GLYPH_DEBUG /* Check that reference counts are indeed correct. */ eassert (dpyinfo->reference_count == dpyinfo_refcount); eassert (dpyinfo->terminal->image_cache->refcount == image_cache_refcount); @@ -4160,7 +4160,7 @@ This function is an internal primitive--use `make-frame' instead. */) /* With FRAME_X_DISPLAY_INFO set up, this unwind-protect is safe. */ record_unwind_protect (unwind_create_frame, frame); -#if GLYPH_DEBUG +#ifdef GLYPH_DEBUG image_cache_refcount = FRAME_IMAGE_CACHE (f) ? FRAME_IMAGE_CACHE (f)->refcount : 0; dpyinfo_refcount = dpyinfo->reference_count; @@ -5237,7 +5237,7 @@ x_create_tip_frame (struct w32_display_info *dpyinfo, FRAME_FONTSET (f) = -1; f->icon_name = Qnil; -#if GLYPH_DEBUG +#ifdef GLYPH_DEBUG image_cache_refcount = FRAME_IMAGE_CACHE (f) ? FRAME_IMAGE_CACHE (f)->refcount : 0; dpyinfo_refcount = dpyinfo->reference_count; diff --git a/src/w32term.c b/src/w32term.c index f879e648054..c0c137b9a9d 100644 --- a/src/w32term.c +++ b/src/w32term.c @@ -231,7 +231,7 @@ static void my_set_focus (struct frame *, HWND); static void my_set_foreground_window (HWND); static void my_destroy_window (struct frame *, HWND); -#if GLYPH_DEBUG +#ifdef GLYPH_DEBUG static void x_check_font (struct frame *, struct font *); #endif @@ -6024,7 +6024,7 @@ x_wm_set_icon_position (struct frame *f, int icon_x, int icon_y) Fonts ***********************************************************************/ -#if GLYPH_DEBUG +#ifdef GLYPH_DEBUG /* Check that FONT is valid on frame F. It is if it can be found in F's font table. */ @@ -6037,7 +6037,7 @@ x_check_font (struct frame *f, struct font *font) eassert (font->driver->check (f, font) == 0); } -#endif /* GLYPH_DEBUG != 0 */ +#endif /* GLYPH_DEBUG */ diff --git a/src/xdisp.c b/src/xdisp.c index b03c455eb50..425ccc522de 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -627,10 +627,10 @@ int current_mode_line_height, current_header_line_height; CACHE = NULL; \ } while (0) -#if GLYPH_DEBUG +#ifdef GLYPH_DEBUG /* Non-zero means print traces of redisplay if compiled with - GLYPH_DEBUG != 0. */ + GLYPH_DEBUG defined. */ int trace_redisplay_p; @@ -2495,7 +2495,7 @@ check_it (struct it *it) #endif /* not 0 */ -#if GLYPH_DEBUG && defined ENABLE_CHECKING +#if defined GLYPH_DEBUG && defined ENABLE_CHECKING /* Check that the window end of window W is what we expect it to be---the last row in the current matrix displaying text. */ @@ -2521,7 +2521,7 @@ check_window_end (struct window *w) #define CHECK_WINDOW_END(W) (void) 0 -#endif +#endif /* GLYPH_DEBUG and ENABLE_CHECKING */ @@ -12435,7 +12435,7 @@ hscroll_windows (Lisp_Object window) to a non-zero value. This is sometimes handy to have in a debugger session. */ -#if GLYPH_DEBUG +#ifdef GLYPH_DEBUG /* First and last unchanged row for try_window_id. */ @@ -13235,7 +13235,7 @@ redisplay_internal (void) /* Update hint: No need to try to scroll in update_window. */ w->desired_matrix->no_scrolling_p = 1; -#if GLYPH_DEBUG +#ifdef GLYPH_DEBUG *w->desired_matrix->method = 0; debug_method_add (w, "optimization 1"); #endif @@ -13303,7 +13303,7 @@ redisplay_internal (void) eassert (this_line_vpos == it.vpos); eassert (this_line_y == it.current_y); set_cursor_from_row (w, row, w->current_matrix, 0, 0, 0, 0); -#if GLYPH_DEBUG +#ifdef GLYPH_DEBUG *w->desired_matrix->method = 0; debug_method_add (w, "optimization 3"); #endif @@ -14575,7 +14575,7 @@ try_scrolling (Lisp_Object window, int just_this_one_p, /* We will never try scrolling more than this number of lines. */ int scroll_limit = SCROLL_LIMIT; -#if GLYPH_DEBUG +#ifdef GLYPH_DEBUG debug_method_add (w, "try_scrolling"); #endif @@ -14927,7 +14927,7 @@ try_cursor_movement (Lisp_Object window, struct text_pos startp, int *scroll_ste struct frame *f = XFRAME (w->frame); int rc = CURSOR_MOVEMENT_CANNOT_BE_USED; -#if GLYPH_DEBUG +#ifdef GLYPH_DEBUG if (inhibit_try_cursor_movement) return rc; #endif @@ -14974,7 +14974,7 @@ try_cursor_movement (Lisp_Object window, struct text_pos startp, int *scroll_ste int this_scroll_margin, top_scroll_margin; struct glyph_row *row = NULL; -#if GLYPH_DEBUG +#ifdef GLYPH_DEBUG debug_method_add (w, "cursor movement"); #endif @@ -15332,7 +15332,7 @@ redisplay_window (Lisp_Object window, int just_this_one_p) /* W must be a leaf window here. */ eassert (!NILP (w->buffer)); -#if GLYPH_DEBUG +#ifdef GLYPH_DEBUG *w->desired_matrix->method = 0; #endif @@ -15624,7 +15624,7 @@ redisplay_window (Lisp_Object window, int just_this_one_p) } } -#if GLYPH_DEBUG +#ifdef GLYPH_DEBUG debug_method_add (w, "forced window start"); #endif goto done; @@ -15656,7 +15656,7 @@ redisplay_window (Lisp_Object window, int just_this_one_p) && !(CHARPOS (startp) <= BEGV || FETCH_BYTE (BYTEPOS (startp) - 1) == '\n')) { -#if GLYPH_DEBUG +#ifdef GLYPH_DEBUG debug_method_add (w, "recenter 1"); #endif goto recenter; @@ -15667,7 +15667,7 @@ redisplay_window (Lisp_Object window, int just_this_one_p) not work. It is 0 if unsuccessful for some other reason. */ else if ((tem = try_window_id (w)) != 0) { -#if GLYPH_DEBUG +#ifdef GLYPH_DEBUG debug_method_add (w, "try_window_id %d", tem); #endif @@ -15724,7 +15724,7 @@ redisplay_window (Lisp_Object window, int just_this_one_p) goto force_start; } -#if GLYPH_DEBUG +#ifdef GLYPH_DEBUG debug_method_add (w, "same window start"); #endif @@ -15819,7 +15819,7 @@ redisplay_window (Lisp_Object window, int just_this_one_p) recenter: -#if GLYPH_DEBUG +#ifdef GLYPH_DEBUG debug_method_add (w, "recenter"); #endif @@ -16307,7 +16307,7 @@ try_window_reusing_current_matrix (struct window *w) struct glyph_row *start_row; int start_vpos, min_y, max_y; -#if GLYPH_DEBUG +#ifdef GLYPH_DEBUG if (inhibit_try_window_reusing) return 0; #endif @@ -16529,7 +16529,7 @@ try_window_reusing_current_matrix (struct window *w) /* Update hint: don't try scrolling again in update_window. */ w->desired_matrix->no_scrolling_p = 1; -#if GLYPH_DEBUG +#ifdef GLYPH_DEBUG debug_method_add (w, "try_window_reusing_current_matrix 1"); #endif return 1; @@ -16719,7 +16719,7 @@ try_window_reusing_current_matrix (struct window *w) w->window_end_valid = Qnil; w->desired_matrix->no_scrolling_p = 1; -#if GLYPH_DEBUG +#ifdef GLYPH_DEBUG debug_method_add (w, "try_window_reusing_current_matrix 2"); #endif return 1; @@ -17087,7 +17087,7 @@ try_window_id (struct window *w) struct text_pos start; ptrdiff_t first_changed_charpos, last_changed_charpos; -#if GLYPH_DEBUG +#ifdef GLYPH_DEBUG if (inhibit_try_window_id) return 0; #endif @@ -17421,7 +17421,7 @@ try_window_id (struct window *w) GIVE_UP (19); -#if GLYPH_DEBUG +#ifdef GLYPH_DEBUG /* Either there is no unchanged row at the end, or the one we have now displays text. This is a necessary condition for the window @@ -17435,7 +17435,7 @@ try_window_id (struct window *w) : -1); debug_first_unchanged_at_end_vpos = first_unchanged_at_end_vpos; -#endif /* GLYPH_DEBUG != 0 */ +#endif /* GLYPH_DEBUG */ /* Display new lines. Set last_text_row to the last new line @@ -17805,7 +17805,7 @@ try_window_id (struct window *w) More debugging support ***********************************************************************/ -#if GLYPH_DEBUG +#ifdef GLYPH_DEBUG void dump_glyph_row (struct glyph_row *, int, int) EXTERNALLY_VISIBLE; void dump_glyph_matrix (struct glyph_matrix *, int) EXTERNALLY_VISIBLE; @@ -22223,7 +22223,7 @@ calc_pixel_width_or_height (double *res, struct it *it, Lisp_Object prop, #ifdef HAVE_WINDOW_SYSTEM -#if GLYPH_DEBUG +#ifdef GLYPH_DEBUG void dump_glyph_string (struct glyph_string *s) @@ -28408,7 +28408,7 @@ syms_of_xdisp (void) message_dolog_marker3 = Fmake_marker (); staticpro (&message_dolog_marker3); -#if GLYPH_DEBUG +#ifdef GLYPH_DEBUG defsubr (&Sdump_frame_glyph_matrix); defsubr (&Sdump_glyph_matrix); defsubr (&Sdump_glyph_row); @@ -28620,7 +28620,7 @@ of the top or bottom of the window. */); Value is a number or a cons (WIDTH-DPI . HEIGHT-DPI). */); Vdisplay_pixels_per_inch = make_float (72.0); -#if GLYPH_DEBUG +#ifdef GLYPH_DEBUG DEFVAR_INT ("debug-end-pos", debug_end_pos, doc: /* Don't ask. */); #endif @@ -28937,7 +28937,7 @@ To add a prefix to continuation lines, use `wrap-prefix'. */); doc: /* Non-nil means don't free realized faces. Internal use only. */); inhibit_free_realized_faces = 0; -#if GLYPH_DEBUG +#ifdef GLYPH_DEBUG DEFVAR_BOOL ("inhibit-try-window-id", inhibit_try_window_id, doc: /* Inhibit try_window_id display optimization. */); inhibit_try_window_id = 0; diff --git a/src/xfaces.c b/src/xfaces.c index a319c542b07..021d40559e5 100644 --- a/src/xfaces.c +++ b/src/xfaces.c @@ -441,7 +441,7 @@ static Lisp_Object Vparam_value_alist; /* The total number of colors currently allocated. */ -#if GLYPH_DEBUG +#ifdef GLYPH_DEBUG static int ncolors_allocated; static int npixmaps_allocated; static int ngcs; @@ -1010,7 +1010,7 @@ load_pixmap (FRAME_PTR f, Lisp_Object name, unsigned int *w_ptr, } else { -#if GLYPH_DEBUG +#ifdef GLYPH_DEBUG ++npixmaps_allocated; #endif if (w_ptr) @@ -1375,7 +1375,7 @@ load_color (struct frame *f, struct face *face, Lisp_Object name, abort (); } } -#if GLYPH_DEBUG +#ifdef GLYPH_DEBUG else ++ncolors_allocated; #endif @@ -1855,7 +1855,6 @@ the WIDTH times as wide as FACE on FRAME. */) #define LFACE_INHERIT(LFACE) AREF ((LFACE), LFACE_INHERIT_INDEX) #define LFACE_FONTSET(LFACE) AREF ((LFACE), LFACE_FONTSET_INDEX) -#ifdef ENABLE_CHECKING /* Non-zero if LFACE is a Lisp face. A Lisp face is a vector of size LFACE_VECTOR_SIZE which has the symbol `face' in slot 0. */ @@ -1863,10 +1862,9 @@ the WIDTH times as wide as FACE on FRAME. */) (VECTORP (LFACE) \ && ASIZE (LFACE) == LFACE_VECTOR_SIZE \ && EQ (AREF (LFACE, 0), Qface)) -#endif -#if GLYPH_DEBUG +#ifdef GLYPH_DEBUG /* Check consistency of Lisp face attribute vector ATTRS. */ @@ -1953,12 +1951,12 @@ check_lface (Lisp_Object lface) } } -#else /* GLYPH_DEBUG == 0 */ +#else /* not GLYPH_DEBUG */ #define check_lface_attrs(attrs) (void) 0 #define check_lface(lface) (void) 0 -#endif /* GLYPH_DEBUG == 0 */ +#endif /* GLYPH_DEBUG */ @@ -4461,7 +4459,7 @@ cache_face (struct face_cache *c, struct face *face, unsigned int hash) break; face->id = i; -#if GLYPH_DEBUG +#ifdef GLYPH_DEBUG /* Check that FACE got a unique id. */ { int j, n; @@ -4547,7 +4545,7 @@ lookup_face (struct frame *f, Lisp_Object *attr) if (face == NULL) face = realize_face (cache, attr, -1); -#if GLYPH_DEBUG +#ifdef GLYPH_DEBUG eassert (face == FACE_FROM_ID (f, face->id)); #endif /* GLYPH_DEBUG */ @@ -6450,7 +6448,7 @@ where R,G,B are numbers between 0 and 255 and name is an arbitrary string. */) Tests ***********************************************************************/ -#if GLYPH_DEBUG +#ifdef GLYPH_DEBUG /* Print the contents of the realized face FACE to stderr. */ @@ -6525,7 +6523,7 @@ DEFUN ("show-face-resources", Fshow_face_resources, Sshow_face_resources, return Qnil; } -#endif /* GLYPH_DEBUG != 0 */ +#endif /* GLYPH_DEBUG */ @@ -6649,7 +6647,7 @@ syms_of_xfaces (void) defsubr (&Sinternal_set_alternative_font_family_alist); defsubr (&Sinternal_set_alternative_font_registry_alist); defsubr (&Sface_attributes_as_vector); -#if GLYPH_DEBUG +#ifdef GLYPH_DEBUG defsubr (&Sdump_face); defsubr (&Sshow_face_resources); #endif /* GLYPH_DEBUG */ diff --git a/src/xfns.c b/src/xfns.c index 00cf9f8e081..13c7070e229 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -136,7 +136,7 @@ static Lisp_Object Qundefined_color; static Lisp_Object Qcompound_text, Qcancel_timer; Lisp_Object Qfont_param; -#if GLYPH_DEBUG +#ifdef GLYPH_DEBUG static ptrdiff_t image_cache_refcount; static int dpyinfo_refcount; #endif @@ -2914,14 +2914,14 @@ unwind_create_frame (Lisp_Object frame) /* If frame is ``official'', nothing to do. */ if (NILP (Fmemq (frame, Vframe_list))) { -#if GLYPH_DEBUG && defined ENABLE_CHECKING +#if defined GLYPH_DEBUG && defined ENABLE_CHECKING struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f); #endif x_free_frame_resources (f); free_glyphs (f); -#if GLYPH_DEBUG +#if defined GLYPH_DEBUG && defined ENABLE_CHECKING /* Check that reference counts are indeed correct. */ eassert (dpyinfo->reference_count == dpyinfo_refcount); eassert (dpyinfo->terminal->image_cache->refcount == image_cache_refcount); @@ -3296,7 +3296,7 @@ This function is an internal primitive--use `make-frame' instead. */) "scrollBarBackground", "ScrollBarBackground", 0); -#if GLYPH_DEBUG +#ifdef GLYPH_DEBUG image_cache_refcount = FRAME_IMAGE_CACHE (f) ? FRAME_IMAGE_CACHE (f)->refcount : 0; dpyinfo_refcount = dpyinfo->reference_count; @@ -4730,7 +4730,7 @@ x_create_tip_frame (struct x_display_info *dpyinfo, x_default_parameter (f, parms, Qborder_color, build_string ("black"), "borderColor", "BorderColor", RES_TYPE_STRING); -#if GLYPH_DEBUG +#ifdef GLYPH_DEBUG image_cache_refcount = FRAME_IMAGE_CACHE (f) ? FRAME_IMAGE_CACHE (f)->refcount : 0; dpyinfo_refcount = dpyinfo->reference_count; diff --git a/src/xterm.c b/src/xterm.c index 8e978edf7d9..846aedc0f5b 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -931,7 +931,7 @@ static void x_draw_box_rect (struct glyph_string *, int, int, int, int, int, int, int, XRectangle *); static void x_scroll_bar_clear (struct frame *); -#if GLYPH_DEBUG +#ifdef GLYPH_DEBUG static void x_check_font (struct frame *, struct font *); #endif @@ -9801,7 +9801,7 @@ x_wm_set_icon_position (struct frame *f, int icon_x, int icon_y) Fonts ***********************************************************************/ -#if GLYPH_DEBUG +#ifdef GLYPH_DEBUG /* Check that FONT is valid on frame F. It is if it can be found in F's font table. */ @@ -9814,7 +9814,7 @@ x_check_font (struct frame *f, struct font *font) eassert (font->driver->check (f, font) == 0); } -#endif /* GLYPH_DEBUG != 0 */ +#endif /* GLYPH_DEBUG */ /*********************************************************************** -- 2.39.2