From patchwork Wed Jan 27 13:54:59 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 43810 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 511C8B7EC8 for ; Thu, 28 Jan 2010 01:12:07 +1100 (EST) Received: from localhost ([127.0.0.1]:43054 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Na8ZQ-00061q-3i for incoming@patchwork.ozlabs.org; Wed, 27 Jan 2010 09:08:36 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Na8MW-0000ml-M0 for qemu-devel@nongnu.org; Wed, 27 Jan 2010 08:55:16 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Na8MP-0000iQ-QT for qemu-devel@nongnu.org; Wed, 27 Jan 2010 08:55:14 -0500 Received: from [199.232.76.173] (port=46720 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Na8MP-0000i7-IX for qemu-devel@nongnu.org; Wed, 27 Jan 2010 08:55:09 -0500 Received: from mx1.redhat.com ([209.132.183.28]:13894) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Na8MO-0004dg-Py for qemu-devel@nongnu.org; Wed, 27 Jan 2010 08:55:09 -0500 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o0RDt7tL029698 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 27 Jan 2010 08:55:07 -0500 Received: from localhost.localdomain (vpn1-4-227.ams2.redhat.com [10.36.4.227]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o0RDt0CM014994 for ; Wed, 27 Jan 2010 08:55:06 -0500 From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 27 Jan 2010 14:54:59 +0100 Message-Id: <1264600499-3384-7-git-send-email-pbonzini@redhat.com> In-Reply-To: <1264600499-3384-1-git-send-email-pbonzini@redhat.com> References: <1264600499-3384-1-git-send-email-pbonzini@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. Subject: [Qemu-devel] [PATCH 6/6] fix audio_bug related clang false positives X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org By making the abort condition visible in the caller, this fixes several false positives in the audio code. Signed-off-by: Paolo Bonzini --- 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);