From c3018153a11afe91849748a93d920040a571b76c Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Fri, 10 Aug 2007 20:57:02 +0000 Subject: [PATCH] add support for a top-level __extension__ marker, implementing a todo. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41004 91177308-0d34-0410-b5e6-96231b3b80d8 --- Parse/Parser.cpp | 13 ++++++++++--- test/Parser/extension.c | 9 +++++++++ 2 files changed, 19 insertions(+), 3 deletions(-) create mode 100644 test/Parser/extension.c diff --git a/Parse/Parser.cpp b/Parse/Parser.cpp index 3a5885af33..7ff0609784 100644 --- a/Parse/Parser.cpp +++ b/Parse/Parser.cpp @@ -282,11 +282,11 @@ void Parser::ParseTranslationUnit() { /// ParseExternalDeclaration: /// external-declaration: [C99 6.9] -/// function-definition [TODO] -/// declaration [TODO] +/// function-definition +/// declaration /// [EXT] ';' /// [GNU] asm-definition -/// [GNU] __extension__ external-declaration [TODO] +/// [GNU] __extension__ external-declaration /// [OBJC] objc-class-definition /// [OBJC] objc-class-declaration /// [OBJC] objc-alias-declaration @@ -304,6 +304,13 @@ Parser::DeclTy *Parser::ParseExternalDeclaration() { ConsumeToken(); // TODO: Invoke action for top-level semicolon. return 0; + case tok::kw___extension__: { + ConsumeToken(); + // FIXME: Disable extension warnings. + DeclTy *RV = ParseExternalDeclaration(); + // FIXME: Restore extension warnings. + return RV; + } case tok::kw_asm: ParseSimpleAsm(); ExpectAndConsume(tok::semi, diag::err_expected_semi_after, diff --git a/test/Parser/extension.c b/test/Parser/extension.c new file mode 100644 index 0000000000..77a2f17583 --- /dev/null +++ b/test/Parser/extension.c @@ -0,0 +1,9 @@ +// RUN: clang %s -fsyntax-only + +// Top level extension marker. + +__extension__ typedef struct +{ + long long int quot; + long long int rem; +}lldiv_t; -- 2.40.0