2014-04-25 14:25 GMT+02:00 Andreas Färber <
address@hidden>:
>
> Am 25.04.2014 11:22, schrieb Peter Crosthwaite:
> > On Fri, Apr 25, 2014 at 5:55 PM, Marc Marí <
address@hidden> wrote:
> >> I'm now looking at the conditional fprintf's. I'll need a bit of help later
> >> in sending the patches :D.
>
> For starters, please use plain text format mails and don't top-post. :)
>
> > CC me in on the results.
>
> Me, too, please. If you search the archives, you will find that I
> already tried this for target-* and there were a lot of discussions
> surrounding DOs and DON'Ts.
>
https://github.com/afaerber/qemu-cpu/commits/dprintf is still in a state
> I was instructed to, but that was later considered too
> performance-intrusive due to variable usage.
>
> In particular I believe we concluded that unlike Peter's pseudocode we
> need separate preprocessor macro naming between how the user enables it
> and how we check it inside the macro. Also macros should not end in a
> semicolon.
>
I see your code is a lot more intrusive. I'm doing as Peter said: separating the print code macro as a conditional with parameter the other macro, from this (in xen-all.c):
#ifdef DEBUG_XEN
#define DPRINTF(fmt, ...) \
do { fprintf(stderr, "xen: " fmt, ## __VA_ARGS__); } while (0)
#else
#define DPRINTF(fmt, ...) \
do { } while (0)
#endif
to this:
#ifndef DEBUG_XEN
#define DEBUG_XEN 0
#endif
#define DPRINTF(fmt, ...) \
do { \
if(DEBUG_XEN) { \
fprintf(stderr, "xen: " fmt, ## __VA_ARGS__); \
} \
} while (0)
I expect this is the way you were thinking. I've modified three files already, and when I have a few more, I'll start looking to how do you send the patches properly formatted to the list.
> Regards,
> Andreas
>
> P.S. "Here" probably didn't strictly mean replying to Jan's message. ;)
>
P.S. I'm going offtopic to this thread, and probably I should start another.
> --
> SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
> GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg