1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 19:23:23 +01:00

Silence VS warnings.

llvm-svn: 19390
This commit is contained in:
Chris Lattner 2005-01-08 20:07:03 +00:00
parent a4a16f17a3
commit f1c684b3a2
3 changed files with 12 additions and 5 deletions

View File

@ -107,7 +107,7 @@ char *UnEscapeLexed(char *Buffer, bool AllowNull) {
for (char *BIn = Buffer; *BIn; ) { for (char *BIn = Buffer; *BIn; ) {
if (BIn[0] == '\\' && isxdigit(BIn[1]) && isxdigit(BIn[2])) { if (BIn[0] == '\\' && isxdigit(BIn[1]) && isxdigit(BIn[2])) {
char Tmp = BIn[3]; BIn[3] = 0; // Terminate string char Tmp = BIn[3]; BIn[3] = 0; // Terminate string
*BOut = strtol(BIn+1, 0, 16); // Convert to number *BOut = (char)strtol(BIn+1, 0, 16); // Convert to number
if (!AllowNull && !*BOut) if (!AllowNull && !*BOut)
ThrowException("String literal cannot accept \\00 escape!"); ThrowException("String literal cannot accept \\00 escape!");
@ -302,13 +302,19 @@ getelementptr { RET_TOK(MemOpVal, GetElementPtr, GETELEMENTPTR); }
return yytext[0] == 's' ? ESINT64VAL : EUINT64VAL; return yytext[0] == 's' ? ESINT64VAL : EUINT64VAL;
} }
{EPInteger} { llvmAsmlval.UIntVal = atoull(yytext+1); return UINTVAL; } {EPInteger} {
uint64_t Val = atoull(yytext+1);
if ((unsigned)Val != Val)
ThrowException("Invalid value number (too large)!");
llvmAsmlval.UIntVal = unsigned(Val);
return UINTVAL;
}
{ENInteger} { {ENInteger} {
uint64_t Val = atoull(yytext+2); uint64_t Val = atoull(yytext+2);
// +1: we have bigger negative range // +1: we have bigger negative range
if (Val > (uint64_t)INT32_MAX+1) if (Val > (uint64_t)INT32_MAX+1)
ThrowException("Constant too large for signed 32 bits!"); ThrowException("Constant too large for signed 32 bits!");
llvmAsmlval.SIntVal = -Val; llvmAsmlval.SIntVal = (int)-Val;
return SINTVAL; return SINTVAL;
} }

View File

@ -284,7 +284,8 @@ void *JIT::getOrEmitGlobalVariable(const GlobalVariable *GV) {
// If the global hasn't been emitted to memory yet, allocate space. We will // If the global hasn't been emitted to memory yet, allocate space. We will
// actually initialize the global after current function has finished // actually initialize the global after current function has finished
// compilation. // compilation.
Ptr =new char[getTargetData().getTypeSize(GV->getType()->getElementType())]; uint64_t S = getTargetData().getTypeSize(GV->getType()->getElementType());
Ptr = new char[(size_t)S];
PendingGlobals.push_back(GV); PendingGlobals.push_back(GV);
} }
addGlobalMapping(GV, Ptr); addGlobalMapping(GV, Ptr);

View File

@ -360,7 +360,7 @@ void JITEmitter::emitConstantPool(MachineConstantPool *MCP) {
unsigned TotalSize = 0; unsigned TotalSize = 0;
for (unsigned i = 0, e = Constants.size(); i != e; ++i) { for (unsigned i = 0, e = Constants.size(); i != e; ++i) {
const Type *Ty = Constants[i]->getType(); const Type *Ty = Constants[i]->getType();
unsigned Size = TheJIT->getTargetData().getTypeSize(Ty); unsigned Size = (unsigned)TheJIT->getTargetData().getTypeSize(Ty);
unsigned Alignment = TheJIT->getTargetData().getTypeAlignment(Ty); unsigned Alignment = TheJIT->getTargetData().getTypeAlignment(Ty);
// Make sure to take into account the alignment requirements of the type. // Make sure to take into account the alignment requirements of the type.
TotalSize = (TotalSize + Alignment-1) & ~(Alignment-1); TotalSize = (TotalSize + Alignment-1) & ~(Alignment-1);