<<< Date Index >>>     <<< Thread Index >>>

Re: [PATCH] init warning



On Tue, May 20, 2008 at 12:35:36PM +0100, Paul Walker wrote:

> I'm not sure whether these are caused by %lld/off_t actually being
> different on AMD64 to x86, or whether they come out for everyone. Being
> able to use -Werror would be nice, though, so I might look into them
> sometime.

Right. On AMD-64 (and probably the other x86-64 architectures too), off_t is
8 bytes, and so is "long int". So we don't need to use "%lld", just "%ld".
The attached patch changes configure.ac to check the sizeof(long), and makes
logic config.h slightly smarter to pick the right one.

I've tested on x86-64 and x86, and it seems to do the right thing on both.
x86 still has warnings, due to the C90/%lld thing; 64-bit compiles cleanly
with -Werror now. Might be wise for people who use mutt on other platforms
to check it, though.

(I've also included the changes to parse.c again, to save having to apply
both patches.)

-- 
Paul
diff -r 38319cd7d832 configure.ac
--- a/configure.ac      Mon May 19 09:52:40 2008 -0700
+++ b/configure.ac      Tue May 20 15:13:45 2008 +0100
@@ -44,6 +44,8 @@ AC_SYS_LARGEFILE
 AC_SYS_LARGEFILE
 AC_FUNC_FSEEKO
 AC_CHECK_SIZEOF(off_t)
+AC_CHECK_SIZEOF(long)
+AC_CHECK_SIZEOF(long long)
 
 AC_PATH_PROG(DBX, dbx, no)
 AC_PATH_PROG(GDB, gdb, no)
@@ -88,7 +90,7 @@ AH_BOTTOM([/* fseeko portability defines
 AH_BOTTOM([/* fseeko portability defines */
 #ifdef HAVE_FSEEKO
 # define LOFF_T off_t
-# if SIZEOF_OFF_T == 8
+# if (SIZEOF_OFF_T == 8) && (SIZEOF_LONG == 4)
 #  define OFF_T_FMT "%lld"
 # else
 #  define OFF_T_FMT "%ld"
diff -r 38319cd7d832 parse.c
--- a/parse.c   Mon May 19 09:52:40 2008 -0700
+++ b/parse.c   Tue May 20 15:13:45 2008 +0100
@@ -1600,14 +1600,14 @@ int count_body_parts (BODY *body, int fl
       count++;
     bp->attach_qualifies = shallcount ? 1 : 0;
 
-    dprint(5, (debugfile, "cbp: %08x shallcount = %d\n", (unsigned int)bp, 
shallcount));
+    dprint(5, (debugfile, "cbp: %p shallcount = %d\n", (void *)bp, 
shallcount));
 
     if (shallrecurse)
     {
-      dprint(5, (debugfile, "cbp: %08x pre count = %d\n", (unsigned int)bp, 
count));
+      dprint(5, (debugfile, "cbp: %p pre count = %d\n", (void *)bp, count));
       bp->attach_count = count_body_parts(bp->parts, flags & 
~M_PARTS_TOPLEVEL);
       count += bp->attach_count;
-      dprint(5, (debugfile, "cbp: %08x post count = %d\n", (unsigned int)bp, 
count));
+      dprint(5, (debugfile, "cbp: %p post count = %d\n", (void *)bp, count));
     }
   }
 

Attachment: signature.asc
Description: Digital signature