[git commit] placate gcc-8.0.1 warnings

Denys Vlasenko vda.linux at googlemail.com
Fri Apr 6 16:26:33 UTC 2018


commit: https://git.busybox.net/busybox/commit/?id=2ab994f7079daa052f8816b72e215e1609d41f76
branch: https://git.busybox.net/busybox/commit/?id=refs/heads/master

Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
 libbb/dump.c | 6 +++---
 runit/sv.c   | 2 ++
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/libbb/dump.c b/libbb/dump.c
index db91fcfe7..5941ef902 100644
--- a/libbb/dump.c
+++ b/libbb/dump.c
@@ -464,11 +464,9 @@ static const char conv_str[] ALIGN1 =
 	"\v"  "\\""v""\0"
 	;
 
-
 static void conv_c(PR *pr, unsigned char *p)
 {
 	const char *str = conv_str;
-	char buf[10];
 
 	do {
 		if (*p == *str) {
@@ -482,7 +480,9 @@ static void conv_c(PR *pr, unsigned char *p)
 		*pr->cchar = 'c';
 		printf(pr->fmt, *p);
 	} else {
-		sprintf(buf, "%03o", (int) *p);
+		char buf[4];
+		/* gcc-8.0.1 needs lots of casts to shut up */
+		sprintf(buf, "%03o", (unsigned)(uint8_t)*p);
 		str = buf;
  strpr:
 		*pr->cchar = 's';
diff --git a/runit/sv.c b/runit/sv.c
index 86d181872..8054daedf 100644
--- a/runit/sv.c
+++ b/runit/sv.c
@@ -222,6 +222,7 @@ struct globals {
 #define str_equal(s,t) (strcmp((s), (t)) == 0)
 
 
+#if ENABLE_SV || ENABLE_SVC
 static void fatal_cannot(const char *m1) NORETURN;
 static void fatal_cannot(const char *m1)
 {
@@ -688,6 +689,7 @@ static int sv(char **argv)
 	}
 	return rc > 99 ? 99 : rc;
 }
+#endif
 
 #if ENABLE_SV
 int sv_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;


More information about the busybox-cvs mailing list