[cfe-commits] r44496 - in /cfe/trunk: Parse/DeclSpec.cpp Sema/SemaDecl.cpp include/clang/Parse/DeclSpec.h

Chris Lattner sabre at nondot.org
Sat Dec 1 16:47:03 PST 2007


Author: lattner
Date: Sat Dec  1 18:47:03 2007
New Revision: 44496

URL: http://llvm.org/viewvc/llvm-project?rev=44496&view=rev
Log:
improve VC++ compatibility, patch by Cédric Venet.

Modified:
    cfe/trunk/Parse/DeclSpec.cpp
    cfe/trunk/Sema/SemaDecl.cpp
    cfe/trunk/include/clang/Parse/DeclSpec.h

Modified: cfe/trunk/Parse/DeclSpec.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Parse/DeclSpec.cpp?rev=44496&r1=44495&r2=44496&view=diff

==============================================================================
--- cfe/trunk/Parse/DeclSpec.cpp (original)
+++ cfe/trunk/Parse/DeclSpec.cpp Sat Dec  1 18:47:03 2007
@@ -121,7 +121,7 @@
 bool DeclSpec::SetStorageClassSpec(SCS S, SourceLocation Loc,
                                    const char *&PrevSpec) {
   if (StorageClassSpec != SCS_unspecified)
-    return BadSpecifier(StorageClassSpec, PrevSpec);
+    return BadSpecifier( (SCS)StorageClassSpec, PrevSpec);
   StorageClassSpec = S;
   StorageClassSpecLoc = Loc;
   return false;
@@ -147,7 +147,7 @@
   if (TypeSpecWidth != TSW_unspecified &&
       // Allow turning long -> long long.
       (W != TSW_longlong || TypeSpecWidth != TSW_long))
-    return BadSpecifier(TypeSpecWidth, PrevSpec);
+    return BadSpecifier( (TSW)TypeSpecWidth, PrevSpec);
   TypeSpecWidth = W;
   TSWLoc = Loc;
   return false;
@@ -156,7 +156,7 @@
 bool DeclSpec::SetTypeSpecComplex(TSC C, SourceLocation Loc, 
                                   const char *&PrevSpec) {
   if (TypeSpecComplex != TSC_unspecified)
-    return BadSpecifier(TypeSpecComplex, PrevSpec);
+    return BadSpecifier( (TSC)TypeSpecComplex, PrevSpec);
   TypeSpecComplex = C;
   TSCLoc = Loc;
   return false;
@@ -165,7 +165,7 @@
 bool DeclSpec::SetTypeSpecSign(TSS S, SourceLocation Loc, 
                                const char *&PrevSpec) {
   if (TypeSpecSign != TSS_unspecified)
-    return BadSpecifier(TypeSpecSign, PrevSpec);
+    return BadSpecifier( (TSS)TypeSpecSign, PrevSpec);
   TypeSpecSign = S;
   TSSLoc = Loc;
   return false;
@@ -174,7 +174,7 @@
 bool DeclSpec::SetTypeSpecType(TST T, SourceLocation Loc,
                                const char *&PrevSpec, void *Rep) {
   if (TypeSpecType != TST_unspecified)
-    return BadSpecifier(TypeSpecType, PrevSpec);
+    return BadSpecifier( (TST)TypeSpecType, PrevSpec);
   TypeSpecType = T;
   TypeRep = Rep;
   TSTLoc = Loc;
@@ -218,7 +218,7 @@
       TypeSpecType = TST_int; // unsigned -> unsigned int, signed -> signed int.
     else if (TypeSpecType != TST_int && TypeSpecType != TST_char) {
       Diag(D, TSSLoc, diag::err_invalid_sign_spec,
-           getSpecifierName(TypeSpecType));
+           getSpecifierName( (TST)TypeSpecType));
       // signed double -> double.
       TypeSpecSign = TSS_unspecified;
     }
@@ -235,7 +235,7 @@
       Diag(D, TSWLoc,
            TypeSpecWidth == TSW_short ? diag::err_invalid_short_spec
                                       : diag::err_invalid_longlong_spec,
-           getSpecifierName(TypeSpecType));
+           getSpecifierName( (TST)TypeSpecType));
       TypeSpecType = TST_int;
     }
     break;
@@ -244,7 +244,7 @@
       TypeSpecType = TST_int;  // long -> long int.
     else if (TypeSpecType != TST_int && TypeSpecType != TST_double) {
       Diag(D, TSWLoc, diag::err_invalid_long_spec,
-           getSpecifierName(TypeSpecType));
+           getSpecifierName( (TST)TypeSpecType));
       TypeSpecType = TST_int;
     }
     break;
