mirror of
https://github.com/intel/llvm.git
synced 2026-02-02 10:08:59 +08:00
EXTWARNify the warning about unnamed typedefs of enums
llvm-svn: 62766
This commit is contained in:
@@ -606,7 +606,7 @@ DIAG(err_expected_unqualified_id, ERROR,
|
||||
"expected unqualified-id")
|
||||
DIAG(err_no_declarators, ERROR,
|
||||
"declaration does not declare anything")
|
||||
DIAG(warn_no_declarators, WARNING,
|
||||
DIAG(ext_typedef_without_a_name, EXTWARN,
|
||||
"typedef requires a name")
|
||||
DIAG(err_func_def_no_params, ERROR,
|
||||
"function definition does not declare parameters")
|
||||
|
||||
@@ -736,11 +736,12 @@ Sema::DeclTy *Sema::ParsedFreeStandingDeclSpec(Scope *S, DeclSpec &DS) {
|
||||
return Tag;
|
||||
}
|
||||
|
||||
// Permit typedefs without declarators as a Microsoft extension.
|
||||
if (!DS.isMissingDeclaratorOk()) {
|
||||
// Warn about typedefs of enums without names, since this is an
|
||||
// extension in both Microsoft an GNU.
|
||||
if (DS.getStorageClassSpec() == DeclSpec::SCS_typedef &&
|
||||
Tag && isa<EnumDecl>(Tag)) {
|
||||
Diag(DS.getSourceRange().getBegin(), diag::warn_no_declarators)
|
||||
Diag(DS.getSourceRange().getBegin(), diag::ext_typedef_without_a_name)
|
||||
<< DS.getSourceRange();
|
||||
return Tag;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user