[cfe-commits] r69074 - in /cfe/trunk: lib/Parse/ParseDecl.cpp test/Sema/implicit-int.c
Chris Lattner
sabre at nondot.org
Tue Apr 14 14:16:09 PDT 2009
Author: lattner
Date: Tue Apr 14 16:16:09 2009
New Revision: 69074
URL: http://llvm.org/viewvc/llvm-project?rev=69074&view=rev
Log:
Fix a regression in a previous patch that broke implicit
int in a bitfield. Shantonu found this in a gcc testsuite file.
Modified:
cfe/trunk/lib/Parse/ParseDecl.cpp
cfe/trunk/test/Sema/implicit-int.c
Modified: cfe/trunk/lib/Parse/ParseDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseDecl.cpp?rev=69074&r1=69073&r2=69074&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseDecl.cpp (original)
+++ cfe/trunk/lib/Parse/ParseDecl.cpp Tue Apr 14 16:16:09 2009
@@ -440,7 +440,8 @@
// Validate declspec for type-name.
unsigned Specs = DS.getParsedSpecifiers();
- if (Specs == DeclSpec::PQ_None && !DS.getNumProtocolQualifiers())
+ if (Specs == DeclSpec::PQ_None && !DS.getNumProtocolQualifiers() &&
+ !DS.getAttributes())
Diag(Tok, diag::err_typename_requires_specqual);
// Issue diagnostic and remove storage class if present.
@@ -475,6 +476,7 @@
/// int x = 17; // init-declarator-list
/// int x , y; // init-declarator-list
/// int x __asm__ ("foo"); // init-declarator-list
+/// int x : 4; // struct-declarator
/// int x { 5}; // C++'0x unified initializers
///
/// This is not, because 'x' does not immediately follow the declspec (though
@@ -484,7 +486,7 @@
static bool isValidAfterIdentifierInDeclarator(const Token &T) {
return T.is(tok::l_square) || T.is(tok::l_paren) || T.is(tok::r_paren) ||
T.is(tok::semi) || T.is(tok::comma) || T.is(tok::equal) ||
- T.is(tok::kw_asm) || T.is(tok::l_brace);
+ T.is(tok::kw_asm) || T.is(tok::l_brace) || T.is(tok::colon);
}
/// ParseDeclarationSpecifiers
Modified: cfe/trunk/test/Sema/implicit-int.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/implicit-int.c?rev=69074&r1=69073&r2=69074&view=diff
==============================================================================
--- cfe/trunk/test/Sema/implicit-int.c (original)
+++ cfe/trunk/test/Sema/implicit-int.c Tue Apr 14 16:16:09 2009
@@ -22,3 +22,11 @@
ILPAD(); // expected-warning {{type specifier missing, defaults to 'int'}}
}
+struct foo {
+ __extension__ __attribute__((packed)) // expected-warning {{type specifier missing, defaults to 'int'}}
+ x : 4;
+};
+
+
+
+
More information about the cfe-commits
mailing list