Tolerate DOS-style EOL in IDL line comments If an IDL file uses DOS-style EOLs (CR+LF), line comments need to ignore the second linebreak character, otherwise, as is currently the case, the parsed documentation comment includes a trailing `\r` character, which is then output verbatim into the output source code by flatc. Change-Id: I39591631995a980622d20a4a32315178b33f18f6
diff --git a/src/idl_parser.cpp b/src/idl_parser.cpp index f520c76..9cc99d6 100644 --- a/src/idl_parser.cpp +++ b/src/idl_parser.cpp
@@ -186,7 +186,7 @@ case '/': if (*cursor_ == '/') { const char *start = ++cursor_; - while (*cursor_ && *cursor_ != '\n') cursor_++; + while (*cursor_ && *cursor_ != '\n' && *cursor_ != '\r') cursor_++; if (*start == '/') { // documentation comment if (cursor_ != source_ && !seen_newline) Error("a documentation comment should be on a line on its own");