gcc/contrib
Lewis Hyatt ee9256409f Byte vs column awareness for diagnostic-show-locus.c (PR 49973)
contrib/ChangeLog

2019-12-09  Lewis Hyatt  <lhyatt@gmail.com>

	PR preprocessor/49973
	* unicode/from_glibc/unicode_utils.py: Support script from
	glibc (commit 464cd3) to extract character widths from Unicode data
	files.
	* unicode/from_glibc/utf8_gen.py: Likewise.
	* unicode/UnicodeData.txt: Unicode v. 12.1.0 data file.
	* unicode/EastAsianWidth.txt: Likewise.
	* unicode/PropList.txt: Likewise.
	* unicode/gen_wcwidth.py: New utility to generate
	libcpp/generated_cpp_wcwidth.h with help from the glibc support
	scripts and the Unicode data files.
	* unicode/unicode-license.txt: Added.
	* unicode/README: New explanatory file.

libcpp/ChangeLog

2019-12-09  Lewis Hyatt  <lhyatt@gmail.com>

	PR preprocessor/49973
	* generated_cpp_wcwidth.h: New file generated by
	../contrib/unicode/gen_wcwidth.py, supports new cpp_wcwidth function.
	* charset.c (compute_next_display_width): New function to help
	implement display columns.
	(cpp_byte_column_to_display_column): Likewise.
	(cpp_display_column_to_byte_column): Likewise.
	(cpp_wcwidth): Likewise.
	* include/cpplib.h (cpp_byte_column_to_display_column): Declare.
	(cpp_display_column_to_byte_column): Declare.
	(cpp_wcwidth): Declare.
	(cpp_display_width): New function.

gcc/ChangeLog

2019-12-09  Lewis Hyatt  <lhyatt@gmail.com>

	PR preprocessor/49973
	* input.c (location_compute_display_column): New function to help with
	multibyte awareness in diagnostics.
	(test_cpp_utf8): New self-test.
	(input_c_tests): Call the new test.
	* input.h (location_compute_display_column): Declare.
	* diagnostic-show-locus.c: Pervasive changes to add multibyte awareness
	to all classes and functions.
	(enum column_unit): New enum.
	(class exploc_with_display_col): New class.
	(class layout_point): Convert m_column member to array m_columns[2].
	(layout_range::contains_point): Add col_unit argument.
	(test_layout_range_for_single_point): Pass new argument.
	(test_layout_range_for_single_line): Likewise.
	(test_layout_range_for_multiple_lines): Likewise.
	(line_bounds::convert_to_display_cols): New function.
	(layout::get_state_at_point): Add col_unit argument.
	(make_range): Use empty filename rather than dummy filename.
	(get_line_width_without_trailing_whitespace): Rename to...
	(get_line_bytes_without_trailing_whitespace): ...this.
	(test_get_line_width_without_trailing_whitespace): Rename to...
	(test_get_line_bytes_without_trailing_whitespace): ...this.
	(class layout): m_exploc changed to exploc_with_display_col from
	plain expanded_location.
	(layout::get_linenum_width): New accessor member function.
	(layout::get_x_offset_display): Likewise.
	(layout::calculate_linenum_width): New subroutine for the constuctor.
	(layout::calculate_x_offset_display): Likewise.
	(layout::layout): Use the new subroutines. Add multibyte awareness.
	(layout::print_source_line): Add multibyte awareness.
	(layout::print_line): Likewise.
	(layout::print_annotation_line): Likewise.
	(line_label::line_label): Likewise.
	(layout::print_any_labels): Likewise.
	(layout::annotation_line_showed_range_p): Likewise.
	(get_printed_columns): Likewise.
	(class line_label): Rename m_length to m_display_width.
	(get_affected_columns): Rename to...
	(get_affected_range): ...this; add col_unit argument and multibyte
	awareness.
	(class correction): Add m_affected_bytes and m_display_cols
	members.  Rename m_len to m_byte_length for clarity.  Add multibyte
	awareness throughout.
	(correction::insertion_p): Add multibyte awareness.
	(correction::compute_display_cols): New function.
	(correction::ensure_terminated): Use new member name m_byte_length.
	(line_corrections::add_hint): Add multibyte awareness.
	(layout::print_trailing_fixits): Likewise.
	(layout::get_x_bound_for_row): Likewise.
	(test_one_liner_simple_caret_utf8): New self-test analogous to the one
	with _utf8 suffix removed, testing multibyte awareness.
	(test_one_liner_caret_and_range_utf8): Likewise.
	(test_one_liner_multiple_carets_and_ranges_utf8): Likewise.
	(test_one_liner_fixit_insert_before_utf8): Likewise.
	(test_one_liner_fixit_insert_after_utf8): Likewise.
	(test_one_liner_fixit_remove_utf8): Likewise.
	(test_one_liner_fixit_replace_utf8): Likewise.
	(test_one_liner_fixit_replace_non_equal_range_utf8): Likewise.
	(test_one_liner_fixit_replace_equal_secondary_range_utf8): Likewise.
	(test_one_liner_fixit_validation_adhoc_locations_utf8): Likewise.
	(test_one_liner_many_fixits_1_utf8): Likewise.
	(test_one_liner_many_fixits_2_utf8): Likewise.
	(test_one_liner_labels_utf8): Likewise.
	(test_diagnostic_show_locus_one_liner_utf8): Likewise.
	(test_overlapped_fixit_printing_utf8): Likewise.
	(test_overlapped_fixit_printing): Adapt for changes to
	get_affected_columns, get_printed_columns and class corrections.
	(test_overlapped_fixit_printing_2): Likewise.
	(test_linenum_sep): New constant.
	(test_left_margin): Likewise.
	(test_offset_impl): Helper function for new test.
	(test_layout_x_offset_display_utf8): New test.
	(diagnostic_show_locus_c_tests): Call new tests.

