aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2015-04-11 00:50:26 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2015-04-11 00:50:26 +0000
commit055da6a8dfc48dae017dd17bdabaeabf57bec3d7 (patch)
tree3ade4eae59acb77f649ea9e957c159e9d1050333
parentb025e2920ee9f2a83db0566ee169dc8a750785b7 (diff)
downloadgcc-055da6a8dfc48dae017dd17bdabaeabf57bec3d7.zip
gcc-055da6a8dfc48dae017dd17bdabaeabf57bec3d7.tar.gz
gcc-055da6a8dfc48dae017dd17bdabaeabf57bec3d7.tar.bz2
compiler: discard carriage returns in raw string literals
Fixes golang/go#10407. From-SVN: r222001
-rw-r--r--gcc/go/gofrontend/lex.cc5
1 files changed, 4 insertions, 1 deletions
diff --git a/gcc/go/gofrontend/lex.cc b/gcc/go/gofrontend/lex.cc
index 3404ced..aa7071d 100644
--- a/gcc/go/gofrontend/lex.cc
+++ b/gcc/go/gofrontend/lex.cc
@@ -1440,7 +1440,10 @@ Lex::gather_raw_string()
bool issued_error;
this->lineoff_ = p - this->linebuf_;
p = this->advance_one_utf8_char(p, &c, &issued_error);
- Lex::append_char(c, true, &value, loc);
+ // "Carriage return characters ('\r') inside raw string literals
+ // are discarded from the raw string value."
+ if (c != '\r')
+ Lex::append_char(c, true, &value, loc);
}
this->lineoff_ = p - this->linebuf_;
if (!this->require_line())