[cfe-dev] [cfe-commits] r62192 - in /cfe/trunk: include/clang/Basic/DiagnosticKinds.def lib/Sema/SemaDecl.cpp

Chris Lattner clattner at apple.com
Wed Jan 21 22:03:24 PST 2009


On Jan 13, 2009, at 3:10 PM, Douglas Gregor wrote:
> URL: http://llvm.org/viewvc/llvm-project?rev=62192&view=rev
> Log:
> Permitting typedefs without a name is a Microsoft/GNU extension

Hey Doug,

> +++ cfe/trunk/include/clang/Basic/DiagnosticKinds.def Tue Jan 13  
> 17:10:51 2009
> @@ -593,6 +593,8 @@
>      "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")

Should this be an EXTWARN so that it warns by default?

> +  // 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;
> +    }

This touches on meta-design issues, but do you think it is better to  
test for getLangOptions.MS here, or do you think it is better to have  
the Clang driver map this onto ERROR by default when not is ms  
extensions mode?  Both approaches work, but they have different  
tradeoffs.  I'm curious what you (and others!) think.

-Chris



More information about the cfe-dev mailing list