diff options
author | Chris Lattner <sabre@nondot.org> | 2008-04-12 05:54:25 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2008-04-12 05:54:25 +0000 |
commit | b25e5d79d9d1967df058a242e96a62d0d0ace074 (patch) | |
tree | 32e8a5b5900d3ccf63b334c6a0ba503bd4c8a59b /lib/Lex/Lexer.cpp | |
parent | 321f278db3405268e8644eb75f4fcf8900e0d09c (diff) |
don't diagnose empty source files, thanks Neil!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49575 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Lex/Lexer.cpp')
-rw-r--r-- | lib/Lex/Lexer.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/Lex/Lexer.cpp b/lib/Lex/Lexer.cpp index e3daf31267..0768e3b474 100644 --- a/lib/Lex/Lexer.cpp +++ b/lib/Lex/Lexer.cpp @@ -1141,8 +1141,9 @@ bool Lexer::LexEndOfFile(Token &Result, const char *CurPtr) { ConditionalStack.pop_back(); } - // If the file was empty or didn't end in a newline, issue a pedwarn. - if (CurPtr == BufferStart || (CurPtr[-1] != '\n' && CurPtr[-1] != '\r')) + // C99 5.1.1.2p2: If the file is non-empty and didn't end in a newline, issue + // a pedwarn. + if (CurPtr != BufferStart && (CurPtr[-1] != '\n' && CurPtr[-1] != '\r')) Diag(BufferEnd, diag::ext_no_newline_eof); BufferPtr = CurPtr; |