summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-01-13 23:10:51 +0000
committerDouglas Gregor <dgregor@apple.com>2009-01-13 23:10:51 +0000
commit2b136fe2a5c86df3f8b019ab5df7575f5223fdba (patch)
tree32d3c375927a7b2010deab404dd093c9d5adbfb8 /clang
parent7b13aeedeabb652d952b29747df870b9ad1b52c1 (diff)
downloadbcm5719-llvm-2b136fe2a5c86df3f8b019ab5df7575f5223fdba.tar.gz
bcm5719-llvm-2b136fe2a5c86df3f8b019ab5df7575f5223fdba.zip
Permitting typedefs without a name is a Microsoft/GNU extension
llvm-svn: 62192
Diffstat (limited to 'clang')
-rw-r--r--clang/include/clang/Basic/DiagnosticKinds.def2
-rw-r--r--clang/lib/Sema/SemaDecl.cpp8
2 files changed, 10 insertions, 0 deletions
diff --git a/clang/include/clang/Basic/DiagnosticKinds.def b/clang/include/clang/Basic/DiagnosticKinds.def
index a9f60d2d630..52c6cbf2fa6 100644
--- a/clang/include/clang/Basic/DiagnosticKinds.def
+++ b/clang/include/clang/Basic/DiagnosticKinds.def
@@ -593,6 +593,8 @@ DIAG(err_expected_unqualified_id, ERROR,
"expected unqualified-id")
DIAG(err_no_declarators, ERROR,
"declaration does not declare anything")
+DIAG(ext_no_declarators, EXTENSION,
+ "typedef without a name is a Microsoft extension")
DIAG(err_func_def_no_params, ERROR,
"function definition does not declare parameters")
DIAG(err_expected_lparen_after_type, ERROR,
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index 9b419e5b63c..8d2e5590b98 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -875,7 +875,15 @@ Sema::DeclTy *Sema::ParsedFreeStandingDeclSpec(Scope *S, DeclSpec &DS) {
return Tag;
}
+ // Permit typedefs without declarators as a Microsoft extension.
if (!DS.isMissingDeclaratorOk()) {
+ if (getLangOptions().Microsoft &&
+ DS.getStorageClassSpec() == DeclSpec::SCS_typedef) {
+ Diag(DS.getSourceRange().getBegin(), diag::ext_no_declarators)
+ << DS.getSourceRange();
+ return Tag;
+ }
+
// FIXME: This diagnostic is emitted even when various previous
// errors occurred (see e.g. test/Sema/decl-invalid.c). However,
// DeclSpec has no means of communicating this information, and the
OpenPOWER on IntegriCloud