Fix warnings on x86-64. By fvbommel.

This commit is contained in:
Christian Kamm 2008-11-28 21:24:08 +01:00
parent cc6bde46f9
commit cdbc4f84d2
13 changed files with 27 additions and 26 deletions

View file

@ -779,7 +779,7 @@ void PragmaDeclaration::semantic(Scope *sc)
if (e->op == TOKstring)
{
StringExp *se = (StringExp *)e;
fprintf(stdmsg, "%.*s", (int)se->len, se->string);
fprintf(stdmsg, "%.*s", (int)se->len, (char*)se->string);
}
else
error("string expected for message, not '%s'", e->toChars());

View file

@ -52,7 +52,7 @@ void Expression::dump(int i)
void IntegerExp::dump(int i)
{
indent(i);
printf("%p %lld type=%s\n", this, (intmax_t)value, type_print(type));
printf("%p %lld type=%s\n", this, (long long)value, type_print(type));
}
void IdentifierExp::dump(int i)

View file

@ -4864,7 +4864,7 @@ Expression *FileExp::semantic(Scope *sc)
}
if (global.params.verbose)
printf("file %s\t(%s)\n", se->string, name);
printf("file %s\t(%s)\n", (char*)se->string, name);
{ File f(name);
if (f.read())

View file

@ -138,11 +138,11 @@ const char *Token::toChars()
break;
case TOKint64v:
sprintf(buffer,"%lldL",int64value);
sprintf(buffer,"%lldL",(long long)int64value);
break;
case TOKuns64v:
sprintf(buffer,"%lluUL",uns64value);
sprintf(buffer,"%lluUL",(unsigned long long)uns64value);
break;
#if IN_GCC

View file

@ -2135,7 +2135,7 @@ Statement *PragmaStatement::semantic(Scope *sc)
if (e->op == TOKstring)
{
StringExp *se = (StringExp *)e;
fprintf(stdmsg, "%.*s", (int)se->len, se->string);
fprintf(stdmsg, "%.*s", (int)se->len, (char*)se->string);
}
else
error("string expected for message, not '%s'", e->toChars());

View file

@ -24,12 +24,12 @@ const LLStructType* DtoArrayType(Type* arrayTy)
const LLType* elemty = DtoType(arrayTy->nextOf());
if (elemty == LLType::VoidTy)
elemty = LLType::Int8Ty;
return LLStructType::get(DtoSize_t(), getPtrToType(elemty), 0);
return LLStructType::get(DtoSize_t(), getPtrToType(elemty), NULL);
}
const LLStructType* DtoArrayType(const LLType* t)
{
return LLStructType::get(DtoSize_t(), getPtrToType(t), 0);
return LLStructType::get(DtoSize_t(), getPtrToType(t), NULL);
}
//////////////////////////////////////////////////////////////////////////////////////////

View file

@ -6,6 +6,7 @@
//#include "d-gcc-includes.h"
//#include "total.h"
#include "mars.h"
#include "statement.h"
#include "scope.h"
#include "declaration.h"
@ -419,7 +420,7 @@ static void remap_outargs(std::string& insnt, size_t nargs, size_t& idx)
needle = prefix + digits[i] + suffix;
size_t pos = insnt.find(needle);
if(std::string::npos != pos)
sprintf(buf, "%u", idx++);
sprintf(buf, "%" PRIuSIZE, idx++);
while(std::string::npos != (pos = insnt.find(needle)))
insnt.replace(pos, needle.size(), buf);
}
@ -444,7 +445,7 @@ static void remap_inargs(std::string& insnt, size_t nargs, size_t& idx)
needle = prefix + digits[i] + suffix;
size_t pos = insnt.find(needle);
if(std::string::npos != pos)
sprintf(buf, "%u", idx++);
sprintf(buf, "%" PRIuSIZE, idx++);
while(std::string::npos != (pos = insnt.find(needle)))
insnt.replace(pos, needle.size(), buf);
}

View file

