system/corennnnn
修訂 | 5a5b16cf7f3eb6845815be60f7bdc4c2bcf896a3 (tree) |
---|---|
時間 | 2009-06-13 05:17:04 |
作者 | Android (Google) Code Review <android-gerrit@goog...> |
Commiter | Android (Google) Code Review |
Merge change 4084
* changes:
@@ -1995,18 +1995,21 @@ class Compiler : public ErrorSink { | ||
1995 | 1995 | } |
1996 | 1996 | } else if ((tok == '/') & (ch == '*')) { |
1997 | 1997 | inp(); |
1998 | - while (ch) { | |
1999 | - while (ch != '*') | |
1998 | + while (ch && ch != EOF) { | |
1999 | + while (ch != '*' && ch != EOF) | |
2000 | 2000 | inp(); |
2001 | 2001 | inp(); |
2002 | 2002 | if (ch == '/') |
2003 | 2003 | ch = 0; |
2004 | 2004 | } |
2005 | + if (ch == EOF) { | |
2006 | + error("End of file inside comment."); | |
2007 | + } | |
2005 | 2008 | inp(); |
2006 | 2009 | next(); |
2007 | 2010 | } else if ((tok == '/') & (ch == '/')) { |
2008 | 2011 | inp(); |
2009 | - while (ch && (ch != '\n')) { | |
2012 | + while (ch && (ch != '\n') && (ch != EOF)) { | |
2010 | 2013 | inp(); |
2011 | 2014 | } |
2012 | 2015 | inp(); |
@@ -2489,7 +2492,7 @@ class Compiler : public ErrorSink { | ||
2489 | 2492 | Type base; |
2490 | 2493 | |
2491 | 2494 | while (acceptType(base)) { |
2492 | - while (tok != ';') { | |
2495 | + while (tok != ';' && tok != EOF) { | |
2493 | 2496 | Type t = acceptPointerDeclaration(t); |
2494 | 2497 | addLocalSymbol(); |
2495 | 2498 | if (tok) { |