On Mon, Mar 27, 2017 at 02:50:47PM +0300, Danil Antonov wrote:
> diff --git a/hw/acpi/pcihp.c b/hw/acpi/pcihp.c
> index 2b0f3e1..bf880c1 100644
> --- a/hw/acpi/pcihp.c
> +++ b/hw/acpi/pcihp.c
> @@ -39,13 +39,16 @@
> #include "qom/qom-qobject.h"
> #include "qapi/qmp/qint.h"
>
> -//#define DEBUG
>
> -#ifdef DEBUG
> -# define ACPI_PCIHP_DPRINTF(format, ...) printf(format, ## __VA_ARGS__)
> -#else
> -# define ACPI_PCIHP_DPRINTF(format, ...) do { } while (0)
> -#endif
> +#ifndef DEBUG
> +#define DEBUG 0
> +#endif
> +
> +#define ACPI_PCIHP_DPRINTF(fmt, ...) do { \
> + if (DEBUG) { \
> + fprintf(stderr, fmt, ## __VA_ARGS__); \
> + } \
> +} while (0);
The semicolon isn't necessary. The caller provides it.
ACPI_PCIHP_DPRINTF("foo\n");
It's normal to define statement-like macros with do { ... } while (0)
and no semicolon in the definition.
signature.asc
Description: PGP signature
