Re: build issues when using pcc

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

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@xxxxxxxxxx>
> Signed-off-by: Jonathan Nieder <jrnieder@xxxxxxxxx>

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@xxxxxxxxxxxxxxxxxxx>
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@xxxxxxxxxxxxxxxxxxx>

diff --git a/ChangeLog b/ChangeLog
index ade43e9..2093fc7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,7 @@
 2011-07-07  Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
 	* Optimize dash -c "command" to avoid a fork.
+	* Eliminate unnecessary promotion in echocmd.
 2011-05-22  Jonathan Nieder <jrnieder@xxxxxxxxx>
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);

Email: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
Home Page:
PGP Key:
To unsubscribe from this list: send the line "unsubscribe dash" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at

[LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

Powered by Linux