diff mbox

[07/10] ac97: sizeof returns unsigned long

Message ID e328160589068e08ae5b6700bbd96567b80cd475.1256731509.git.quintela@redhat.com
State New
Headers show

Commit Message

Juan Quintela Oct. 28, 2009, 12:29 p.m. UTC
This change makes DEBUG_AC97 to compile again

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 hw/ac97.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

Comments

malc Oct. 28, 2009, 12:53 p.m. UTC | #1
On Wed, 28 Oct 2009, Juan Quintela wrote:

> This change makes DEBUG_AC97 to compile again

sizeof returns size_t (%zX), so this is wrong
Paolo Bonzini Oct. 28, 2009, 1:11 p.m. UTC | #2
On 10/28/2009 01:53 PM, malc wrote:
> On Wed, 28 Oct 2009, Juan Quintela wrote:
>
>> This change makes DEBUG_AC97 to compile again
>
> sizeof returns size_t (%zX), so this is wrong

size_t is long on all practical platforms except ia64-hpux and Win64, so 
this is not more wrong than it was before.

Paolo
malc Oct. 28, 2009, 3:41 p.m. UTC | #3
On Wed, 28 Oct 2009, Paolo Bonzini wrote:

> On 10/28/2009 01:53 PM, malc wrote:
> > On Wed, 28 Oct 2009, Juan Quintela wrote:
> > 
> > > This change makes DEBUG_AC97 to compile again
> > 
> > sizeof returns size_t (%zX), so this is wrong
> 
> size_t is long on all practical platforms except ia64-hpux and Win64, so this
> is not more wrong than it was before.

Yea right, except that's it's not long on any 32bit platform, at least not
from gcc's -Wformat point of view.
Paolo Bonzini Oct. 28, 2009, 3:50 p.m. UTC | #4
On 10/28/2009 04:41 PM, malc wrote:
>>> >  >  sizeof returns size_t (%zX), so this is wrong
>> >
>> >  size_t is long on all practical platforms except ia64-hpux and Win64, so this
>> >  is not more wrong than it was before.
> Yea right, except that's it's not long on any 32bit platform, at least not
> from gcc's -Wformat point of view.

Still an improvement (wrong code vs. warning)...  you are a committer, 
you can fix it yourself if it bothers you...

Paolo
malc Oct. 28, 2009, 4:25 p.m. UTC | #5
On Wed, 28 Oct 2009, Paolo Bonzini wrote:

> On 10/28/2009 04:41 PM, malc wrote:
> > > > >  >  sizeof returns size_t (%zX), so this is wrong
> > > >
> > > >  size_t is long on all practical platforms except ia64-hpux and Win64,
> > > so this
> > > >  is not more wrong than it was before.
> > Yea right, except that's it's not long on any 32bit platform, at least not
> > from gcc's -Wformat point of view.
> 
> Still an improvement (wrong code vs. warning)...  you are a committer, 
> you can fix it yourself if it bothers you...

It's wrong code vs wrong code on Win64 and a warning equals failed build
in presence of -Werror.
diff mbox

Patch

diff --git a/hw/ac97.c b/hw/ac97.c
index 610ca60..e4ecbe9 100644
--- a/hw/ac97.c
+++ b/hw/ac97.c
@@ -323,7 +323,7 @@  static void reset_bm_regs (AC97LinkState *s, AC97BusMasterRegs *r)
 static void mixer_store (AC97LinkState *s, uint32_t i, uint16_t v)
 {
     if (i + 2 > sizeof (s->mixer_data)) {
-        dolog ("mixer_store: index %d out of bounds %d\n",
+        dolog ("mixer_store: index %d out of bounds %lu\n",
                i, sizeof (s->mixer_data));
         return;
     }
@@ -337,7 +337,7 @@  static uint16_t mixer_load (AC97LinkState *s, uint32_t i)
     uint16_t val = 0xffff;

     if (i + 2 > sizeof (s->mixer_data)) {
-        dolog ("mixer_store: index %d out of bounds %d\n",
+        dolog ("mixer_store: index %d out of bounds %lu\n",
                i, sizeof (s->mixer_data));
     }
     else {