Fixed #4308 (C++11 raw string literals not parsed correctly)
This commit is contained in:
parent
5f8496407f
commit
45b77554ea
|
@ -559,8 +559,6 @@ std::string Preprocessor::removeComments(const std::string &str, const std::stri
|
|||
} else if (std::iscntrl((unsigned char)str[p]) ||
|
||||
std::isspace((unsigned char)str[p])) {
|
||||
code << " ";
|
||||
} else if (str[p] == '\\') {
|
||||
code << "\\";
|
||||
} else if (str[p] == '\"' || str[p] == '\'') {
|
||||
code << "\\" << (char)str[p];
|
||||
} else {
|
||||
|
@ -570,7 +568,7 @@ std::string Preprocessor::removeComments(const std::string &str, const std::stri
|
|||
code << "\"";
|
||||
if (rawstringnewlines > 0)
|
||||
code << std::string(rawstringnewlines, '\n');
|
||||
i = endpos + delim.size() + 2;
|
||||
i = endpos + delim.size() + 1;
|
||||
} else {
|
||||
code << "R";
|
||||
previous = 'R';
|
||||
|
|
|
@ -66,7 +66,7 @@ private:
|
|||
void run() {
|
||||
// Just read the code into a string. Perform simple cleanup of the code
|
||||
TEST_CASE(readCode1);
|
||||
TEST_CASE(readCode2);
|
||||
TEST_CASE(readCode2); // #4308 - convert C++11 raw string to plain old C string
|
||||
TEST_CASE(readCode3);
|
||||
|
||||
// reading utf-16 file
|
||||
|
@ -298,12 +298,12 @@ private:
|
|||
}
|
||||
|
||||
void readCode2() {
|
||||
const char code[] = "R\"( \" /* abc */ \n)\"";
|
||||
const char code[] = "R\"( \" /* abc */ \n)\";";
|
||||
Settings settings;
|
||||
Preprocessor preprocessor(&settings, this);
|
||||
std::istringstream istr(code);
|
||||
std::string codestr(preprocessor.read(istr,"test.c"));
|
||||
ASSERT_EQUALS("\" \\\" /* abc */ \\n\"\n", codestr);
|
||||
ASSERT_EQUALS("\" \\\" /* abc */ \\n\"\n;", codestr);
|
||||
}
|
||||
|
||||
void readCode3() {
|
||||
|
|
Loading…
Reference in New Issue