diff --git a/dmd/attrib.c b/dmd/attrib.c index 4c7a9bbd8f..069650514f 100644 --- a/dmd/attrib.c +++ b/dmd/attrib.c @@ -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()); diff --git a/dmd/dump.c b/dmd/dump.c index 8d52188484..96b05bcffb 100644 --- a/dmd/dump.c +++ b/dmd/dump.c @@ -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) diff --git a/dmd/expression.c b/dmd/expression.c index d866fc3789..ddf71ea039 100644 --- a/dmd/expression.c +++ b/dmd/expression.c @@ -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()) diff --git a/dmd/lexer.c b/dmd/lexer.c index d108e6409c..9bcfc91711 100644 --- a/dmd/lexer.c +++ b/dmd/lexer.c @@ -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 diff --git a/dmd/statement.c b/dmd/statement.c index 135f49122c..28afb355be 100644 --- a/dmd/statement.c +++ b/dmd/statement.c @@ -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()); diff --git a/gen/arrays.cpp b/gen/arrays.cpp index 60912c6af0..ca26a19b1f 100644 --- a/gen/arrays.cpp +++ b/gen/arrays.cpp @@ -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); } ////////////////////////////////////////////////////////////////////////////////////////// diff --git a/gen/asmstmt.cpp b/gen/asmstmt.cpp index c7f3c5e9fd..3635cd1357 100644 --- a/gen/asmstmt.cpp +++ b/gen/asmstmt.cpp @@ -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); } diff --git a/gen/llvmhelpers.cpp b/gen/llvmhelpers.cpp index ecdd9c0c5c..1527b8c95b 100644 --- a/gen/llvmhelpers.cpp +++ b/gen/llvmhelpers.cpp @@ -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; diff --git a/gen/logger.cpp b/gen/logger.cpp index ca463d4220..6cea3aeb4f 100644 --- a/gen/logger.cpp +++ b/gen/logger.cpp @@ -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); diff --git a/gen/runtime.cpp b/gen/runtime.cpp index 058e4a21a9..484d5d65d5 100644 --- a/gen/runtime.cpp +++ b/gen/runtime.cpp @@ -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); diff --git a/gen/tollvm.cpp b/gen/tollvm.cpp index f7ff85019a..0cf1ff9fe0 100644 --- a/gen/tollvm.cpp +++ b/gen/tollvm.cpp @@ -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); } diff --git a/runtime/internal/eh.d b/runtime/internal/eh.d index 18c3529c77..5d098a8427 100644 --- a/runtime/internal/eh.d +++ b/runtime/internal/eh.d @@ -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; } diff --git a/runtime/internal/memory.d b/runtime/internal/memory.d index cf4de47c6c..d1d5a16dff 100644 --- a/runtime/internal/memory.d +++ b/runtime/internal/memory.d @@ -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; }