From dca9fcccbc192e4b33b15e4139c21c7b514f523a Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Wed, 14 Mar 2018 16:38:34 -0700 Subject: Fix last uninitialized warning. clang is fine with the noreturn nature of error_exit, but only if we don't `if (false)` it out for non-debug builds. lib/args.c:304:18: error: variable 'temp' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized] } else if (CFG_TOYBOX_FLOAT && new->type == '.') { ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ external/toybox/generated/config.h:11:26: note: expanded from macro 'CFG_TOYBOX_FLOAT' ^ external/toybox/lib/args.c:308:19: note: uninitialized use occurs here options = --temp; ^~~~ external/toybox/lib/args.c:304:14: note: remove the 'if' if its condition is always true } else if (CFG_TOYBOX_FLOAT && new->type == '.') { ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ external/toybox/lib/args.c:255:15: note: initialize the variable 'temp' to silence this warning char *temp; ^ = NULL --- lib/args.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/args.c b/lib/args.c index 7b9350f8..5267ebe2 100644 --- a/lib/args.c +++ b/lib/args.c @@ -304,7 +304,7 @@ void parse_optflaglist(struct getoptflagstate *gof) } else if (CFG_TOYBOX_FLOAT && new->type == '.') { FLOAT f = strtod(++options, &temp); if (temp != options) new->val[idx].f = f; - } else if (CFG_TOYBOX_DEBUG) error_exit("<>= only after .#"); + } else error_exit("<>= only after .#"); options = --temp; // At this point, we've hit the end of the previous option. The -- cgit v1.2.3