dash.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Herbert Xu <herbert@gondor.apana.org.au>
To: Jonathan Nieder <jrnieder@gmail.com>
Cc: Szabolcs Nagy <nsz@port70.net>, dash@vger.kernel.org
Subject: Re: build issues when using pcc
Date: Thu, 7 Jul 2011 15:22:27 +0800	[thread overview]
Message-ID: <20110707072227.GG16157@gondor.apana.org.au> (raw)
In-Reply-To: <20110522164605.GA8654@elie>

On Sun, May 22, 2011 at 04:46:05PM +0000, Jonathan Nieder wrote:
>
> Subject: [OUTPUT] Make outc an inline function
> 
> As "gcc -pedantic" warns, ISO C forbids conditional expressions with
> only one void side.  So the (needslow ?  slowpath() : fastpath) code
> for outc in the !USE_GLIBC_STDIO case might not be portable.
> 
> More importantly, it's hard to read.  Rip it out and replace it
> with an inline function which should generate the same code.
> 
> Reported-by: Szabolcs Nagy <nsz@port70.net>
> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>

Patch applied.

I've also added this one-liner on top to eliminate an unnecessary
promotion caused by this patch.

commit 155b0b518f485b8b5cb574cd2f0dc936c3fd1902
Author: Herbert Xu <herbert@gondor.apana.org.au>
Date:   Thu Jul 7 15:22:03 2011 +0800

    [BUILTIN] Eliminate unnecessary promotion in echocmd
    
    The patch to make outc into an inline function created an unnecessary
    promotion in echocmd due to its use of char vs. the int used by outc.
    This patch changes echocmd to use int instead.
    
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

diff --git a/ChangeLog b/ChangeLog
index ade43e9..2093fc7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,7 @@
 2011-07-07  Herbert Xu <herbert@gondor.apana.org.au>
 
 	* Optimize dash -c "command" to avoid a fork.
+	* Eliminate unnecessary promotion in echocmd.
 
 2011-05-22  Jonathan Nieder <jrnieder@gmail.com>
 
diff --git a/src/bltin/printf.c b/src/bltin/printf.c
index b0c3774..893295c 100644
--- a/src/bltin/printf.c
+++ b/src/bltin/printf.c
@@ -443,7 +443,7 @@ echocmd(int argc, char **argv)
 	}
 
 	do {
-		char c;
+		int c;
 
 		nonl += conv_escape_str(*argv);
 		outstr(stackblock(), outs);

Thanks,
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

      parent reply	other threads:[~2011-07-07  7:22 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-22 12:34 build issues when using pcc Szabolcs Nagy
2011-05-22 16:46 ` Jonathan Nieder
     [not found]   ` <20110522173900.GG6142@port70.net>
2011-05-22 17:41     ` Jonathan Nieder
2011-07-07  7:22   ` Herbert Xu [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=20110707072227.GG16157@gondor.apana.org.au \
    --to=herbert@gondor.apana.org.au \
    --cc=dash@vger.kernel.org \
    --cc=jrnieder@gmail.com \
    --cc=nsz@port70.net \
    /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).