https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108973
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org --- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Wrapping tests individually for each possible $COLUMNS case would be a maintainance nightmare, e.g. trying to make it work with COLUNMS in [30, 41] inclusive means: --- gcc/diagnostic-show-locus.cc.jj 2023-01-02 09:32:39.783033909 +0100 +++ gcc/diagnostic-show-locus.cc 2023-03-02 09:45:42.432403239 +0100 @@ -4436,7 +4436,7 @@ test_add_location_if_nearby (const line_ /* Test of add_location_if_nearby on the same line as the primary location. */ - { + if (get_terminal_width () > 41) { const location_t missing_close_brace_1_39 = linemap_position_for_line_and_column (line_table, ord_map, 1, 39); const location_t matching_open_brace_1_18 @@ -4501,7 +4501,7 @@ test_diagnostic_show_locus_fixit_lines ( /* A pair of tests for modernizing the initializers to C99-style. */ /* The one-liner case (line 2). */ - { + if (get_terminal_width () > 31) { test_diagnostic_context dc; const location_t x = linemap_position_for_line_and_column (line_table, ord_map, 2, 24); @@ -4521,7 +4521,7 @@ test_diagnostic_show_locus_fixit_lines ( verify that insertion fixit on line 3 is still printed (and that span starts are printed due to the gap between the span at line 3 and that at line 6). */ - { + if (get_terminal_width () > 34) { test_diagnostic_context dc; const location_t y = linemap_position_for_line_and_column (line_table, ord_map, 3, 24); @@ -4543,7 +4543,7 @@ test_diagnostic_show_locus_fixit_lines ( /* As above, but verify the behavior of multiple line spans with line-numbering enabled. */ - { + if (get_terminal_width () > 40) { const location_t y = linemap_position_for_line_and_column (line_table, ord_map, 3, 24); const location_t colon @@ -4756,7 +4756,7 @@ test_overlapped_fixit_printing (const li but for which the *printing* may need consolidation. */ /* Example where 3 fix-it hints are printed as one. */ - { + if (get_terminal_width () > 30) { test_diagnostic_context dc; rich_location richloc (line_table, expr); richloc.add_fixit_replace (open_paren, "const_cast<"); @@ -4826,7 +4826,7 @@ test_overlapped_fixit_printing (const li } /* Example where two are consolidated during printing. */ - { + if (get_terminal_width () > 30) { test_diagnostic_context dc; rich_location richloc (line_table, expr); richloc.add_fixit_replace (open_paren, "CAST ("); @@ -4843,7 +4843,7 @@ test_overlapped_fixit_printing (const li } /* Example where none are consolidated during printing. */ - { + if (get_terminal_width () > 30) { test_diagnostic_context dc; rich_location richloc (line_table, expr); richloc.add_fixit_replace (open_paren, "CST ("); @@ -4860,7 +4860,7 @@ test_overlapped_fixit_printing (const li } /* Example of deletion fix-it hints. */ - { + if (get_terminal_width () > 30) { test_diagnostic_context dc; rich_location richloc (line_table, expr); richloc.add_fixit_insert_before (open_paren, "(bar *)"); @@ -4880,7 +4880,7 @@ test_overlapped_fixit_printing (const li } /* Example of deletion fix-it hints that would overlap. */ - { + if (get_terminal_width () > 30) { test_diagnostic_context dc; rich_location richloc (line_table, expr); richloc.add_fixit_insert_before (open_paren, "(longer *)"); @@ -4900,7 +4900,7 @@ test_overlapped_fixit_printing (const li } /* Example of insertion fix-it hints that would overlap. */ - { + if (get_terminal_width () > 30) { test_diagnostic_context dc; rich_location richloc (line_table, expr); richloc.add_fixit_insert_before (open_paren, "LONGER THAN THE CAST"); @@ -4967,7 +4967,7 @@ test_overlapped_fixit_printing_utf8 (con but for which the *printing* may need consolidation. */ /* Example where 3 fix-it hints are printed as one. */ - { + if (get_terminal_width () > 30) { test_diagnostic_context dc; rich_location richloc (line_table, expr); richloc.add_fixit_replace (open_paren, "const_cast<"); @@ -5043,7 +5043,7 @@ test_overlapped_fixit_printing_utf8 (con } /* Example where two are consolidated during printing. */ - { + if (get_terminal_width () > 30) { test_diagnostic_context dc; rich_location richloc (line_table, expr); richloc.add_fixit_replace (open_paren, "CAST ("); @@ -5063,7 +5063,7 @@ test_overlapped_fixit_printing_utf8 (con } /* Example where none are consolidated during printing. */ - { + if (get_terminal_width () > 30) { test_diagnostic_context dc; rich_location richloc (line_table, expr); richloc.add_fixit_replace (open_paren, "CST ("); @@ -5083,7 +5083,7 @@ test_overlapped_fixit_printing_utf8 (con } /* Example of deletion fix-it hints. */ - { + if (get_terminal_width () > 30) { test_diagnostic_context dc; rich_location richloc (line_table, expr); richloc.add_fixit_insert_before (open_paren, "(bar\xf0\x9f\x98\x82 *)"); @@ -5107,7 +5107,7 @@ test_overlapped_fixit_printing_utf8 (con } /* Example of deletion fix-it hints that would overlap. */ - { + if (get_terminal_width () > 30) { test_diagnostic_context dc; rich_location richloc (line_table, expr); richloc.add_fixit_insert_before (open_paren, "(long\xf0\x9f\x98\x82 *)"); @@ -5132,7 +5132,7 @@ test_overlapped_fixit_printing_utf8 (con } /* Example of insertion fix-it hints that would overlap. */ - { + if (get_terminal_width () > 30) { test_diagnostic_context dc; rich_location richloc (line_table, expr); richloc.add_fixit_insert_before @@ -5514,7 +5514,7 @@ test_tab_expansion (const line_table_cas /* Confirm the display width was tracked correctly across the internal tab as well. */ - { + if (get_terminal_width () > 36) { test_diagnostic_context dc; dc.tabstop = tabstop; rich_location richloc (line_table,