changeset 794:661384d6a936

Fix warnings on x86-64. By fvbommel.
author Christian Kamm <kamm incasoftware de>
date Fri, 28 Nov 2008 21:24:08 +0100
parents f6dd817060fc
children 06ba66bc0689
files dmd/attrib.c dmd/dump.c dmd/expression.c dmd/lexer.c dmd/statement.c gen/arrays.cpp gen/asmstmt.cpp gen/llvmhelpers.cpp gen/logger.cpp gen/runtime.cpp gen/tollvm.cpp runtime/internal/eh.d runtime/internal/memory.d
diffstat 13 files changed, 27 insertions(+), 26 deletions(-) [+]
line wrap: on
line diff
--- a/dmd/attrib.c	Thu Nov 27 18:31:09 2008 +0100
+++ b/dmd/attrib.c	Fri Nov 28 21:24:08 2008 +0100
@@ -779,7 +779,7 @@
 		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());
--- a/dmd/dump.c	Thu Nov 27 18:31:09 2008 +0100
+++ b/dmd/dump.c	Fri Nov 28 21:24:08 2008 +0100
@@ -52,7 +52,7 @@
 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)
--- a/dmd/expression.c	Thu Nov 27 18:31:09 2008 +0100
+++ b/dmd/expression.c	Fri Nov 28 21:24:08 2008 +0100
@@ -4864,7 +4864,7 @@
     }
 
     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())
--- a/dmd/lexer.c	Thu Nov 27 18:31:09 2008 +0100
+++ b/dmd/lexer.c	Fri Nov 28 21:24:08 2008 +0100
@@ -138,11 +138,11 @@
 	    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
--- a/dmd/statement.c	Thu Nov 27 18:31:09 2008 +0100
+++ b/dmd/statement.c	Fri Nov 28 21:24:08 2008 +0100
@@ -2135,7 +2135,7 @@
                 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());
--- a/gen/arrays.cpp	Thu Nov 27 18:31:09 2008 +0100
+++ b/gen/arrays.cpp	Fri Nov 28 21:24:08 2008 +0100
@@ -24,12 +24,12 @@
     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);
 }
 
 //////////////////////////////////////////////////////////////////////////////////////////
--- a/gen/asmstmt.cpp	Thu Nov 27 18:31:09 2008 +0100
+++ b/gen/asmstmt.cpp	Fri Nov 28 21:24:08 2008 +0100
@@ -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 @@
         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 @@
         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);
     }
--- a/gen/llvmhelpers.cpp	Thu Nov 27 18:31:09 2008 +0100
+++ b/gen/llvmhelpers.cpp	Fri Nov 28 21:24:08 2008 +0100
@@ -1649,7 +1649,7 @@
     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;
--- a/gen/logger.cpp	Thu Nov 27 18:31:09 2008 +0100
+++ b/gen/logger.cpp	Fri Nov 28 21:24:08 2008 +0100
@@ -39,7 +39,7 @@
     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 @@
     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);
--- a/gen/runtime.cpp	Thu Nov 27 18:31:09 2008 +0100
+++ b/gen/runtime.cpp	Fri Nov 28 21:24:08 2008 +0100
@@ -110,7 +110,7 @@
 
 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 @@
     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 @@
     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 @@
     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);
--- a/gen/tollvm.cpp	Thu Nov 27 18:31:09 2008 +0100
+++ b/gen/tollvm.cpp	Fri Nov 28 21:24:08 2008 +0100
@@ -229,7 +229,7 @@
     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 @@
     // 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(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);
 }
 
--- a/runtime/internal/eh.d	Thu Nov 27 18:31:09 2008 +0100
+++ b/runtime/internal/eh.d	Fri Nov 28 21:24:08 2008 +0100
@@ -280,7 +280,7 @@
 
     // 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 @@
   {
     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;
   }
--- a/runtime/internal/memory.d	Thu Nov 27 18:31:09 2008 +0100
+++ b/runtime/internal/memory.d	Fri Nov 28 21:24:08 2008 +0100
@@ -263,7 +263,7 @@
         // 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 @@
                     else
                     {
                         count = p - s;
-                        memmove(buf.ptr, s, count);
+                        memmove(buf.ptr, s, cast(size_t)count);
                         p = buf.ptr + count;
                         break;
                     }