From ccf43ca05cb1540f3d95a73b7b329bf926808c7b Mon Sep 17 00:00:00 2001 From: Jordan Rose Date: Wed, 6 Jun 2012 17:25:21 +0000 Subject: Add pedantic warning -Wempty-translation-unit (C11 6.9p1). In standard C since C89, a 'translation-unit' is syntactically defined to have at least one "external-declaration", which is either a decl or a function definition. In Clang the latter gives us a declaration as well. The tricky bit about this warning is that our predefines can contain external declarations (__builtin_va_list and the 128-bit integer types). Therefore our AST parser now makes sure we have at least one declaration that doesn't come from the predefines buffer. Also, remove bogus warning about empty source files. This doesn't catch source files that only contain comments, and never fired anyway because of our predefines. PR12665 and llvm-svn: 158085 --- clang/lib/Parse/Parser.cpp | 4 ---- 1 file changed, 4 deletions(-) (limited to 'clang/lib/Parse/Parser.cpp') diff --git a/clang/lib/Parse/Parser.cpp b/clang/lib/Parse/Parser.cpp index 504071405b7..f0e2b3aa85f 100644 --- a/clang/lib/Parse/Parser.cpp +++ b/clang/lib/Parse/Parser.cpp @@ -439,10 +439,6 @@ void Parser::Initialize() { // Prime the lexer look-ahead. ConsumeToken(); - if (Tok.is(tok::eof) && - !getLangOpts().CPlusPlus) // Empty source file is an extension in C - Diag(Tok, diag::ext_empty_source_file); - // Initialization for Objective-C context sensitive keywords recognition. // Referenced in Parser::ParseObjCTypeQualifierList. if (getLangOpts().ObjC1) { -- cgit v1.2.3