From patchwork Wed Oct 31 04:13:24 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Crosthwaite X-Patchwork-Id: 195729 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id C18742C009F for ; Wed, 31 Oct 2012 15:13:35 +1100 (EST) Received: from localhost ([::1]:59719 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TTPgL-0001Ep-I8 for incoming@patchwork.ozlabs.org; Wed, 31 Oct 2012 00:13:33 -0400 Received: from eggs.gnu.org ([208.118.235.92]:40377) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TTPgE-0001EH-T1 for qemu-devel@nongnu.org; Wed, 31 Oct 2012 00:13:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TTPgD-0007Dg-T6 for qemu-devel@nongnu.org; Wed, 31 Oct 2012 00:13:26 -0400 Received: from mail-vb0-f45.google.com ([209.85.212.45]:45929) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TTPgD-0007DZ-Pp for qemu-devel@nongnu.org; Wed, 31 Oct 2012 00:13:25 -0400 Received: by mail-vb0-f45.google.com with SMTP id p1so1032479vbi.4 for ; Tue, 30 Oct 2012 21:13:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding:x-gm-message-state; bh=uPsaAscq+OTNEzUTJoZ1r/iSzX1LPrw4HVWB+Icz2qQ=; b=EtEyj9xJTPhNLogrD8kWeYwrq9jzlDQuZQwtTFDk7G2O8mr5k9+hfcSeW/U4e6QXz3 fPf/DCZy6a03JuWsQJ6Gfh35kvNnzviKljr+I8mgBQKf5N4wYlbLnyVHhHRBWGNfT2Zx X2MndWk0Bxc03BKjdV6sVfe/qIYrxJpF3hMKZ6Y6IX12CRJM6UtWjLFJ6NtrW/xuw4QR w/RQSJoXp9Kdm8pgDX6f6yJW8yayWCsaDwDTHa8gE9kuSEIhCNYdhqMI/2RnXKZAokrz mdz02yHWGGqaiaUaLx5vMyM9+Y3xzvJYZ4OA7vlvyo5y37ugobp6jli4pdTLI/ANlpOe 2utA== MIME-Version: 1.0 Received: by 10.52.35.82 with SMTP id f18mr45175091vdj.99.1351656804124; Tue, 30 Oct 2012 21:13:24 -0700 (PDT) Received: by 10.58.102.135 with HTTP; Tue, 30 Oct 2012 21:13:24 -0700 (PDT) In-Reply-To: <50909962.2050009@suse.de> References: <50909962.2050009@suse.de> Date: Wed, 31 Oct 2012 14:13:24 +1000 X-Google-Sender-Auth: C3cB9eSn9QVq7zr76jcgQKJvXAQ Message-ID: From: Peter Crosthwaite To: =?ISO-8859-1?Q?Andreas_F=E4rber?= X-Gm-Message-State: ALoCoQkKWQR8wJGBxvaaTklV9wFV0jgcVjHkUK+/FLnsFb1RKcw+Bxu4KIAy3y5C8v6DG5mmVh/b X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.212.45 Cc: Stefan Hajnoczi , Igor Mitsyanko , "qemu-devel@nongnu.org Developers" Subject: Re: [Qemu-devel] [RFC] Configure option to turn on all debug printerfy X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org On Wed, Oct 31, 2012 at 1:22 PM, Andreas Färber wrote: > Am 31.10.2012 04:10, schrieb Peter Crosthwaite: >> So in a couple of cases now I have done work on mature device models >> that include #ifdef'd debug printfery that is broken, and have >> submitted (trivial) patches to fix. Whats happening is tree wide or >> automated changes (changing types of variables etc) is causing the >> debug printfery to break, usually werror issues on %x in printfs due >> to types. Issue is, it never gets detected until someone tries to use >> the debug mode: ./configure --extra-cflags="-DFOO_DEBUG". Can we have >> some sort of alternate symbol "ALL_DEBUG" or something, such that >> every debug printf is compiled? Then when developers make tree wide >> changes they can at least compile test for breakages in debug printfs >> using ./configure --extra-cflags="-DALL_DEBUG"? It would be fairly >> trivial to implement. > > The original idea I thought was to replace all the DPRINTFs by tracing... > Thats a much longer term goal isn't it? Also wont tracing have the same problem, given that trace functionality is compiled on a per module basis? Would need an ALL_TRACE. > An alternative might be to change the definition from empty DPRINTF(...) > to DPRINTF(...) if (0) { ... }. Should work. Proof of concept diff below (untested). Then no ALL_DEBUG symbol would be > needed. I don't think anyone would like to get flooded with ALL_DEBUG! > So the idea is no one actually needs to run a QEMU built with ALL_DEBUG. Just maintainers can compile test it for werror breakage. Regards, Peter > Regards, > Andreas > > -- > SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany > GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg > --- a/hw/pflash_cfi01.c +++ b/hw/pflash_cfi01.c @@ -50,13 +50,16 @@ do { \ } while(0) /* #define PFLASH_DEBUG */ -#ifdef PFLASH_DEBUG -#define DPRINTF(fmt, ...) \ +#define DO_DPRINTF(fmt, ...) \ do { \ printf("PFLASH: " fmt , ## __VA_ARGS__); \ } while (0) +#ifdef PFLASH_DEBUG +#define DPRINTF(fmt, ...) DO_PRINTF(fmt, ## __VA_ARGS__) #else -#define DPRINTF(fmt, ...) do { } while (0) +#define DPRINTF(fmt, ...) if(0) { \ + DO_PRINTF(fmt, ## __VA_ARGS__) \ +} #endif