@ -1649,7 +1649,7 @@ void DtoOverloadedIntrinsicName(TemplateInstance* ti, TemplateDeclaration* td, s
if (T->toBasetype()->ty == Tbool) // otherwise we'd get a mismatch
sprintf(tmp, "1");
else
sprintf(tmp, "%d", T->size()*8);
sprintf(tmp, "%lu", T->size()*8);
// replace # in name with bitsize
name = td->intrinsicName;

View file

@ -39,7 +39,7 @@ namespace Logger
void println(const char* fmt,...)
{
if (_enabled) {
printf(indent_str.c_str());
printf("%s", indent_str.c_str());
va_list va;
va_start(va,fmt);
vprintf(fmt,va);
@ -50,7 +50,7 @@ namespace Logger
void print(const char* fmt,...)
{
if (_enabled) {
printf(indent_str.c_str());
printf("%s", indent_str.c_str());
va_list va;
va_start(va,fmt);
vprintf(fmt,va);

View file

@ -110,7 +110,7 @@ static const LLType* rt_ptr(const LLType* t)
static const LLType* rt_array(const LLType* elemty)
{
return llvm::StructType::get(DtoSize_t(), rt_ptr(elemty), 0);
return llvm::StructType::get(DtoSize_t(), rt_ptr(elemty), NULL);
}
static const LLType* rt_dg1()
@ -119,7 +119,7 @@ static const LLType* rt_dg1()
types.push_back(rt_ptr(LLType::Int8Ty));
types.push_back(rt_ptr(LLType::Int8Ty));
const llvm::FunctionType* fty = llvm::FunctionType::get(LLType::Int32Ty, types, false);
return llvm::StructType::get(rt_ptr(LLType::Int8Ty), rt_ptr(fty), 0);
return llvm::StructType::get(rt_ptr(LLType::Int8Ty), rt_ptr(fty), NULL);
}
static const LLType* rt_dg2()
@ -129,7 +129,7 @@ static const LLType* rt_dg2()
types.push_back(rt_ptr(LLType::Int8Ty));
types.push_back(rt_ptr(LLType::Int8Ty));
const llvm::FunctionType* fty = llvm::FunctionType::get(LLType::Int32Ty, types, false);
return llvm::StructType::get(rt_ptr(LLType::Int8Ty), rt_ptr(fty), 0);
return llvm::StructType::get(rt_ptr(LLType::Int8Ty), rt_ptr(fty), NULL);
}
static void LLVM_D_BuildRuntimeModule()
@ -152,9 +152,9 @@ static void LLVM_D_BuildRuntimeModule()
else
realTy = LLType::DoubleTy;
const LLType* cfloatTy = llvm::StructType::get(floatTy, floatTy, 0);
const LLType* cdoubleTy = llvm::StructType::get(doubleTy, doubleTy, 0);
const LLType* crealTy = llvm::StructType::get(realTy, realTy, 0);
const LLType* cfloatTy = llvm::StructType::get(floatTy, floatTy, NULL);
const LLType* cdoubleTy = llvm::StructType::get(doubleTy, doubleTy, NULL);
const LLType* crealTy = llvm::StructType::get(realTy, realTy, NULL);
const LLType* voidPtrTy = rt_ptr(byteTy);
const LLType* stringTy = rt_array(byteTy);

View file

@ -229,7 +229,7 @@ const LLStructType* DtoDelegateType(Type* t)
const LLType* i8ptr = getVoidPtrType();
const LLType* func = DtoFunctionType(t->nextOf(), NULL, i8ptr);
const LLType* funcptr = getPtrToType(func);
return LLStructType::get(i8ptr, funcptr, 0);
return LLStructType::get(i8ptr, funcptr, NULL);
}
//////////////////////////////////////////////////////////////////////////////////////////
@ -740,7 +740,7 @@ const LLStructType* DtoMutexType()
// FreeBSD
else if (global.params.os == OSFreeBSD) {
// Just a pointer
return LLStructType::get(DtoSize_t(), 0);
return LLStructType::get(DtoSize_t(), NULL);
}
// pthread_fastlock
@ -813,7 +813,7 @@ LLValue* DtoAggrPair(const LLType* type, LLValue* V1, LLValue* V2, const char* n
LLValue* DtoAggrPair(LLValue* V1, LLValue* V2, const char* name)
{
const LLType* t = LLStructType::get(V1->getType(), V2->getType(), 0);
const LLType* t = LLStructType::get(V1->getType(), V2->getType(), NULL);
return DtoAggrPair(t, V1, V2, name);
}

View file

@ -280,7 +280,7 @@ extern(C) _Unwind_Reason_Code _d_eh_personality(int ver, _Unwind_Action actions,
// get classinfo for action and check if the one in the
// exception structure is a base
ClassInfo catch_ci = classinfo_table[-ti_offset];
ClassInfo catch_ci = *(classinfo_table - ti_offset);
debug(EH_personality) printf("Comparing catch %s to exception %s\n", catch_ci.name.ptr, exception_struct.exception_object.classinfo.name.ptr);
if(_d_isbaseof(exception_struct.exception_object.classinfo, catch_ci))
return _d_eh_install_catch_context(actions, ti_offset, landing_pad, exception_struct, context);
@ -320,7 +320,7 @@ private _Unwind_Reason_Code _d_eh_install_catch_context(_Unwind_Action actions,
{
debug(EH_personality) printf("Setting switch value to: %d!\n", switchval);
_Unwind_SetGR(context, eh_exception_regno, cast(ulong)cast(void*)(exception_struct.exception_object));
_Unwind_SetGR(context, eh_selector_regno, switchval);
_Unwind_SetGR(context, eh_selector_regno, cast(ulong)switchval);
_Unwind_SetIP(context, landing_pad);
return _Unwind_Reason_Code.INSTALL_CONTEXT;
}

View file

@ -263,7 +263,7 @@ void initStaticDataPtrs()
// TODO: Exclude zero-mapped regions
int fd = open("/proc/self/maps", O_RDONLY);
int count; // %% need to configure ret for read..
ptrdiff_t count; // %% need to configure ret for read..
char buf[2024];
char* p;
char* e;
@ -338,7 +338,7 @@ void initStaticDataPtrs()
else
{
count = p - s;
memmove(buf.ptr, s, count);
memmove(buf.ptr, s, cast(size_t)count);
p = buf.ptr + count;
break;
}