qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v2 04/16] highbank: Convert conditional compilat


From: Marc Marí
Subject: Re: [Qemu-devel] [PATCH v2 04/16] highbank: Convert conditional compilation of debug printfs to regular ifs
Date: Tue, 13 May 2014 12:06:31 +0200

El Tue, 13 May 2014 09:02:40 +0200
Marc Marí <address@hidden> escribió:
> Modify debug macros to have the same format through the codebase and
> use regular ifs instead of ifdef.
> 
> As the debug printf is always put in code, some casting had to be
> added to avoid warnings treated as errors at compile time.
> 
> Signed-off-by: Marc Marí <address@hidden>
> ---
>  hw/net/xgmac.c |   10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/hw/net/xgmac.c b/hw/net/xgmac.c
> index 88349ac..734c2e5 100644
> --- a/hw/net/xgmac.c
> +++ b/hw/net/xgmac.c
> @@ -30,14 +30,16 @@
>  #include "net/net.h"
>  #include "net/checksum.h"
>  
> +//#define DEBUG_XGMAC
> +
>  #ifdef DEBUG_XGMAC
> -#define DEBUGF_BRK(message, args...) do { \
> -                                         fprintf(stderr, (message),
> ## args); \
> -                                     } while (0)
> +#define DEBUG_XGMAC_ENABLED 1
>  #else
> -#define DEBUGF_BRK(message, args...) do { } while (0)
> +#define DEBUG_XGMAC_ENABLED 0
>  #endif
>  
> +#define DEBUGF_BRK(message, args...)
> QEMU_DPRINTF(DEBUG_XGMAC_ENABLED, "xgmag", message, ## args) +
>  #define XGMAC_CONTROL           0x00000000   /* MAC Configuration */
>  #define XGMAC_FRAME_FILTER      0x00000001   /* MAC Frame Filter */
>  #define XGMAC_FLOW_CTRL         0x00000006   /* MAC Flow Control */

In this file, the function name is already written when the macros are
called, so now it will appear two times. The calls to the macro can be
changed to not add the function name, which, in my opinion, is a bit
nicer.

Marc



reply via email to

[Prev in Thread] Current Thread [Next in Thread]