Message ID | 1264547685-21129-7-git-send-email-pbonzini@redhat.com |
---|---|
State | New |
Headers | show |
What did clang complain about? It's not obvious to me. Regards, Anthony Liguori On 01/26/2010 05:14 PM, Paolo Bonzini wrote: > Signed-off-by: Paolo Bonzini<pbonzini@redhat.com> > --- > audio/audio.c | 44 ++++++++++++++++++++------------------------ > audio/audio_int.h | 3 ++- > 2 files changed, 22 insertions(+), 25 deletions(-) > > diff --git a/audio/audio.c b/audio/audio.c > index 2a20e5b..7fce46c 100644 > --- a/audio/audio.c > +++ b/audio/audio.c > @@ -118,42 +118,38 @@ struct mixeng_volume nominal_volume = { > static void audio_print_options (const char *prefix, > struct audio_option *opt); > > -int audio_bug (const char *funcname, int cond) > +void audio_bug_found (const char *funcname) > { > - if (cond) { > - static int shown; > - > - AUD_log (NULL, "A bug was just triggered in %s\n", funcname); > - if (!shown) { > - struct audio_driver *d; > - > - shown = 1; > - AUD_log (NULL, "Save all your work and restart without audio\n"); > - AUD_log (NULL, "Please send bug report to av1474@comtv.ru\n"); > - AUD_log (NULL, "I am sorry\n"); > - d = glob_audio_state.drv; > - if (d) { > - audio_print_options (d->name, d->options); > - } > + static int shown; > + > + AUD_log (NULL, "A bug was just triggered in %s\n", funcname); > + if (!shown) { > + struct audio_driver *d; > + > + shown = 1; > + AUD_log (NULL, "Save all your work and restart without audio\n"); > + AUD_log (NULL, "Please send bug report to av1474@comtv.ru\n"); > + AUD_log (NULL, "I am sorry\n"); > + d = glob_audio_state.drv; > + if (d) { > + audio_print_options (d->name, d->options); > } > - AUD_log (NULL, "Context:\n"); > + } > + AUD_log (NULL, "Context:\n"); > > #if defined AUDIO_BREAKPOINT_ON_BUG > # if defined HOST_I386 > # if defined __GNUC__ > - __asm__ ("int3"); > + __asm__ ("int3"); > # elif defined _MSC_VER > - _asm _emit 0xcc; > + _asm _emit 0xcc; > # else > - abort (); > + abort (); > # endif > # else > - abort (); > + abort (); > # endif > #endif > - } > - > - return cond; > } > #endif > > diff --git a/audio/audio_int.h b/audio/audio_int.h > index 06e313f..4244615 100644 > --- a/audio/audio_int.h > +++ b/audio/audio_int.h > @@ -223,7 +223,8 @@ int audio_pcm_sw_read (SWVoiceIn *sw, void *buf, int len); > int audio_pcm_hw_clip_out (HWVoiceOut *hw, void *pcm_buf, > int live, int pending); > > -int audio_bug (const char *funcname, int cond); > +#define audio_bug(funcname, cond) ((cond) ? audio_bug_found (funcname), 1 : 0) > +void audio_bug_found (const char *funcname); > void *audio_calloc (const char *funcname, int nmemb, size_t size); > > void audio_run (const char *msg); >
On 01/27/2010 03:10 AM, Anthony Liguori wrote:
> What did clang complain about? It's not obvious to me.
It doesn't see that audio_bug returns cond, and gives quite a few false
positive in its callers.
Paolo
On 01/27/2010 05:56 AM, Paolo Bonzini wrote: > On 01/27/2010 03:10 AM, Anthony Liguori wrote: >> What did clang complain about? It's not obvious to me. > > It doesn't see that audio_bug returns cond, and gives quite a few > false positive in its callers. Ah, this is a clang issue. I'll have to defer to malc on this one. Regards, Anthony Liguori > Paolo > > > >
On Wed, 27 Jan 2010, Anthony Liguori wrote: > On 01/27/2010 05:56 AM, Paolo Bonzini wrote: > > On 01/27/2010 03:10 AM, Anthony Liguori wrote: > > > What did clang complain about? It's not obvious to me. > > > > It doesn't see that audio_bug returns cond, and gives quite a few false > > positive in its callers. > > Ah, this is a clang issue. I'll have to defer to malc on this one. > I'm against it.
On 01/31/2010 04:08 AM, malc wrote: > On Wed, 27 Jan 2010, Anthony Liguori wrote: > >> On 01/27/2010 05:56 AM, Paolo Bonzini wrote: >>> On 01/27/2010 03:10 AM, Anthony Liguori wrote: >>>> What did clang complain about? It's not obvious to me. >>> >>> It doesn't see that audio_bug returns cond, and gives quite a few false >>> positive in its callers. >> >> Ah, this is a clang issue. I'll have to defer to malc on this one. > > I'm against it. Ok, I'll withdraw this patch. I already posted v2. Paolo
diff --git a/audio/audio.c b/audio/audio.c index 2a20e5b..7fce46c 100644 --- a/audio/audio.c +++ b/audio/audio.c @@ -118,42 +118,38 @@ struct mixeng_volume nominal_volume = { static void audio_print_options (const char *prefix, struct audio_option *opt); -int audio_bug (const char *funcname, int cond) +void audio_bug_found (const char *funcname) { - if (cond) { - static int shown; - - AUD_log (NULL, "A bug was just triggered in %s\n", funcname); - if (!shown) { - struct audio_driver *d; - - shown = 1; - AUD_log (NULL, "Save all your work and restart without audio\n"); - AUD_log (NULL, "Please send bug report to av1474@comtv.ru\n"); - AUD_log (NULL, "I am sorry\n"); - d = glob_audio_state.drv; - if (d) { - audio_print_options (d->name, d->options); - } + static int shown; + + AUD_log (NULL, "A bug was just triggered in %s\n", funcname); + if (!shown) { + struct audio_driver *d; + + shown = 1; + AUD_log (NULL, "Save all your work and restart without audio\n"); + AUD_log (NULL, "Please send bug report to av1474@comtv.ru\n"); + AUD_log (NULL, "I am sorry\n"); + d = glob_audio_state.drv; + if (d) { + audio_print_options (d->name, d->options); } - AUD_log (NULL, "Context:\n"); + } + AUD_log (NULL, "Context:\n"); #if defined AUDIO_BREAKPOINT_ON_BUG # if defined HOST_I386 # if defined __GNUC__ - __asm__ ("int3"); + __asm__ ("int3"); # elif defined _MSC_VER - _asm _emit 0xcc; + _asm _emit 0xcc; # else - abort (); + abort (); # endif # else - abort (); + abort (); # endif #endif - } - - return cond; } #endif diff --git a/audio/audio_int.h b/audio/audio_int.h index 06e313f..4244615 100644 --- a/audio/audio_int.h +++ b/audio/audio_int.h @@ -223,7 +223,8 @@ int audio_pcm_sw_read (SWVoiceIn *sw, void *buf, int len); int audio_pcm_hw_clip_out (HWVoiceOut *hw, void *pcm_buf, int live, int pending); -int audio_bug (const char *funcname, int cond); +#define audio_bug(funcname, cond) ((cond) ? audio_bug_found (funcname), 1 : 0) +void audio_bug_found (const char *funcname); void *audio_calloc (const char *funcname, int nmemb, size_t size); void audio_run (const char *msg);
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> --- audio/audio.c | 44 ++++++++++++++++++++------------------------ audio/audio_int.h | 3 ++- 2 files changed, 22 insertions(+), 25 deletions(-)