summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDecl.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-03-06 23:41:27 +0000
committerDouglas Gregor <dgregor@apple.com>2009-03-06 23:41:27 +0000
commit3e06dbf48c0a54bd234fa0dca3750afb5ce0e214 (patch)
tree395124865a60c58df733fbde6c1e0ae8f27a872f /clang/lib/Sema/SemaDecl.cpp
parent5f080b43fa896eca4ec181fa8c6853603eaceaf1 (diff)
downloadbcm5719-llvm-3e06dbf48c0a54bd234fa0dca3750afb5ce0e214.tar.gz
bcm5719-llvm-3e06dbf48c0a54bd234fa0dca3750afb5ce0e214.zip
Downgrade complaints about the use of variable-sized types within a
struct to an extension warning to match the behavior of GNU C, which addresses the Sema part of PR3671. llvm-svn: 66308
Diffstat (limited to 'clang/lib/Sema/SemaDecl.cpp')
-rw-r--r--clang/lib/Sema/SemaDecl.cpp20
1 files changed, 9 insertions, 11 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index 5e7ce52ee87..e902cbe135c 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -3525,19 +3525,17 @@ void Sema::ActOnFields(Scope* S,
// If this is a struct/class and this is not the last element, reject
// it. Note that GCC supports variable sized arrays in the middle of
// structures.
- if (i != NumFields-1) {
- Diag(FD->getLocation(), diag::err_variable_sized_type_in_struct)
+ if (i != NumFields-1)
+ Diag(FD->getLocation(), diag::ext_variable_sized_type_in_struct)
<< FD->getDeclName();
- FD->setInvalidDecl();
- EnclosingDecl->setInvalidDecl();
- continue;
+ else {
+ // We support flexible arrays at the end of structs in
+ // other structs as an extension.
+ Diag(FD->getLocation(), diag::ext_flexible_array_in_struct)
+ << FD->getDeclName();
+ if (Record)
+ Record->setHasFlexibleArrayMember(true);
}
- // We support flexible arrays at the end of structs in other structs
- // as an extension.
- Diag(FD->getLocation(), diag::ext_flexible_array_in_struct)
- << FD->getDeclName();
- if (Record)
- Record->setHasFlexibleArrayMember(true);
}
}
}
OpenPOWER on IntegriCloud