[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-arm] [Qemu-devel] [PATCH v2] net: cadence_gem: fix compilation
From: |
Eric Blake |
Subject: |
Re: [Qemu-arm] [Qemu-devel] [PATCH v2] net: cadence_gem: fix compilation error when debug is on |
Date: |
Wed, 12 Jun 2019 14:28:21 -0500 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 |
On 6/12/19 1:03 PM, Alex Bennée wrote:
>
> Ramon Fried <address@hidden> writes:
>
>> defining CADENCE_GEM_ERR_DEBUG causes compilation
>> errors, fix that.
>
> It would be worth doing something like:
>
> #ifdef CADENCE_GEM_ERR_DEBUG
> #define CADENCE_GEM_GATE 1
> #else
> #define CADENCE_GEM_GATE 0
> #endif
>
> #define DB_PRINT(...) do { \
> if (CADENCE_GEM_GATE) { \
> fprintf(stderr, ": %s: ", __func__); \
> fprintf(stderr, ## __VA_ARGS__); \
> } \
> } while (0)
>
> So these format strings don't go stale in and only get detected on
> --debug builds.
>
> While your at it I suspect the fprintf debug would be better of as:
>
> qemu_log("%s: " fmt, __func__, ## args);
Indeed, or even see if it is worth converting to full-on trace points
for dynamic control of whether to catch these things without having to
recompile debug on or off.
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3226
Virtualization: qemu.org | libvirt.org
signature.asc
Description: OpenPGP digital signature