@@ -261,7 +261,7 @@
       Diag(D, TSTLoc, diag::ext_integer_complex);
     } else if (TypeSpecType != TST_float && TypeSpecType != TST_double) {
       Diag(D, TSCLoc, diag::err_invalid_complex_spec, 
-           getSpecifierName(TypeSpecType));
+           getSpecifierName( (TST)TypeSpecType));
       TypeSpecComplex = TSC_unspecified;
     }
   }
@@ -273,7 +273,7 @@
     } else if (StorageClassSpec != SCS_extern &&
                StorageClassSpec != SCS_static) {
       Diag(D, getStorageClassSpecLoc(), diag::err_invalid_thread_spec,
-           getSpecifierName(StorageClassSpec));
+           getSpecifierName( (SCS)StorageClassSpec));
       SCS_thread_specified = false;
     }
   }

Modified: cfe/trunk/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Sema/SemaDecl.cpp?rev=44496&r1=44495&r2=44496&view=diff

==============================================================================
--- cfe/trunk/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/Sema/SemaDecl.cpp Sat Dec  1 18:47:03 2007
@@ -773,8 +773,8 @@
     // no linkage (C99 6.2.2p6), the type for the object shall be complete...
     if (BVD && IDecl->getStorageClass() != VarDecl::Extern) {
       if (T->isIncompleteType()) {
-        Diag(IDecl->getLocation(), diag::err_typecheck_decl_incomplete_type,
-             T.getAsString());
+        //Diag(IDecl->getLocation(), diag::err_typecheck_decl_incomplete_type,
+        //     T.getAsString());
         IDecl->setInvalidDecl();
       }
     }
@@ -788,8 +788,8 @@
       // a tentative definition and has internal linkage (C99 6.2.2p3), the  
       // declared type shall not be an incomplete type.
       if (T->isIncompleteType()) {
-        Diag(IDecl->getLocation(), diag::err_typecheck_decl_incomplete_type,
-             T.getAsString());
+        //Diag(IDecl->getLocation(), diag::err_typecheck_decl_incomplete_type,
+        //     T.getAsString());
         IDecl->setInvalidDecl();
       }
     }

Modified: cfe/trunk/include/clang/Parse/DeclSpec.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Parse/DeclSpec.h?rev=44496&r1=44495&r2=44496&view=diff

==============================================================================
--- cfe/trunk/include/clang/Parse/DeclSpec.h (original)
+++ cfe/trunk/include/clang/Parse/DeclSpec.h Sat Dec  1 18:47:03 2007
@@ -101,14 +101,14 @@
 private:
     
   // storage-class-specifier
-  SCS StorageClassSpec : 3;
+  /*SCS*/unsigned StorageClassSpec : 3;
   bool SCS_thread_specified : 1;
 
   // type-specifier
-  TSW TypeSpecWidth : 2;
-  TSC TypeSpecComplex : 2;
-  TSS TypeSpecSign : 2;
-  TST TypeSpecType : 4;
+  /*TSW*/unsigned TypeSpecWidth : 2;
+  /*TSC*/unsigned TypeSpecComplex : 2;
+  /*TSS*/unsigned TypeSpecSign : 2;
+  /*TST*/unsigned TypeSpecType : 4;
   
   // type-qualifiers
   unsigned TypeQualifiers : 3;  // Bitwise OR of TQ.
@@ -153,7 +153,7 @@
     delete ProtocolQualifiers;
   }
   // storage-class-specifier
-  SCS getStorageClassSpec() const { return StorageClassSpec; }
+  SCS getStorageClassSpec() const { return (SCS)StorageClassSpec; }
   bool isThreadSpecified() const { return SCS_thread_specified; }
   
   SourceLocation getStorageClassSpecLoc() const { return StorageClassSpecLoc; }
@@ -168,10 +168,10 @@
   }
   
   // type-specifier
-  TSW getTypeSpecWidth() const { return TypeSpecWidth; }
-  TSC getTypeSpecComplex() const { return TypeSpecComplex; }
-  TSS getTypeSpecSign() const { return TypeSpecSign; }
-  TST getTypeSpecType() const { return TypeSpecType; }
+  TSW getTypeSpecWidth() const { return (TSW)TypeSpecWidth; }
+  TSC getTypeSpecComplex() const { return (TSC)TypeSpecComplex; }
+  TSS getTypeSpecSign() const { return (TSS)TypeSpecSign; }
+  TST getTypeSpecType() const { return (TST)TypeSpecType; }
   void *getTypeRep() const { return TypeRep; }
   
   SourceLocation getTypeSpecWidthLoc() const { return TSWLoc; }





More information about the cfe-commits mailing list