majnemer added a comment.

MSVC permits:

  typedef int foo;
  typedef float foo;

This is crazy and most certainly not 'benign'. I think that we should insist 
that the underlying types not just be the same size and alignment but the same 
kind of scalar type. If two types are integral or enumerator types, they should 
have the same signedness.

I believe this would be enough to get things like vortex working without 
harming developer productivity.


================
Comment at: include/clang/Basic/DiagnosticSemaKinds.td:4265-4267
@@ -4264,2 +4264,5 @@
   InGroup<DiagGroup<"objc-forward-class-redefinition">>;
+def warn_benign_redefinition_different_typedef : ExtWarn<
+  "benign typedef redefinition with different types%diff{ ($ vs $)|}0,1 "
+  "is a Microsoft extension">, InGroup<Microsoft>;
 def err_redefinition_different_typedef : Error<
----------------
I think giving a warning that 'benign' sends the message that the code is OK 
and that the warning should be disabled.  I think we should say something like 
"typedef redefinition is ignored due to conflicting underlying type".

================
Comment at: lib/AST/ASTContext.cpp:6727-6728
@@ +6726,4 @@
+bool ASTContext::areMSCompatibleTypesInC(QualType OldType, QualType NewType) {
+  assert(getLangOpts().MicrosoftExt &&
+         "This routine must be called in Microsoft mode only!");
+  assert(!getLangOpts().CPlusPlus && !getLangOpts().ObjC1 &&
----------------
Shouldn't this be `MSVCCompat`, not `MicrosoftExt`?

================
Comment at: lib/Sema/SemaDecl.cpp:1868
@@ -1846,2 +1867,3 @@
   QualType OldType;
-  if (TypedefNameDecl *OldTypedef = dyn_cast<TypedefNameDecl>(Old))
+  TypedefNameDecl *OldTypedef = dyn_cast<TypedefNameDecl>(Old);
+  if (OldTypedef)
----------------
Please use `auto` here.


http://reviews.llvm.org/D16770



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to