On 2009-12-17 21:15, Willy Tarreau wrote:
Hi Krzysztof,
Hi Willy,

On Tue, Dec 15, 2009 at 10:48:38PM +0100, Krzysztof Piotr Oledzki wrote:
>From 750cb365d4ea2fa886cdcc71ca2fcde22a08f9b6 Mon Sep 17 00:00:00 2001
From: Krzysztof Piotr Oledzki <[email protected]>
Date: Tue, 15 Dec 2009 22:34:51 +0100
Subject: [BUG] format '%d' expects type 'int', but argument 5 has type 'long 
int'

src/cfgparse.c: In function 'readcfgfile':
src/cfgparse.c:4087: warning: format '%d' expects type 'int', but argument 5 
has type 'long int'

That one is really funny. Since I have merged it I got the opposite warning
as the one you got above. So I first thought "ah, maybe I forgot to merge
Krzysztof's patch". But no. This precise patch made the thing appear.

I have tried with several compilers : gcc-3.4.6, gcc-4.2.4 and all yelled
at me the same way. Finally I found the culprit : 32 vs 64 bit. In 32bit,
the type is "int" and in 64bit, the type is "long" :

$ x86_64-unknown-linux-gnu-gcc -m64 -Iinclude -Iebtree -Wall -c src/cfgparse.c
$ x86_64-unknown-linux-gnu-gcc -m32 -Iinclude -Iebtree -Wall -c src/cfgparse.c
src/cfgparse.c: In function `readcfgfile':
src/cfgparse.c:4088: warning: long int format, int arg (arg 5)

I must say I don't understand as for me the long was (almost) always the
type of the difference between two pointers (it should be INTPTR_T in
fact, since LLP64 platforms such as win64 use 32-bit longs).

So I'm not fixing it definitely with a cast this time, because gcc is
getting boring in the end. Now it builds for both 32 and 64 bits without
any warning.

Ooops, pointer arithmetics. :| I fixed it without thinking. :| My bad.

Best regards,

                                Krzysztof Olędzki

Reply via email to