aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2018-03-14 16:38:34 -0700
committerRob Landley <rob@landley.net>2018-03-14 20:11:15 -0500
commitdca9fcccbc192e4b33b15e4139c21c7b514f523a (patch)
tree88ba458a5da38aa45942e3d7053b676b89af47ad /lib
parent028f9bbb65c4211866c69b5e5255aecd5254b18d (diff)
downloadtoybox-dca9fcccbc192e4b33b15e4139c21c7b514f523a.tar.gz
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
Diffstat (limited to 'lib')
-rw-r--r--lib/args.c2
1 files changed, 1 insertions, 1 deletions
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