gcc/libcpp
David Malcolm bbd6fcf320 Provide location information for terminator characters (PR preprocessor/77672)
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
2016-09-23 14:14:52 +00:00
..
include Add from_macro_definition_at predicate for locations. 2016-09-21 15:59:29 -04:00
po Regenerate .pot files. 2016-08-19 22:06:53 +01:00
ChangeLog Provide location information for terminator characters (PR preprocessor/77672) 2016-09-23 14:14:52 +00:00
ChangeLog.jit Merger of dmalcolm/jit branch from git 2014-11-11 21:55:52 +00:00
Makefile.in Update copyright years. 2016-01-04 15:30:50 +01:00
aclocal.m4 libcpp: Bump to automake 1.11.6 2015-05-13 11:02:17 +00:00
charset.c Provide location information for terminator characters (PR preprocessor/77672) 2016-09-23 14:14:52 +00:00
config.in Change ENABLE_VALGRIND_CHECKING to 2016-05-20 08:03:25 +00:00
configure Change ENABLE_VALGRIND_CHECKING to 2016-05-20 08:03:25 +00:00
configure.ac Change ENABLE_VALGRIND_CHECKING to 2016-05-20 08:03:25 +00:00
directives-only.c Update copyright years. 2016-01-04 15:30:50 +01:00
directives.c Spelling suggestions for misspelled preprocessor directives 2016-08-18 18:52:43 +00:00
errors.c Spelling suggestions for misspelled preprocessor directives 2016-08-18 18:52:43 +00:00
expr.c Implement C _FloatN, _FloatNx types. 2016-08-19 18:43:26 +01:00
files.c libcpp: Tweak to missing #include source location 2016-06-22 15:29:21 +00:00
identifiers.c Update copyright years. 2016-01-04 15:30:50 +01:00
init.c libcpp: Tweak to missing #include source location 2016-06-22 15:29:21 +00:00
internal.h On-demand locations within string-literals 2016-08-05 18:08:33 +00:00
lex.c re PR c/7652 (-Wswitch-break : Warn if a switch case falls through) 2016-08-12 10:30:47 +00:00
line-map.c Add from_macro_definition_at predicate for locations. 2016-09-21 15:59:29 -04:00
location-example.txt Source range tracking in libcpp and C FE, with bit-packing optimization 2015-11-13 16:29:59 +00:00
macro.c re PR c/7652 (-Wswitch-break : Warn if a switch case falls through) 2016-08-12 10:30:47 +00:00
makeucnid.c Update copyright years. 2016-01-04 15:30:50 +01:00
mkdeps.c Update copyright years. 2016-01-04 15:30:50 +01:00
pch.c re PR c/7652 (-Wswitch-break : Warn if a switch case falls through) 2016-08-18 10:28:03 +00:00
symtab.c Update copyright years. 2016-01-04 15:30:50 +01:00
system.h Update copyright years. 2016-01-04 15:30:50 +01:00
traditional.c Update copyright years. 2016-01-04 15:30:50 +01:00
ucnid.h Update copyright years. 2016-01-04 15:30:50 +01:00
ucnid.tab Update copyright years. 2016-01-04 15:30:50 +01:00