Permitting typedefs without a name is a Microsoft/GNU extension

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62192 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Douglas Gregor 2009-01-13 23:10:51 +00:00
Родитель 7bd88aa620
Коммит ee159c14c1
2 изменённых файлов: 10 добавлений и 0 удалений

Просмотреть файл

@ -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,

Просмотреть файл

@ -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