substring_loc::get_location currently fails for the final terminator character in a STRING_CST from the C frontend, so that format_warning_va falls back to using the location of the string as a whole. This patch tweaks things [1] so that we use the final closing quote as the location of the terminator character, as requested in PR preprocessor/77672. [1] specifically, cpp_interpret_string_1. gcc/ChangeLog: PR preprocessor/77672 * input.c (selftest::test_lexer_string_locations_simple): Update test to expect location information of the terminator character at the location of the final closing quote. (selftest::test_lexer_string_locations_hex): Likewise. (selftest::test_lexer_string_locations_oct): Likewise. (selftest::test_lexer_string_locations_letter_escape_1): Likewise. (selftest::test_lexer_string_locations_letter_escape_2): Likewise. (selftest::test_lexer_string_locations_ucn4): Likewise. (selftest::test_lexer_string_locations_ucn8): Likewise. (selftest::test_lexer_string_locations_u8): Likewise. (selftest::test_lexer_string_locations_utf8_source): Likewise. (selftest::test_lexer_string_locations_concatenation_1): Likewise. (selftest::test_lexer_string_locations_concatenation_2): Likewise. (selftest::test_lexer_string_locations_concatenation_3): Likewise. (selftest::test_lexer_string_locations_macro): Likewise. (selftest::test_lexer_string_locations_long_line): Likewise. gcc/testsuite/ChangeLog: PR preprocessor/77672 * gcc.dg/plugin/diagnostic-test-string-literals-1.c (test_terminator_location): New function. libcpp/ChangeLog: PR preprocessor/77672 * charset.c (cpp_interpret_string_1): Add a source_range for the NUL-terminator, using the location of the trailing quote of the final string. From-SVN: r240434
Name |
Last commit
|
Last update |
---|---|---|
.. | ||
diagnostic-test-expressions-1.c | Loading commit data... | |
diagnostic-test-show-locus-bw.c | Loading commit data... | |
diagnostic-test-show-locus-color.c | Loading commit data... | |
diagnostic-test-show-locus-generate-patch.c | Loading commit data... | |
diagnostic-test-show-locus-parseable-fixits.c | Loading commit data... | |
diagnostic-test-show-trees-1.c | Loading commit data... | |
diagnostic-test-string-literals-1.c | Loading commit data... | |
diagnostic-test-string-literals-2.c | Loading commit data... | |
diagnostic_plugin_show_trees.c | Loading commit data... | |
diagnostic_plugin_test_show_locus.c | Loading commit data... | |
diagnostic_plugin_test_string_literals.c | Loading commit data... | |
diagnostic_plugin_test_tree_expression_range.c | Loading commit data... | |
finish_unit-test-1.c | Loading commit data... | |
finish_unit_plugin.c | Loading commit data... | |
ggcplug-test-1.c | Loading commit data... | |
ggcplug.c | Loading commit data... | |
location-overflow-test-1.c | Loading commit data... | |
location-overflow-test-2.c | Loading commit data... | |
location_overflow_plugin.c | Loading commit data... | |
must-tail-call-1.c | Loading commit data... | |
must-tail-call-2.c | Loading commit data... | |
must_tail_call_plugin.c | Loading commit data... | |
one_time-test-1.c | Loading commit data... | |
one_time_plugin.c | Loading commit data... | |
plugin.exp | Loading commit data... | |
plugindir1.c | Loading commit data... | |
plugindir2.c | Loading commit data... | |
plugindir3.c | Loading commit data... | |
plugindir4.c | Loading commit data... | |
self-assign-test-1.c | Loading commit data... | |
self-assign-test-2.c | Loading commit data... | |
selfassign.c | Loading commit data... | |
start_unit-test-1.c | Loading commit data... | |
start_unit_plugin.c | Loading commit data... | |
wide-int-test-1.c | Loading commit data... | |
wide-int_plugin.c | Loading commit data... |