gcc/testsuite/ChangeLog:

2019-12-09  Lewis Hyatt  <lhyatt@gmail.com>

	PR preprocessor/49973
	* gcc.dg/plugin/diagnostic_plugin_test_show_locus.c
	(test_show_locus): Tweak so that expected output is the same as
	before the diagnostic-show-locus.c changes.
	* gcc.dg/cpp/pr66415-1.c: Likewise.

From-SVN: r279137
2019-12-09 20:03:47 +00:00
..
header-tools Remove Cell Broadband Engine SPU targets 2019-09-03 15:08:28 +00:00
reghunt Remove svn:executable property from a couple of text files 2019-01-12 01:20:04 +01:00
regression
testsuite-management
unicode Byte vs column awareness for diagnostic-show-locus.c (PR 49973) 2019-12-09 20:03:47 +00:00
vim-gcc-dev contrib/vimrc: override formatting options for more files 2019-09-02 15:30:02 +03:00
analyze_brprob_spec.py Compare predictor values with these defined in predict.def. 2017-05-30 07:16:31 +00:00
analyze_brprob.py Fix usage of analyze_brprob.py script. 2018-01-19 12:03:24 +00:00
bench-stringop Add new micro-benchmark for string operations. 2019-06-19 07:24:02 +00:00
ChangeLog Byte vs column awareness for diagnostic-show-locus.c (PR 49973) 2019-12-09 20:03:47 +00:00
ChangeLog.jit
ChangeLog.tree-ssa
check_GNU_style_lib.py Detect mixed usage of spaces and tabs. 2018-11-19 08:08:28 +00:00
check_GNU_style.py check_GNU_style.py: Read stdin if file argument is '-' 2017-05-29 07:31:02 +00:00
check_GNU_style.sh
check_makefile_deps.sh
check_warning_flags.sh
check-internal-format-escaping.py * check-internal-format-escaping.py: New version using polib. 2019-04-30 10:14:40 -06:00
check-params-in-docs.py Ignore a param in check-params-in-docs.py 2019-03-06 10:00:37 +00:00
clang-format Tweak clang-format configuration. 2019-09-18 13:32:25 +00:00
compare_tests [contrib] compare_tests: Print number of tests 2018-07-12 20:18:41 +02:00
compare_two_ftime_report_sets
compare-all-tests Remove Cell Broadband Engine SPU targets 2019-09-03 15:08:28 +00:00
compare-debug
compare-lto re PR bootstrap/85571 (non-bootstrap-debug miscompare with trunk) 2018-05-08 08:50:33 +00:00
compareSumTests3
config-list.mk GCC port for eBPF 2019-09-09 12:13:23 +02:00
dg-cmp-results.sh dg-cmp-results: display NA->FAIL & NA->UNRESOLVED by default 2018-10-25 10:35:21 +00:00
dg-extract-results.py contrib: Add KPASS support to dg-extract-results.{sh,py} 2019-10-21 13:41:29 +01:00
dg-extract-results.sh contrib: Add KPASS support to dg-extract-results.{sh,py} 2019-10-21 13:41:29 +01:00
dglib.pm
download_prerequisites download_prerequisites: Use http instead of ftp for downloading. 2019-11-13 19:48:52 +02:00
filter_gcc_for_doxygen Doxygen: add default location for filters and output folder. 2017-06-28 07:52:46 +00:00
filter_knr2ansi.pl
filter_params.py Doxygen: transform ENUM_BITFIELD and comments starting with '/**'. 2017-05-31 14:08:36 +00:00
filter-clang-warnings.py Transform filter-rtags-warnings to filter-clang-warnings. 2019-06-25 12:30:19 +00:00
gcc_build
gcc_update Handle libphobos in contrib/gcc_update 2018-11-14 17:09:09 +00:00
gcc.doxy Doxygen: add default location for filters and output folder. 2017-06-28 07:52:46 +00:00
gen_autofdo_event.py
gennews * gennews (files): Add files for GCC 9. 2019-05-03 09:40:10 +02:00
gthr_supp_vxw_5x.c
index-prop
jit-coverage-report.py
maintainers-verify.sh [contrib] Add contrib/maintainers-verify.sh 2018-07-13 09:33:40 +00:00
make_sunver.pl
make-obstacks-texi.pl
mark_spam.py
mklog Make mklog more robust. 2019-11-08 08:39:17 +00:00
mklog.pl Renamed original mklog to mklog.pl. 2017-08-02 20:58:23 +00:00
paranoia.cc
patch_tester.sh
prepare_patch.sh
prerequisites.md5 Update checksums for isl-0.18.tar.bz2 2017-09-18 11:25:13 +00:00
prerequisites.sha512 Update checksums for isl-0.18.tar.bz2 2017-09-18 11:25:13 +00:00
repro_fail
test_installed
test_recheck
test_summary test_summary: Do not escape "=". 2019-08-13 17:17:49 +02:00
texi2pod.pl Fix @multitable handling in texi2pod.pl 2019-12-07 09:57:04 +00:00
uninclude
unused_functions.py contrib: unused_functions.py: Handle archives 2018-10-05 00:28:18 +02:00
update-copyright.py * update-copyright.py: Add Gerard Jungman as external author. 2019-01-01 13:20:46 +01:00
vimrc contrib/vimrc: override formatting options for more files 2019-09-02 15:30:02 +03:00
warn_summary Respect TMPDIR in contrib scripts. 2018-02-19 08:03:17 +00:00