[git commit] ash: shell: Fix clang warnings about "string plus integer"

Denys Vlasenko vda.linux at googlemail.com
Sun Feb 16 18:29:31 UTC 2020


commit: https://git.busybox.net/busybox/commit/?id=3f4847b6d9198a359e98933271af4630b3c41f0a
branch: https://git.busybox.net/busybox/commit/?id=refs/heads/master

Upstream commit:

    Date: Sat, 15 Dec 2018 18:49:31 +0100
    shell: Fix clang warnings about "string plus integer"

    Building with clang results in some warnings about integer values being
    added to strings.

    While the code itself is fine and the warnings are indeed harmless,
    fixing them also makes the semantic more explicit: what it is actually
    being increased is the address which points to the start of the string
    in order to skip the initial character when some conditions are met.

    Signed-off-by: Antonio Ospite <ao2 at ao2.it>
    Signed-off-by: Herbert Xu <herbert at gondor.apana.org.au>

Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
 shell/ash.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/shell/ash.c b/shell/ash.c
index a43b65680..a25d14de0 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -4799,7 +4799,8 @@ cmdputs(const char *s)
 				str = "${";
 			goto dostr;
 		case CTLENDVAR:
-			str = "\"}" + !(quoted & 1);
+			str = "\"}";
+			str += !(quoted & 1);
 			quoted >>= 1;
 			subtype = 0;
 			goto dostr;


More information about the busybox-cvs mailing list