From patchwork Sat Apr 1 13:58:55 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Danil Antonov X-Patchwork-Id: 9658001 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 36CB360349 for ; Sat, 1 Apr 2017 14:00:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2F8F1285C2 for ; Sat, 1 Apr 2017 14:00:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 249EE28613; Sat, 1 Apr 2017 14:00:33 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id D2936285C2 for ; Sat, 1 Apr 2017 14:00:32 +0000 (UTC) Received: from localhost ([::1]:51436 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cuJZw-0007rt-1E for patchwork-qemu-devel@patchwork.kernel.org; Sat, 01 Apr 2017 10:00:32 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55160) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cuJYT-0007PZ-1k for qemu-devel@nongnu.org; Sat, 01 Apr 2017 09:59:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cuJYO-0004ur-PA for qemu-devel@nongnu.org; Sat, 01 Apr 2017 09:58:57 -0400 Received: from mail-oi0-x242.google.com ([2607:f8b0:4003:c06::242]:33774) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cuJYO-0004ua-J4 for qemu-devel@nongnu.org; Sat, 01 Apr 2017 09:58:56 -0400 Received: by mail-oi0-x242.google.com with SMTP id f193so13230618oib.0 for ; Sat, 01 Apr 2017 06:58:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=pUk4tXuiBT7+Ii0b4vfBqpOdzpbCw/P5m6c8AKLYiCA=; b=Kg4P81YO8LFQf4rSnPoTYrZIoupeONaPVuRFRr+roI3KwJsG2yPTotqOQkGCyzRclF UDfEQI00iL2NX/7fKy0V6GXRWJv4SK92SJ9KsP8llRj7HdinHK3KgNLC6bpXFmPOgV+i uxyRcrGeJ11uGzG53KOpPwgXxSSQ4sjKfhyDvppIzkH+Q+OUxvOY2N7ndZEEzth48Mpy 8D98s1+93vbDI2B5lAVgikFA0dSIaDuqcVV1oFdncXu279MFDApVCvwizSuc1UgGEyV9 vXfAcI2fdjm3LDYkPEr/q8uQBX90xwTRGSRD3wq6EyQwyhFp7UIJGRdoo28M+z7HnRRC wPNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=pUk4tXuiBT7+Ii0b4vfBqpOdzpbCw/P5m6c8AKLYiCA=; b=GZbpjnlb7Tr33ZW3EWHfiGNXgAKn1pOMfxzqgWiYB/JsrP33xdSiVZ2Hblr/WX/suE vz93U6LSL9ae6ZqUXYUG7EuMU/M/VgDins8xqGWg0eIwwd7KZMv7mCHKPJzOaKNFr3TS ZkI/zN09inxxC+9xs0VceLSlGQhCKgUki9HCUCGSKAPosbrxmayzMhBUVj9iYiUCbagH QUDsRTvL1pXSkdZ45uHSVJsIf5wBozP8fxzzpAXoo3OonaZOzJ3Xy+8Ay4ISi9R5fjz0 8Rd4KTnUpJR9Nu6D26PLvl23F3L31soI7AT8wKp4N8trwZIFWFk8bIiPAT3MvYMbzxxO N1NQ== X-Gm-Message-State: AFeK/H2e3+tHRBb/W6f9UbvokXGGSg521gkSYhNxk2YpCXzbiqMj3BGI33RoM6B4ndvXlJoFB9SAC1EF0FiR/g== X-Received: by 10.202.104.130 with SMTP id o2mr4164034oik.93.1491055135901; Sat, 01 Apr 2017 06:58:55 -0700 (PDT) MIME-Version: 1.0 Received: by 10.157.32.234 with HTTP; Sat, 1 Apr 2017 06:58:55 -0700 (PDT) From: Danil Antonov Date: Sat, 1 Apr 2017 16:58:55 +0300 Message-ID: To: qemu-devel@nongnu.org, quintela@redhat.com X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:4003:c06::242 X-Content-Filtered-By: Mailman/MimeDel 2.1.21 Subject: [Qemu-devel] [PATCH 24/43] migration: made printf always compile in debug output X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From e5719e802fcd1d1b426d687524ed46f10d044941 Mon Sep 17 00:00:00 2001 From: Danil Antonov Date: Wed, 29 Mar 2017 12:35:10 +0300 Subject: [PATCH 24/43] migration: made printf always compile in debug output Wrapped printf calls inside debug macros (DPRINTF) in `if` statement. This will ensure that printf function will always compile even if debug output is turned off and, in turn, will prevent bitrot of the format strings. Signed-off-by: Danil Antonov Reviewed-by: Juan Quintela --- migration/block.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/migration/block.c b/migration/block.c index 7734ff7..a5b4e49 100644 --- a/migration/block.c +++ b/migration/block.c @@ -42,13 +42,15 @@ //#define DEBUG_BLK_MIGRATION -#ifdef DEBUG_BLK_MIGRATION -#define DPRINTF(fmt, ...) \ - do { printf("blk_migration: " fmt, ## __VA_ARGS__); } while (0) -#else -#define DPRINTF(fmt, ...) \ - do { } while (0) -#endif +#ifndef DEBUG_BLK_MIGRATION +#define DEBUG_BLK_MIGRATION 0 +#endif + +#define DPRINTF(fmt, ...) do { \ + if (DEBUG_BLK_MIGRATION) { \ + fprintf(stderr, "blk_migration: " fmt, ## __VA_ARGS__); \ + } \ +} while (0); typedef struct BlkMigDevState { /* Written during setup phase. Can be read without a lock. */