qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@redhat.com>
To: Anishka0107 <rimjhim0107@gmail.com>
Cc: qemu-devel@nongnu.org, jsnow@redhat.com
Subject: Re: [Qemu-devel] [PATCH v2] puv3: always compile-check debug printf
Date: Fri, 17 Mar 2017 12:29:26 +0800	[thread overview]
Message-ID: <20170317042926.GD7540@stefanha-x1.localdomain> (raw)
In-Reply-To: <1489642893-4504-1-git-send-email-rimjhim0107@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1332 bytes --]

On Thu, Mar 16, 2017 at 11:11:33AM +0530, Anishka0107 wrote:
>      To prevent bitrot of the format string of the debug statement, files with
>      conditional debug statements should ensure that printf is compiled always,
>      and enclosed within if(0) statements and not in #ifdef.
> 
> Signed-off-by: Anishka Gupta <rimjhim0107@gmail.com>
> ---
>  include/hw/unicore32/puv3.h | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/include/hw/unicore32/puv3.h b/include/hw/unicore32/puv3.h
> index e268484..9fdf0a1 100644
> --- a/include/hw/unicore32/puv3.h
> +++ b/include/hw/unicore32/puv3.h
> @@ -46,8 +46,7 @@
>  #define DPRINTF(fmt, ...)
>      if (DEBUG_PUV3) {
>          fprintf(stderr, "%s: " fmt , __func__, ## __VA_ARGS__)
> -    }
> -    else {
> +    } else {

Hi Anishka,
I think something went wrong with this patch submission.  The patch
seems to fix coding style but the surrounding code is not in qemu.git.
Please send another revision with your full code changes.

I also notice that the macro in the surrounding code will not work: you
need to use backslash ('\') so the preprocessor joins lines:

#define foo(x) \
    do { \
        printf("foo %d\n", x); \
    } while (0)

If you forget the backslashes there will be compilation errors.

Stefan

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 455 bytes --]

      reply	other threads:[~2017-03-17  4:29 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-16  5:41 [Qemu-devel] [PATCH v2] puv3: always compile-check debug printf Anishka0107
2017-03-17  4:29 ` Stefan Hajnoczi [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170317042926.GD7540@stefanha-x1.localdomain \
    --to=stefanha@redhat.com \
    --cc=jsnow@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=rimjhim0107@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).