]> gcc.gnu.org Git - gcc.git/commit
lex: accept zero codepoints in strings
authorMark Wielaard <mark@klomp.org>
Sat, 7 Aug 2021 15:32:41 +0000 (17:32 +0200)
committerMark Wielaard <mark@klomp.org>
Sun, 8 Aug 2021 12:57:25 +0000 (14:57 +0200)
commit007e6ecefb0b43d0b9e7bf85f75ec050b5c520e5
tree2b6a956ccd18a9c4671d38c78bb6b29bdcde5a54
parent41e3fb5d2018690243a38c79a60fcc32eb73b013
lex: accept zero codepoints in strings

Zero characters (codepoints) are acceptable in strings. The current
Lexer::parse_string skipped such zero codepoints by accidents. The
zero codepoint was also used as error/skip indicator, but that is only
true if the third argument of utf8_escape_pair is true (yes, it is
called pair, but is a triple).

Add a testcase that checks the (sub)strings are separated by zero
chars. Since we cannot slice strings yet this uses extern "C"
functions, printf and memchr.
gcc/rust/lex/rust-lex.cc
gcc/testsuite/rust/execute/torture/str-zero.rs [new file with mode: 0644]
This page took 0.057318 seconds and 5 git commands to generate.