From 4b1113880023d404ebb52d7efab934b913ff3284 Mon Sep 17 00:00:00 2001 From: David Malcolm Date: Mon, 2 Nov 2015 15:35:34 -0500 Subject: [PATCH 12/48] Fix nits in diagnostic-show-locus.c gcc/ChangeLog: * diagnostic-show-locus.c (layout::layout): Eliminate call to show_ruler. (layout::get_state_at_point): Eliminate debug code. (show_ruler): Delete. --- gcc/diagnostic-show-locus.c | 51 --------------------------------------------- 1 file changed, 51 deletions(-) diff --git a/gcc/diagnostic-show-locus.c b/gcc/diagnostic-show-locus.c index 97f2853..22203cd 100644 --- a/gcc/diagnostic-show-locus.c +++ b/gcc/diagnostic-show-locus.c @@ -36,9 +36,6 @@ along with GCC; see the file COPYING3. If not see # include #endif -static void -show_ruler (diagnostic_context *context, int max_width, int x_offset); - /* Classes for rendering source code and diagnostics, within an anonymous namespace. The work is done by "class layout", which embeds and uses @@ -483,9 +480,6 @@ layout::layout (diagnostic_context * context, m_x_offset = column - right_margin; gcc_assert (m_x_offset >= 0); } - - if (0) - show_ruler (context, line_width, m_x_offset); } /* Attempt to print line ROW of source code, potentially colorized at any @@ -615,17 +609,6 @@ layout::get_state_at_point (/* Inputs. */ int i; FOR_EACH_VEC_ELT (m_layout_ranges, i, range) { - if (0) - fprintf (stderr, - "range ( (%i, %i), (%i, %i))->contains_point (%i, %i): %s\n", - range->m_start.m_line, - range->m_start.m_column, - range->m_finish.m_line, - range->m_finish.m_column, - row, - column, - range->contains_point (row, column) ? "true" : "false"); - if (range->contains_point (row, column)) { out_state->range_idx = i; @@ -694,40 +677,6 @@ layout::get_x_bound_for_row (int row, int caret_column, } /* End of anonymous namespace. */ -/* For debugging layout issues in diagnostic_show_locus and friends, - render a ruler giving column numbers (after the 1-column indent). */ - -static void -show_ruler (diagnostic_context *context, int max_width, int x_offset) -{ - /* Hundreds. */ - if (max_width > 99) - { - pp_space (context->printer); - for (int column = 1 + x_offset; column < max_width; column++) - if (0 == column % 10) - pp_character (context->printer, '0' + (column / 100) % 10); - else - pp_space (context->printer); - pp_newline (context->printer); - } - - /* Tens. */ - pp_space (context->printer); - for (int column = 1 + x_offset; column < max_width; column++) - if (0 == column % 10) - pp_character (context->printer, '0' + (column / 10) % 10); - else - pp_space (context->printer); - pp_newline (context->printer); - - /* Units. */ - pp_space (context->printer); - for (int column = 1 + x_offset; column < max_width; column++) - pp_character (context->printer, '0' + (column % 10)); - pp_newline (context->printer); -} - /* Print the physical source code corresponding to the location of this diagnostic, with additional annotations. */ -- 1.8.5.3