improve VC++ compatibility, patch by Cédric Venet.

llvm-svn: 44496
This commit is contained in:
Chris Lattner 2007-12-02 00:47:03 +00:00
parent aefc8fd415
commit 9724ce12f9
3 changed files with 24 additions and 24 deletions

View File

@ -121,7 +121,7 @@ static bool BadSpecifier(DeclSpec::TQ T, const char *&PrevSpec) {
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 @@ bool DeclSpec::SetTypeSpecWidth(TSW W, SourceLocation Loc,
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::SetTypeSpecWidth(TSW W, SourceLocation Loc,
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::SetTypeSpecComplex(TSC C, SourceLocation Loc,
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::SetTypeSpecSign(TSS S, SourceLocation Loc,
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 @@ void DeclSpec::Finish(Diagnostic &D, const LangOptions &Lang) {
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 @@ void DeclSpec::Finish(Diagnostic &D, const LangOptions &Lang) {
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 @@ void DeclSpec::Finish(Diagnostic &D, const LangOptions &Lang) {
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 @@ void DeclSpec::Finish(Diagnostic &D, const LangOptions &Lang) {
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 @@ void DeclSpec::Finish(Diagnostic &D, const LangOptions &Lang) {
} 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;
}
}

View File

@ -773,8 +773,8 @@ Sema::DeclTy *Sema::FinalizeDeclaratorGroup(Scope *S, DeclTy *group) {
// 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 @@ Sema::DeclTy *Sema::FinalizeDeclaratorGroup(Scope *S, DeclTy *group) {
// 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();
}
}

View File

@ -101,14 +101,14 @@ public:
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 @@ public:
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 @@ public:
}
// 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; }