This error is seen in build of type "minsize":
In function 'parse_args', lib/argparse/rte_argparse.c:764:31: error:
'arg_idx' may be used uninitialized [-Werror=maybe-uninitialized]
764 | if (arg_parsed[arg_idx] && !arg_attr_flag_multi(arg)) {
| ^
It looks to be a compiler issue because we are not supposed
to reach this point in case of find_option_arg() failure.
The variable is initialized to allow compiling with "minsize" option.
Signed-off-by: Thomas Monjalon <[email protected]>
---
lib/argparse/rte_argparse.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/argparse/rte_argparse.c b/lib/argparse/rte_argparse.c
index 9c3c5e7ae3..88c3e7740c 100644
--- a/lib/argparse/rte_argparse.c
+++ b/lib/argparse/rte_argparse.c
@@ -702,7 +702,7 @@ parse_args(const struct rte_argparse *obj, bool *arg_parsed,
const char *arg_name;
size_t n_args_to_move;
char **args_to_move;
- uint32_t arg_idx;
+ uint32_t arg_idx = 0;
char *curr_argv;
char *value;
int ret;
--
2.52.0