diff options
author | David Malcolm <dmalcolm@redhat.com> | 2016-11-17 15:55:26 +0000 |
---|---|---|
committer | David Malcolm <dmalcolm@gcc.gnu.org> | 2016-11-17 15:55:26 +0000 |
commit | b8f564124ed51964b704452e3ea05b2423446e1c (patch) | |
tree | c847c4257bce9fb3b4aec31453d07ca3f78bf42f /libcpp/ChangeLog | |
parent | 141a3ccff1f53ca8a86453fbe4eaa1bc6b64d920 (diff) | |
download | gcc-b8f564124ed51964b704452e3ea05b2423446e1c.zip gcc-b8f564124ed51964b704452e3ea05b2423446e1c.tar.gz gcc-b8f564124ed51964b704452e3ea05b2423446e1c.tar.bz2 |
Fix locations within raw strings
Whilst investigating PR preprocessor/78324 I noticed that the
substring location code currently doesn't handle raw strings
correctly, by not skipping the 'R', opening quote, delimiter
and opening parenthesis.
For example, an attempt to underline chars 4-7 with caret at 6 of
this raw string yields this erroneous output:
__emit_string_literal_range (R"foo(0123456789)foo",
~~^~
With the patch, the correct range/caret is printed:
__emit_string_literal_range (R"foo(0123456789)foo",
~~^~
gcc/ChangeLog:
* input.c (selftest::test_lexer_string_locations_long_line): New
function.
(selftest::test_lexer_string_locations_raw_string_multiline): New
function.
(selftest::input_c_tests): Call the new functions, via
for_each_line_table_case.
gcc/testsuite/ChangeLog:
* gcc.dg/plugin/diagnostic-test-string-literals-1.c
(test_raw_string_one_liner): New function.
(test_raw_string_multiline): New function.
libcpp/ChangeLog:
* charset.c (cpp_interpret_string_1): Skip locations from
loc_reader when advancing 'p' when handling raw strings.
From-SVN: r242552
Diffstat (limited to 'libcpp/ChangeLog')
-rw-r--r-- | libcpp/ChangeLog | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/libcpp/ChangeLog b/libcpp/ChangeLog index 7690b5d..6b92807 100644 --- a/libcpp/ChangeLog +++ b/libcpp/ChangeLog @@ -1,3 +1,8 @@ +2016-11-17 David Malcolm <dmalcolm@redhat.com> + + * charset.c (cpp_interpret_string_1): Skip locations from + loc_reader when advancing 'p' when handling raw strings. + 2016-11-16 Jakub Jelinek <jakub@redhat.com> PR bootstrap/72823 |